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.
37 lines
569 B
37 lines
569 B
#include "esp8266.h"
|
|
#include "uart_driver.h"
|
|
#include "sbmp.h"
|
|
|
|
#include "datalink.h"
|
|
|
|
|
|
static SBMP_Endpoint *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)
|
|
{
|
|
dbg("[SBMP] Datagram received.");
|
|
}
|
|
|
|
|
|
void datalink_receive(uint8_t byte)
|
|
{
|
|
sbmp_ep_receive(ep, byte);
|
|
}
|
|
|
|
/** Datalink */
|
|
void FLASH_FN datalinkInit(void)
|
|
{
|
|
ep = sbmp_ep_init(NULL, NULL, 256, dg_handler, u0_putc);
|
|
|
|
sbmp_ep_enable(ep, true);
|
|
|
|
info("SBMP started on UART0");
|
|
}
|
|
|