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 XBEE2_ENTER_CMD_MODE "+++"
74#define XBEE2_EXIT_CMD_MODE "CN"
75#define XBEE2_FACTORY_RESET "RE"
76#define XBEE2_SET_NODE_IDENTIFIER "NI"
77#define XBEE2_GET_SERIAL_NUMBER "SH,SL"
78#define XBEE2_SET_DEST_ADDR_HIGH "DH"
79#define XBEE2_SET_DEST_ADDR_LOW "DL"
80#define XBEE2_APPLY_CHANGES "AC"
81#define XBEE2_API_MODE "AP"
82#define XBEE2_DEV_ROLE "CE"
83#define XBEE2_SAVE_CHANGES "WR"
84#define XBEE2_CMD_AT "AT"
85#define XBEE2_DELIMITER ","
86#define XBEE2_CARRIAGE_RETURN "\r"
92#define XBEE2_MODE_TRANSPARENT 0
93#define XBEE2_MODE_API_WITHOUT_ESC 1
94#define XBEE2_MODE_API_WITH_ESC 2
100#define XBEE2_DEVICE_ROLE_JOIN_NETWORK 0
101#define XBEE2_DEVICE_ROLE_FORM_NETWORK 1
107#define XBEE2_BROADCAST_DEST_ADDRESS_HIGH "00000000"
108#define XBEE2_BROADCAST_DEST_ADDRESS_LOW "0000FFFF"
114#define XBEE2_RSP_OK "OK"
115#define XBEE2_RSP_ERROR "ERROR"
122#define DRV_BUFFER_SIZE 200
140#define XBEE2_MAP_MIKROBUS( cfg, mikrobus ) \
141 cfg.tx_pin = MIKROBUS( mikrobus, MIKROBUS_TX ); \
142 cfg.rx_pin = MIKROBUS( mikrobus, MIKROBUS_RX ); \
143 cfg.rts = MIKROBUS( mikrobus, MIKROBUS_AN ); \
144 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST ); \
145 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
146 cfg.cts = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
147 cfg.att_dtr = MIKROBUS( mikrobus, MIKROBUS_INT );
#define DRV_BUFFER_SIZE
XBEE 2 driver buffer size.
Definition xbee2.h:122
void xbee2_set_rts_pin(xbee2_t *ctx, uint8_t state)
XBEE 2 set rts pin function.
err_t xbee2_generic_write(xbee2_t *ctx, char *data_in, uint16_t len)
XBEE 2 data writing function.
err_t xbee2_set_api_mode(xbee2_t *ctx, uint8_t api_mode)
XBEE 2 set api mode function.
err_t xbee2_set_device_role(xbee2_t *ctx, uint8_t dev_role)
XBEE 2 set device role function.
void xbee2_set_cs_pin(xbee2_t *ctx, uint8_t state)
XBEE 2 set cs pin function.
uint8_t xbee2_get_att_dtr_pin(xbee2_t *ctx)
XBEE 2 get att_dtr pin function.
void xbee2_hw_reset(xbee2_t *ctx)
XBEE 2 hw reset function.
err_t xbee2_exit_command_mode(xbee2_t *ctx)
XBEE 2 exit command mode function.
err_t xbee2_set_device_name(xbee2_t *ctx, char *dev_name)
XBEE 2 set device name function.
err_t xbee2_generic_read(xbee2_t *ctx, char *data_out, uint16_t len)
XBEE 2 data reading function.
void xbee2_cfg_setup(xbee2_cfg_t *cfg)
XBEE 2 configuration object setup function.
err_t xbee2_factory_reset(xbee2_t *ctx)
XBEE 2 factory reset function.
err_t xbee2_get_serial_number(xbee2_t *ctx)
XBEE 2 get serial number function.
void xbee2_set_rst_pin(xbee2_t *ctx, uint8_t state)
XBEE 2 set rst pin function.
err_t xbee2_enter_command_mode(xbee2_t *ctx)
XBEE 2 enter command mode function.
err_t xbee2_init(xbee2_t *ctx, xbee2_cfg_t *cfg)
XBEE 2 initialization function.
uint8_t xbee2_get_cts_pin(xbee2_t *ctx)
XBEE 2 get cts pin function.
err_t xbee2_write_command(xbee2_t *ctx, char *data_buf)
XBEE 2 write command function.
err_t xbee2_set_destination_address(xbee2_t *ctx, char *dest_addr_high, char *dest_addr_low)
XBEE 2 set destination address function.
err_t xbee2_apply_changes(xbee2_t *ctx)
XBEE 2 apply changes function.
err_t xbee2_save_changes(xbee2_t *ctx)
XBEE 2 save changes function.
XBEE 2 Click configuration object.
Definition xbee2.h:181
pin_name_t rts
Definition xbee2.h:187
uint32_t baud_rate
Definition xbee2.h:194
pin_name_t att_dtr
Definition xbee2.h:191
pin_name_t cts
Definition xbee2.h:190
bool uart_blocking
Definition xbee2.h:195
uart_data_bits_t data_bit
Definition xbee2.h:196
pin_name_t tx_pin
Definition xbee2.h:184
pin_name_t rx_pin
Definition xbee2.h:183
uart_stop_bits_t stop_bit
Definition xbee2.h:198
uart_parity_t parity_bit
Definition xbee2.h:197
pin_name_t rst
Definition xbee2.h:188
pin_name_t cs
Definition xbee2.h:189
XBEE 2 Click context object.
Definition xbee2.h:157
digital_out_t cs
Definition xbee2.h:161
digital_in_t att_dtr
Definition xbee2.h:165
digital_out_t rts
Definition xbee2.h:159
uart_t uart
Definition xbee2.h:168
digital_in_t cts
Definition xbee2.h:164
digital_out_t rst
Definition xbee2.h:160
xbee2_return_value_t
XBEE 2 Click return value data.
Definition xbee2.h:207
@ XBEE2_ERROR
Definition xbee2.h:209
@ XBEE2_OK
Definition xbee2.h:208