29 #include <libopencm3/stm32/rcc.h> 30 #include <libopencm3/stm32/gpio.h> 31 #include <libopencm3/stm32/usart.h> 32 #include <libopencm3/cm3/nvic.h> 33 #include <libopencmsis/core_cm3.h> 41 #define RADIO_ESP8266_USART 2 75 rcc_periph_clock_enable(RCC_AFIO);
119 char command[256] = {0};
120 int length =
snprintf(command,
LENGTH(command),
"AT+CIPSTART=\"TCP\",\"%s\",%u\r\n", host, port);
128 char command[16+1] = {0};
129 int command_length =
snprintf(command,
LENGTH(command),
"AT+CIPSEND=%u\r\n", length);
130 if (command_length>0) {
volatile bool radio_esp8266_activity
a response has been returned by the radio
void radio_esp8266_tcp_open(char *host, uint16_t port)
establish TCP connection
#define USART_ISR(x)
get interrupt service routine for USART based on USART identifier
volatile bool radio_esp8266_success
the last command has succeeded
static void radio_esp8266_transmit(uint8_t *data, uint8_t length)
transmit data to radio
library to send data using ESP8266 WiFi SoC (API)
global definitions and methods (API)
static volatile uint16_t rx_used
number of byte in receive buffer
#define USART_IRQ(x)
get NVIC IRQ for USART based on USART identifier
#define USART(x)
get USART based on USART identifier
#define USART_PORT(x)
get port for USART based on USART identifier
#define USART_PORT_RCC(x)
get RCC for USART port based on USART identifier
size_t snprintf(char *str, size_t size, const char *format,...)
print format string on string or user output
void radio_esp8266_setup(void)
setup peripherals to communicate with radio
void radio_esp8266_send(uint8_t *data, uint8_t length)
send data (requires established connection)
#define LENGTH(x)
get the length of an array
#define USART_RCC(x)
get RCC for USART based on USART identifier
#define USART_PIN_RX(x)
get receive pin for USART based on USART identifier
#define USART_PIN_TX(x)
get transmit pin for USART based on USART identifier
#define RADIO_ESP8266_USART
USART peripheral.
static uint8_t rx_buffer[24]
buffer for received data (we only expect AT responses)
static uint8_t tx_buffer[256]
buffer for data to transmit
void radio_esp8266_close(void)
close established connection
static volatile uint16_t tx_used
number of bytes used in transmit buffer