Paparazzi UAS  v5.8.2_stable-0-g6260b7c
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
xbee.c File Reference

Maxstream XBee serial input and output. More...

+ Include dependency graph for xbee.c:

Go to the source code of this file.

Macros

#define GROUND_STATION_ADDR   0x100
 Ground station address. More...
 
#define XBEE_MY_ADDR   AC_ID
 Aircraft address. More...
 
#define TX_OPTIONS   0x00
 Constants for the API protocol. More...
 
#define NO_FRAME_ID   0
 
#define XBEE_API_OVERHEAD   5 /* start + len_msb + len_lsb + API_id + checksum */
 
#define AT_COMMAND_SEQUENCE   "+++"
 
#define AT_SET_MY   "ATMY"
 
#define AT_AP_MODE   "ATAP1\r"
 
#define AT_EXIT   "ATCN\r"
 
#define XBEE_BAUD_ALTERNATE   B57600
 
#define XBEE_ATBD_CODE   "ATBD3\rATWR\r"
 

Functions

static void put_1byte (struct xbee_transport *trans, struct link_device *dev, const uint8_t byte)
 Xbee protocol implementation. More...
 
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 put_named_byte (struct xbee_transport *trans, struct link_device *dev, enum TransportDataType type, enum TransportDataFormat format, uint8_t byte, const char *name)
 
static uint8_t size_of (struct xbee_transport *trans, uint8_t len)
 
static void start_message (struct xbee_transport *trans, struct link_device *dev, uint8_t payload_len)
 
static void end_message (struct xbee_transport *trans, struct link_device *dev)
 
static void overrun (struct xbee_transport *trans, struct link_device *dev)
 
static void count_bytes (struct xbee_transport *trans, struct link_device *dev, uint8_t bytes)
 
static int check_available_space (struct xbee_transport *trans, struct link_device *dev, uint8_t bytes)
 
static uint8_t xbee_text_reply_is_ok (struct link_device *dev)
 
static uint8_t xbee_try_to_enter_api (struct link_device *dev)
 
void xbee_init (void)
 Initialisation in API mode and setting of the local address FIXME: busy wait. More...
 

Variables

struct xbee_transport xbee_tp
 

Detailed Description

Maxstream XBee serial input and output.

Definition in file xbee.c.

Macro Definition Documentation

#define AT_AP_MODE   "ATAP1\r"

Definition at line 47 of file xbee.c.

Referenced by xbee_init().

#define AT_COMMAND_SEQUENCE   "+++"

Definition at line 45 of file xbee.c.

Referenced by xbee_try_to_enter_api().

#define AT_EXIT   "ATCN\r"

Definition at line 48 of file xbee.c.

Referenced by xbee_init().

#define AT_SET_MY   "ATMY"

Definition at line 46 of file xbee.c.

Referenced by xbee_init().

#define GROUND_STATION_ADDR   0x100

Ground station address.

Definition at line 34 of file xbee.c.

#define NO_FRAME_ID   0

Definition at line 40 of file xbee.c.

#define TX_OPTIONS   0x00

Constants for the API protocol.

Definition at line 39 of file xbee.c.

#define XBEE_API_OVERHEAD   5 /* start + len_msb + len_lsb + API_id + checksum */

Definition at line 41 of file xbee.c.

Referenced by size_of(), and start_message().

#define XBEE_ATBD_CODE   "ATBD3\rATWR\r"

Definition at line 154 of file xbee.c.

Referenced by xbee_init().

#define XBEE_BAUD_ALTERNATE   B57600

Definition at line 153 of file xbee.c.

Referenced by xbee_init().

#define XBEE_MY_ADDR   AC_ID

Aircraft address.

Definition at line 36 of file xbee.c.

Referenced by xbee_init().

Function Documentation

static int check_available_space ( struct xbee_transport trans,
struct link_device dev,
uint8_t  bytes 
)
static

Definition at line 113 of file xbee.c.

References link_device::check_free_space, and link_device::periph.

Referenced by xbee_init().

+ Here is the caller graph for this function:

static void count_bytes ( struct xbee_transport trans,
struct link_device dev,
uint8_t  bytes 
)
static

Definition at line 107 of file xbee.c.

References link_device::nb_bytes.

Referenced by xbee_init().

+ Here is the caller graph for this function:

static void end_message ( struct xbee_transport trans,
struct link_device dev 
)
static

Definition at line 94 of file xbee.c.

References xbee_transport::cs_tx, link_device::periph, link_device::put_byte, and link_device::send_message.

Referenced by xbee_init().

+ Here is the caller graph for this function:

static void overrun ( struct xbee_transport trans,
struct link_device dev 
)
static

Definition at line 101 of file xbee.c.

References link_device::nb_ovrn.

Referenced by xbee_init().

+ Here is the caller graph for this function:

static void put_1byte ( struct xbee_transport trans,
struct link_device dev,
const uint8_t  byte 
)
static

Xbee protocol implementation.

Definition at line 52 of file xbee.c.

References xbee_transport::cs_tx, link_device::periph, and link_device::put_byte.

Referenced by put_bytes(), and put_named_byte().

+ Here is the caller graph for this function:

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

Definition at line 58 of file xbee.c.

References put_1byte().

Referenced by start_message(), and xbee_init().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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 
)
static

Definition at line 69 of file xbee.c.

References put_1byte().

Referenced by xbee_init().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static uint8_t size_of ( struct xbee_transport trans,
uint8_t  len 
)
static

Definition at line 76 of file xbee.c.

References XBEE_API_OVERHEAD, and XBEE_TX_OVERHEAD.

Referenced by xbee_init().

+ Here is the caller graph for this function:

static void start_message ( struct xbee_transport trans,
struct link_device dev,
uint8_t  payload_len 
)
static

Definition at line 82 of file xbee.c.

References xbee_transport::cs_tx, DL_FORMAT_SCALAR, DL_TYPE_UINT8, link_device::nb_msgs, link_device::periph, link_device::put_byte, put_bytes(), XBEE_API_OVERHEAD, XBEE_START, XBEE_TX_HEADER, and XBEE_TX_OVERHEAD.

Referenced by xbee_init().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static uint8_t xbee_text_reply_is_ok ( struct link_device dev)
static

Definition at line 119 of file xbee.c.

References link_device::char_available, FALSE, link_device::get_byte, link_device::periph, and TRUE.

Referenced by xbee_try_to_enter_api().

+ Here is the caller graph for this function:

static uint8_t xbee_try_to_enter_api ( struct link_device dev)
static

Switching to AT mode (FIXME: busy waiting)

  • busy wait 1.25s

Definition at line 139 of file xbee.c.

References AT_COMMAND_SEQUENCE, print_string(), sys_time_usleep(), and xbee_text_reply_is_ok().

Referenced by xbee_init().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Variable Documentation

struct xbee_transport xbee_tp

Definition at line 43 of file xbee.c.

Referenced by xbee_init().