ESP8266 part of the f105-motor-demo project (see f105-motor-demo_stm32)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
f105-motor-demo_esp/user/datalink.c

39 lines
744 B

#include "uart_driver.h"
#include "datalink.h"
// payload rx buffer
#define PAYLOAD_BUFFER_LEN (256+3)
SBMP_Endpoint *dlnk_ep;
/** func used for sending bytes by SBMP */
static void FLASH_FN u0_putc(uint8_t c)
{
UART_WriteChar(UART0, c, 0);
}
static void FLASH_FN dg_handler(SBMP_Datagram *dg)
{
9 years ago
dbg("[SBMP] Datagram received, type %d, session %d", dg->type, dg->session);
}
/** This is called by the UART rx handler */
void datalink_receive(uint8_t byte)
{
sbmp_ep_receive(dlnk_ep, byte);
}
/** Datalink */
void FLASH_FN datalinkInit(void)
{
dlnk_ep = sbmp_ep_init(NULL, NULL, PAYLOAD_BUFFER_LEN, dg_handler, u0_putc);
9 years ago
sbmp_ep_init_listeners(dlnk_ep, NULL, 4);
sbmp_ep_enable(dlnk_ep, true);
info("SBMP started on UART0");
}