42#ifdef PREINIT_SUPPORTED
46#ifdef MikroCCoreVersion
47 #if MikroCCoreVersion >= 1
52#include "drv_digital_out.h"
53#include "drv_digital_in.h"
67#define BLE3_MAP_MIKROBUS( cfg, mikrobus ) \
68 cfg.tx_pin = MIKROBUS( mikrobus, MIKROBUS_TX ); \
69 cfg.rx_pin = MIKROBUS( mikrobus, MIKROBUS_RX ); \
70 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST ); \
71 cfg.cts = MIKROBUS( mikrobus, MIKROBUS_CS ); \
72 cfg.rts = MIKROBUS( mikrobus, MIKROBUS_INT )
79#define BLE3_RETVAL uint8_t
82#define BLE3_INIT_ERROR 0xFF
89#define BLE3_PARSER_NO_ERROR 0x00
90#define BLE3_PARSER_ERROR_REF 0x01
91#define BLE3_PARSER_ERROR_CMD 0x02
92#define BLE3_PARSER_ERROR_DATA 0x04
99#define BLE3_STATUS_DEVICE_READY 1
100#define BLE3_STATUS_ACT_NETWORK_AND_BROKER 4
101#define BLE3_STATUS_ACT_NETWORK 2
102#define BLE3_STATUS_ACT_BROKER 3
103#define BLE3_STATUS_DEVICE_BUSY 0
110#define BLE3_MODULE_POWER_ON 1
111#define BLE3_MODULE_POWER_OFF 0
118#define BLE3_SINGLE_CMD_AT "AT"
119#define BLE3_SINGLE_CMD_AT_W "AT+W"
120#define BLE3_SINGLE_CMD_AT_R "AT+R"
121#define BLE3_SINGLE_CMD_ATE0 "ATE0"
122#define BLE3_SINGLE_CMD_ATE1 "ATE1"
123#define BLE3_SINGLE_CMD_AT_RST "AT+RST"
124#define BLE3_SINGLE_CMD_AT_CRST "AT+CRST"
125#define BLE3_SINGLE_CMD_AT_GMR "AT+GMR"
126#define BLE3_SINGLE_CMD_AT_GMSTA "AT+GMSTA"
127#define BLE3_SINGLE_CMD_AT_PUB "AT+PUB"
129#define BLE3_SINGLE_CMD_SET_AT_LRSP_1 "AT+LRSP=1"
130#define BLE3_SINGLE_CMD_SET_AT_LRSP_0 "AT+LRSP=0"
131#define BLE3_SINGLE_CMD_SET_AT_CEN_1 "AT+CEN=1"
132#define BLE3_SINGLE_CMD_SET_AT_CEN_0 "AT+CEN=0"
133#define BLE3_SINGLE_CMD_SET_AT_NWC_1 "AT+NWC=1"
134#define BLE3_SINGLE_CMD_SET_AT_NWC_0 "AT+NWC=0"
135#define BLE3_SINGLE_CMD_SET_AT_BRC_1 "AT+BRC=1"
136#define BLE3_SINGLE_CMD_SET_AT_BRC_0 "AT+BRC=0"
137#define BLE3_SINGLE_CMD_SET_AT_GPEN_0 "AT+GPEN=0"
138#define BLE3_SINGLE_CMD_SET_AT_GPEN_1 "AT+GPEN=1"
140#define BLE3_SINGLE_CMD_GET_AT_LRSP "AT+LRSP?"
141#define BLE3_SINGLE_CMD_GET_AT_CEN "AT+CEN?"
142#define BLE3_SINGLE_CMD_GET_AT_NWC "AT+NWC?"
143#define BLE3_SINGLE_CMD_GET_AT_BRC "AT+BRC?"
144#define BLE3_SINGLE_CMD_GET_AT_GPEN "AT+GPEN?"
145#define BLE3_SINGLE_CMD_GET_AT_NWCR "AT+NWCR?"
146#define BLE3_SINGLE_CMD_GET_AT_BRCR "AT+BRCR?"
147#define BLE3_SINGLE_CMD_GET_AT_DSET "AT+DSET?"
149#define BLE3_SINGLE_CMD_TEST_AT_LRSP "AT+LRSP=?"
150#define BLE3_SINGLE_CMD_TEST_AT_CEN "AT+CEN=?"
151#define BLE3_SINGLE_CMD_TEST_AT_NWC "AT+NWC=?"
152#define BLE3_SINGLE_CMD_TEST_AT_BRC "AT+BRC=?"
153#define BLE3_SINGLE_CMD_TEST_AT_GPEN "AT+GPEN=?"
154#define BLE3_SINGLE_CMD_TEST_AT_NWCR "AT+NWCR=?"
155#define BLE3_SINGLE_CMD_TEST_AT_BRCR "AT+BRCR=?"
156#define BLE3_SINGLE_CMD_TEST_AT_DSET "AT+DSET=?"
158#define BLE3_MULTI_CMD_AT_DSET "AT+DSET"
159#define BLE3_MULTI_CMD_AT_BRCR "AT+BRCR"
160#define BLE3_MULTI_CMD_AT_NWCR "AT+NWCR"
167#define DRV_RX_BUFFER_SIZE 100
168#define DRV_TX_BUFFER_SIZE 100
#define DRV_RX_BUFFER_SIZE
Definition ble3.h:167
#define DRV_TX_BUFFER_SIZE
Definition ble3.h:168
#define BLE3_RETVAL
Definition ble3.h:79
int32_t ble3_generic_read(ble3_t *ctx, char *data_buf, uint16_t max_len)
Generic read function.
void ble3_generic_write(ble3_t *ctx, char *data_buf, uint16_t len)
Generic write function.
void ble3_cfg_setup(ble3_cfg_t *cfg)
Config Object Initialization function.
BLE3_RETVAL ble3_init(ble3_t *ctx, ble3_cfg_t *cfg)
Initialization function.
Click configuration structure definition.
Definition ble3.h:204
pin_name_t rts
Definition ble3.h:214
uint32_t baud_rate
Definition ble3.h:218
pin_name_t cts
Definition ble3.h:213
bool uart_blocking
Definition ble3.h:219
uart_data_bits_t data_bit
Definition ble3.h:220
pin_name_t tx_pin
Definition ble3.h:208
pin_name_t rx_pin
Definition ble3.h:207
uart_stop_bits_t stop_bit
Definition ble3.h:222
uart_parity_t parity_bit
Definition ble3.h:221
pin_name_t rst
Definition ble3.h:212
Click ctx object definition.
Definition ble3.h:181
digital_out_t rts
Definition ble3.h:185
uart_t uart
Definition ble3.h:193
digital_in_t cts
Definition ble3.h:189
digital_out_t rst
Definition ble3.h:184