47 lines
1.6 KiB
C
47 lines
1.6 KiB
C
/** library to send data using ESP8266 WiFi SoC
|
|
* @file
|
|
* @author King Kévin <kingkevin@cuvoodoo.info>
|
|
* @copyright SPDX-License-Identifier: GPL-3.0-or-later
|
|
* @date 2016-2022
|
|
* @note peripherals used: USART @ref radio_esp8266_usart
|
|
*/
|
|
#pragma once
|
|
|
|
/** a response has been returned by the radio */
|
|
extern volatile bool radio_esp8266_activity;
|
|
/** the last command has succeeded */
|
|
extern volatile bool radio_esp8266_success;
|
|
/** data received (overwritten upon next receive) */
|
|
extern uint8_t radio_esp8266_received[];
|
|
/** length of receive data */
|
|
extern uint16_t radio_esp8266_received_len;
|
|
|
|
/** setup peripherals to communicate with radio
|
|
* @note this is blocking to ensure we are connected to the WiFi network
|
|
*/
|
|
void radio_esp8266_setup(void);
|
|
/** reset ESP */
|
|
void radio_esp8266_reset(void);
|
|
/** establish TCP connection
|
|
* @param[in] host host to connect to
|
|
* @param[in] port TCP port to connect to
|
|
* @note wait for activity to get success status
|
|
*/
|
|
void radio_esp8266_tcp_open(char* host, uint16_t port);
|
|
/** open listening connection
|
|
* @param[in] udp if it's an UDP or TCP connection
|
|
* @param[in] port port to listen to
|
|
* @return if operation succeeded
|
|
*/
|
|
bool radio_esp8266_listen(bool udp, uint16_t port);
|
|
/** send data (requires established connection)
|
|
* @param[in] data data to send
|
|
* @param[in] length size of data to send
|
|
* @note wait for activity to get success status
|
|
*/
|
|
void radio_esp8266_send(uint8_t* data, uint8_t length);
|
|
/** close established connection
|
|
* @note wait for activity to get success status
|
|
*/
|
|
void radio_esp8266_close(void);
|