mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-05-09 22:49:53 +08:00
[inter_mcu] update inter_mcu to use uart directly
This commit is contained in:
@@ -10,13 +10,15 @@ endif
|
||||
ifeq ($(TARGET),fbw)
|
||||
ifeq ($(INTERMCU_PORT),none)
|
||||
INTERMCU_PORT = UART2
|
||||
INTERMCU_PORT_LOWER = $(shell echo $(INTERMCU_PORT) | tr A-Z a-z)
|
||||
endif
|
||||
fbw.CFLAGS += -DINTERMCU_LINK=$(INTERMCU_PORT) -DUSE_$(INTERMCU_PORT) -D$(INTERMCU_PORT)_BAUD=B57600
|
||||
fbw.CFLAGS += -DINTERMCU_LINK=$(INTERMCU_PORT_LOWER) -DUSE_$(INTERMCU_PORT) -D$(INTERMCU_PORT)_BAUD=B57600
|
||||
else
|
||||
ifeq ($(INTERMCU_PORT),none)
|
||||
INTERMCU_PORT = UART5
|
||||
INTERMCU_PORT_LOWER = $(shell echo $(INTERMCU_PORT) | tr A-Z a-z)
|
||||
endif
|
||||
ap.CFLAGS += -DINTERMCU_LINK=$(INTERMCU_PORT) -DUSE_$(INTERMCU_PORT) -D$(INTERMCU_PORT)_BAUD=B57600
|
||||
ap.CFLAGS += -DINTERMCU_LINK=$(INTERMCU_PORT_LOWER) -DUSE_$(INTERMCU_PORT) -D$(INTERMCU_PORT)_BAUD=B57600
|
||||
endif
|
||||
|
||||
ifneq ($(TARGET),sim)
|
||||
|
||||
@@ -29,16 +29,12 @@
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// LINK
|
||||
|
||||
#define __InterMcuLink(dev, _x) dev##_x
|
||||
#define _InterMcuLink(dev, _x) __InterMcuLink(dev, _x)
|
||||
#define InterMcuLink(_x) _InterMcuLink(INTERMCU_LINK, _x)
|
||||
|
||||
#define InterMcuBuffer() InterMcuLink(ChAvailable())
|
||||
|
||||
#define InterMcuUartSend1(c) InterMcuLink(Transmit(c))
|
||||
#define InterMcuUartSetBaudrate(_a) InterMcuLink(SetBaudrate(_a))
|
||||
#define InterMcuUartRunning InterMcuLink(TxRunning)
|
||||
#define InterMcuUartSendMessage InterMcuLink(SendMessage)
|
||||
// Use uart interface directly
|
||||
#define InterMcuBuffer() uart_char_available(&(INTERMCU_LINK))
|
||||
#define InterMcuUartSend1(c) uart_transmit(&(INTERMCU_LINK), c)
|
||||
#define InterMcuUartSetBaudrate(_a) uart_periph_set_baudrate(&(INTERMCU_LINK), _a)
|
||||
#define InterMcuUartSendMessage() {}
|
||||
#define InterMcuUartGetch() uart_getch(&(INTERMCU_LINK))
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// PROTOCOL
|
||||
@@ -379,8 +375,8 @@ void link_mcu_event_task(void)
|
||||
{
|
||||
/* A message has been received */
|
||||
if (InterMcuBuffer()) {
|
||||
while (InterMcuLink(ChAvailable())) {
|
||||
intermcu_parse(InterMcuLink(Getch()));
|
||||
while (InterMcuBuffer()) {
|
||||
intermcu_parse(InterMcuUartGetch());
|
||||
if (intermcu_data.msg_available) {
|
||||
parse_mavpilot_msg();
|
||||
intermcu_data.msg_available = FALSE;
|
||||
|
||||
Reference in New Issue
Block a user