39#ifdef PREINIT_SUPPORTED
43#ifdef MikroCCoreVersion
44 #if MikroCCoreVersion >= 1
49#include "drv_digital_out.h"
50#include "drv_digital_in.h"
73#define XBEE_ENTER_CMD_MODE "+++"
74#define XBEE_EXIT_CMD_MODE "CN"
75#define XBEE_FACTORY_RESET "RE"
76#define XBEE_SET_NODE_IDENTIFIER "NI"
77#define XBEE_GET_SERIAL_NUMBER "SH,SL"
78#define XBEE_SET_DEST_ADDR_HIGH "DH"
79#define XBEE_SET_DEST_ADDR_LOW "DL"
80#define XBEE_APPLY_CHANGES "AC"
81#define XBEE_API_MODE "AP"
82#define XBEE_SAVE_CHANGES "WR"
83#define XBEE_CMD_AT "AT"
84#define XBEE_DELIMITER ","
85#define XBEE_CARRIAGE_RETURN "\r"
91#define XBEE_MODE_TRANSPARENT 0
92#define XBEE_MODE_API_WITHOUT_ESC 1
93#define XBEE_MODE_API_WITH_ESC 2
99#define XBEE_BROADCAST_DEST_ADDRESS_HIGH "00000000"
100#define XBEE_BROADCAST_DEST_ADDRESS_LOW "0000FFFF"
106#define XBEE_RSP_OK "OK"
107#define XBEE_RSP_ERROR "ERROR"
114#define XBEE_DRV_BUFFER_SIZE 200
132#define XBEE_MAP_MIKROBUS( cfg, mikrobus ) \
133 cfg.tx_pin = MIKROBUS( mikrobus, MIKROBUS_TX ); \
134 cfg.rx_pin = MIKROBUS( mikrobus, MIKROBUS_RX ); \
135 cfg.rts = MIKROBUS( mikrobus, MIKROBUS_AN ); \
136 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST ); \
137 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
138 cfg.cts = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
139 cfg.att_dtr = MIKROBUS( mikrobus, MIKROBUS_INT );
#define XBEE_DRV_BUFFER_SIZE
XBEE driver buffer size.
Definition xbee.h:114
err_t xbee_init(xbee_t *ctx, xbee_cfg_t *cfg)
XBEE initialization function.
err_t xbee_set_device_name(xbee_t *ctx, char *dev_name)
XBEE set device name function.
err_t xbee_factory_reset(xbee_t *ctx)
XBEE factory reset function.
err_t xbee_set_destination_address(xbee_t *ctx, char *dest_addr_high, char *dest_addr_low)
XBEE set destination address function.
void xbee_set_rst_pin(xbee_t *ctx, uint8_t state)
XBEE set rst pin function.
void xbee_set_cs_pin(xbee_t *ctx, uint8_t state)
XBEE set cs pin function.
err_t xbee_generic_write(xbee_t *ctx, char *data_in, uint16_t len)
XBEE data writing function.
err_t xbee_enter_command_mode(xbee_t *ctx)
XBEE enter command mode function.
void xbee_set_rts_pin(xbee_t *ctx, uint8_t state)
XBEE set rts pin function.
err_t xbee_get_serial_number(xbee_t *ctx)
XBEE get serial number function.
uint8_t xbee_get_att_dtr_pin(xbee_t *ctx)
XBEE get att_dtr pin function.
err_t xbee_write_command(xbee_t *ctx, char *data_buf)
XBEE write command function.
err_t xbee_apply_changes(xbee_t *ctx)
XBEE apply changes function.
err_t xbee_exit_command_mode(xbee_t *ctx)
XBEE exit command mode function.
err_t xbee_generic_read(xbee_t *ctx, char *data_out, uint16_t len)
XBEE data reading function.
err_t xbee_save_changes(xbee_t *ctx)
XBEE save changes function.
uint8_t xbee_get_cts_pin(xbee_t *ctx)
XBEE get cts pin function.
void xbee_cfg_setup(xbee_cfg_t *cfg)
XBEE configuration object setup function.
err_t xbee_set_api_mode(xbee_t *ctx, uint8_t api_mode)
XBEE set api mode function.
void xbee_hw_reset(xbee_t *ctx)
XBEE hw reset function.
XBEE Click configuration object.
Definition xbee.h:173
pin_name_t rts
Definition xbee.h:179
uint32_t baud_rate
Definition xbee.h:186
pin_name_t att_dtr
Definition xbee.h:183
pin_name_t cts
Definition xbee.h:182
bool uart_blocking
Definition xbee.h:187
uart_data_bits_t data_bit
Definition xbee.h:188
pin_name_t tx_pin
Definition xbee.h:176
pin_name_t rx_pin
Definition xbee.h:175
uart_stop_bits_t stop_bit
Definition xbee.h:190
uart_parity_t parity_bit
Definition xbee.h:189
pin_name_t rst
Definition xbee.h:180
pin_name_t cs
Definition xbee.h:181
XBEE Click context object.
Definition xbee.h:149
digital_out_t cs
Definition xbee.h:153
digital_in_t att_dtr
Definition xbee.h:157
digital_out_t rts
Definition xbee.h:151
uart_t uart
Definition xbee.h:160
digital_in_t cts
Definition xbee.h:156
digital_out_t rst
Definition xbee.h:152
xbee_return_value_t
XBEE Click return value data.
Definition xbee.h:199
@ XBEE_OK
Definition xbee.h:200
@ XBEE_ERROR
Definition xbee.h:201