mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-05-22 04:13:39 +08:00
Adds define handling for xbee channel configuration.
This commit is contained in:
@@ -30,6 +30,9 @@
|
||||
#include "mcu_periph/uart.h"
|
||||
#include "generated/airframe.h"
|
||||
|
||||
#define STR_(s) #s
|
||||
#define STR(s) STR_(s)
|
||||
|
||||
#ifndef XBEE_TYPE
|
||||
#define XBEE_TYPE XBEE_24
|
||||
#endif
|
||||
@@ -37,6 +40,15 @@
|
||||
#define XBEE_INIT ""
|
||||
#endif
|
||||
|
||||
#ifdef XBEE_CHANNEL
|
||||
#define XBEE_CHANNEL_CONF "ATCH" STR(XBEE_CHANNEL) "\r"
|
||||
INFO("XBEE channel configured : " XBEE_CHANNEL_CONF)
|
||||
#else
|
||||
#define XBEE_CHANNEL_CONF ""
|
||||
#endif
|
||||
|
||||
#define CONCAT(a, b) a b
|
||||
|
||||
struct xbee_transport xbee_tp;
|
||||
|
||||
void xbee_dl_init(void)
|
||||
@@ -44,10 +56,10 @@ void xbee_dl_init(void)
|
||||
#if USE_HARD_FAULT_RECOVERY
|
||||
if (recovering_from_hard_fault)
|
||||
// in case of hardfault recovery, we want to skip xbee init which as an active wait
|
||||
xbee_transport_init(&xbee_tp, &((XBEE_UART).device), AC_ID, XBEE_TYPE, XBEE_BAUD, NULL, XBEE_INIT);
|
||||
xbee_transport_init(&xbee_tp, &((XBEE_UART).device), AC_ID, XBEE_TYPE, XBEE_BAUD, NULL, CONCAT(XBEE_INIT, XBEE_CHANNEL_CONF));
|
||||
else
|
||||
#endif
|
||||
xbee_transport_init(&xbee_tp, &((XBEE_UART).device), AC_ID, XBEE_TYPE, XBEE_BAUD, sys_time_usleep, XBEE_INIT);
|
||||
xbee_transport_init(&xbee_tp, &((XBEE_UART).device), AC_ID, XBEE_TYPE, XBEE_BAUD, sys_time_usleep, CONCAT(XBEE_INIT, XBEE_CHANNEL_CONF));
|
||||
}
|
||||
|
||||
void xbee_dl_event(void)
|
||||
|
||||
Reference in New Issue
Block a user