34 #define GROUND_STATION_ADDR 0x100
36 #define XBEE_MY_ADDR AC_ID
39 #define TX_OPTIONS 0x00
41 #define XBEE_API_OVERHEAD 5
45 #define AT_COMMAND_SEQUENCE "+++"
46 #define AT_SET_MY "ATMY"
47 #define AT_AP_MODE "ATAP1\r"
48 #define AT_EXIT "ATCN\r"
64 for (i = 0; i < len; i++) {
71 uint8_t byte,
const char *name __attribute__((unused)))
132 if ((count > 2) && (c[0] ==
'O') && (c[1] ==
'K')) {
152 #if XBEE_BAUD == B9600
153 #define XBEE_BAUD_ALTERNATE B57600
154 #define XBEE_ATBD_CODE "ATBD3\rATWR\r"
155 #pragma message "Experimental: XBEE-API@9k6 auto-baudrate 57k6 -> 9k6 (stop ground link for correct operation)"
156 #elif XBEE_BAUD == B57600
157 #define XBEE_BAUD_ALTERNATE B9600
158 #define XBEE_ATBD_CODE "ATBD6\rATWR\r"
159 #pragma message "Experimental: XBEE-API@57k6 auto-baudrate 9k6 -> 57k6 (stop ground link for correct operation)"
161 #pragma message "XBEE-API Non default baudrate: auto-baud disabled."
186 #ifndef NO_XBEE_API_INIT
191 #ifdef XBEE_BAUD_ALTERNATE
put_byte_t put_byte
put one byte
uint32_t nb_bytes
The number of bytes send.
static uint8_t size_of(struct xbee_transport *trans, uint8_t len)
volatile bool_t msg_received
message received flag
TransportDataFormat
Data format (scalar or array)
end_message_t end_message
transport trailer
check_free_space_t check_free_space
check if transmit buffer is not full
#define XBEE_API_OVERHEAD
static int check_available_space(struct xbee_transport *trans, struct link_device *dev, uint8_t bytes)
uint8_t(* size_of_t)(void *, uint8_t)
Function pointers definition.
void(* end_message_t)(void *, struct link_device *)
static uint8_t xbee_try_to_enter_api(struct link_device *dev)
#define AT_COMMAND_SEQUENCE
static void put_bytes(struct xbee_transport *trans, struct link_device *dev, enum TransportDataType type, enum TransportDataFormat format, uint8_t len, const void *bytes)
static void start_message(struct xbee_transport *trans, struct link_device *dev, uint8_t payload_len)
struct xbee_transport xbee_tp
static void end_message(struct xbee_transport *trans, struct link_device *dev)
size_of_t size_of
get size of payload with transport header and trailer
void(* overrun_t)(void *, struct link_device *)
TransportDataType
Data type.
void * periph
pointer to parent implementation
count_bytes_t count_bytes
count bytes to send
static void print_hex16(struct link_device *dev, uint16_t c)
void uart_periph_set_baudrate(struct uart_periph *periph, uint32_t baud)
static void overrun(struct xbee_transport *trans, struct link_device *dev)
uint16_t nb_msgs
The number of messages send.
#define XBEE_MY_ADDR
Aircraft address.
static uint8_t xbee_text_reply_is_ok(struct link_device *dev)
Architecture independent timing functions.
void(* start_message_t)(void *, struct link_device *, uint8_t)
get_byte_t get_byte
get a new char
void(* put_named_byte_t)(void *, struct link_device *, enum TransportDataType, enum TransportDataFormat, uint8_t, const char *)
static void put_1byte(struct xbee_transport *trans, struct link_device *dev, const uint8_t byte)
Xbee protocol implementation.
start_message_t start_message
transport header
put_named_byte_t put_named_byte
send a single byte or its name
#define XBEE_UNINIT
Status of the API packet receiver automata.
static const struct usb_device_descriptor dev
uint8_t nb_ovrn
The number of overruns.
int(* check_available_space_t)(void *, struct link_device *, uint8_t)
static void sys_time_usleep(uint32_t us)
void(* put_bytes_t)(void *, struct link_device *, enum TransportDataType, enum TransportDataFormat, uint8_t, const void *)
void * impl
pointer to parent implementation
static void count_bytes(struct xbee_transport *trans, struct link_device *dev, uint8_t bytes)
static void print_string(struct link_device *dev, char *s)
Common code for AP and FBW telemetry.
struct transport_rx trans_rx
check_available_space_t check_available_space
check if transmit buffer is not full
char_available_t char_available
check if a new character is available
put_bytes_t put_bytes
send bytes
static void put_named_byte(struct xbee_transport *trans, struct link_device *dev, enum TransportDataType type, enum TransportDataFormat format, uint8_t byte, const char *name)
Maxstream XBee serial input and output.
void(* count_bytes_t)(void *, struct link_device *, uint8_t)
void xbee_init(void)
Initialisation in API mode and setting of the local address FIXME: busy wait.
send_message_t send_message
send completed buffer
#define XBEE_BAUD_ALTERNATE
struct transport_tx trans_tx