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 BLE12_CMD_AT "AT"
74#define BLE12_CMD_SW_RESET "AT+RESET"
75#define BLE12_CMD_GET_VERSION "AT+VERSION?"
76#define BLE12_CMD_GET_RSSI "AT+RSSI?"
77#define BLE12_CMD_SET_ADINTERVAL "AT+ADINTERVAL="
78#define BLE12_CMD_GET_ADINTERVAL "AT+ADINTERVAL=?"
79#define BLE12_CMD_SET_ADSTART "AT+ADSTART="
80#define BLE12_CMD_GET_ADSTART "AT+ADSTART?"
81#define BLE12_CMD_SET_ADVMANU "AT+ADVMANU="
82#define BLE12_CMD_GET_ADVMANU "AT+ADVMANU?"
83#define BLE12_CMD_SET_ADVRESP "AT+ADVRESP="
84#define BLE12_CMD_GET_ADVRESP "AT+ADVRESP?"
85#define BLE12_CMD_SET_SCANNER "AT+SCANNER="
86#define BLE12_CMD_GET_SCANNER "AT+SCANNER?"
87#define BLE12_CMD_SET_AUTOCON "AT+AUTOCON="
88#define BLE12_CMD_GET_AUTOCON "AT+AUTOCON?"
89#define BLE12_CMD_SET_DISCON "AT+DISCON=1"
90#define BLE12_CMD_SET_FILTERA "AT+FILTERA="
91#define BLE12_CMD_GET_FILTERA "AT+FILTERA?"
92#define BLE12_CMD_SET_FILTERR "AT+FILTERR="
93#define BLE12_CMD_GET_FILTERR "AT+FILTERR?"
94#define BLE12_CMD_SET_MANUAID "AT+MANUAID="
95#define BLE12_CMD_GET_MANUAID "AT+MANUAID?"
96#define BLE12_CMD_SET_MANURID "AT+MANURID="
97#define BLE12_CMD_GET_MANURID "AT+MANURID?"
98#define BLE12_CMD_SET_DCDC "AT+DCDC="
99#define BLE12_CMD_GET_DCDC "AT+DCDC?"
100#define BLE12_CMD_SET_SAVE "AT+SAVE=1"
101#define BLE12_CMD_SET_STOP "AT+STOP="
102#define BLE12_CMD_SET_NAME "AT+NAME="
103#define BLE12_CMD_GET_UART "AT+UART?"
104#define BLE12_CMD_SET_UART "AT+UART="
105#define BLE12_CMD_GET_ADDR "AT+ADDR?"
106#define BLE12_CMD_GET_RX "AT+RX?"
107#define BLE12_CMD_SET_DEFAULT "AT+DEFAULT"
108#define BLE12_CMD_GET_RFPW "AT+RFPW?"
109#define BLE12_CMD_SET_RFPW "AT+RFPW="
110#define BLE12_CMD_SET_GPIO "AT+PIO="
111#define BLE12_CMD_GET_GPIO "AT+PIO?"
112#define BLE12_CMD_SET_GPIO_IO "AT+PIS="
113#define BLE12_CMD_INIT_LED1 "AT+PIS=017,1"
114#define BLE12_CMD_INIT_LED2 "AT+PIS=019,1"
120#define BLE12_EVT_CONNECTED "CONNECTED"
121#define BLE12_EVT_DISCONNECTED "DISCONNECTED"
122#define BLE12_EVT_SCAN_TIMEOUT "SCAN TIMEOUT"
128#define BLE12_LED_YELLOW 0x00
129#define BLE12_LED_RED 0x01
130#define BLE12_LED_ON 0x00
131#define BLE12_LED_OFF 0x01
132#define BLE12_OP_MODE_CMD 0x00
133#define BLE12_OP_MODE_DATA 0x01
134#define BLE12_SELECT_LED_YELLOW "017,"
135#define BLE12_SELECT_LED_RED "019,"
136#define BLE12_SET_LED_STATE_ON "0"
137#define BLE12_SET_LED_STATE_OFF "1"
144#define DRV_BUFFER_SIZE 200
162#define BLE12_MAP_MIKROBUS( cfg, mikrobus ) \
163 cfg.tx_pin = MIKROBUS( mikrobus, MIKROBUS_TX ); \
164 cfg.rx_pin = MIKROBUS( mikrobus, MIKROBUS_RX ); \
165 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST ); \
166 cfg.wkp = MIKROBUS( mikrobus, MIKROBUS_CS ); \
167 cfg.cmd = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
168 cfg.req = MIKROBUS( mikrobus, MIKROBUS_INT )
ble12_return_value_t
BLE 12 Click return value data.
Definition ble12.h:226
@ BLE12_ERROR
Definition ble12.h:228
@ BLE12_OK
Definition ble12.h:227
#define DRV_BUFFER_SIZE
BLE 12 driver buffer size.
Definition ble12.h:144
err_t ble12_default_cfg(ble12_t *ctx)
BLE 12 default configuration function.
err_t ble12_set_adv_interval(ble12_t *ctx, uint8_t *adv_interval)
BLE 12 set adv interval function.
err_t ble12_set_default(ble12_t *ctx)
BLE 12 set default function.
err_t ble12_save_config(ble12_t *ctx)
BLE 12 save config function.
err_t ble12_generic_read(ble12_t *ctx, char *data_buf, uint16_t max_len)
BLE 12 data reading function.
err_t ble12_get_version(ble12_t *ctx)
BLE 12 get version function.
err_t ble12_set_device_name(ble12_t *ctx, uint8_t *device_name)
BLE 12 set device name function.
err_t ble12_send_data(ble12_t *ctx, char *tx_data)
BLE 12 send data function.
err_t ble12_reset(ble12_t *ctx)
BLE 12 reset function.
err_t ble12_set_op_mode(ble12_t *ctx, uint8_t op_mode)
BLE 12 set operating mode function.
err_t ble12_init(ble12_t *ctx, ble12_cfg_t *cfg)
BLE 12 initialization function.
err_t ble12_init_led(ble12_t *ctx)
BLE 12 LED initialization function.
void ble12_cfg_setup(ble12_cfg_t *cfg)
BLE 12 configuration object setup function.
err_t ble12_event_startup(ble12_t *ctx)
BLE 12 event start-up function.
err_t ble12_send_cmd(ble12_t *ctx, char *cmd)
BLE 12 sends the command function.
err_t ble12_wake_up_device(ble12_t *ctx)
BLE 12 wake up the device function.
err_t ble12_disconnect(ble12_t *ctx)
BLE 12 disconnect function.
err_t ble12_generic_write(ble12_t *ctx, char *data_buf, uint16_t len)
BLE 12 data writing function.
err_t ble12_set_led_state(ble12_t *ctx, uint8_t led, uint8_t state)
BLE 12 set LED state function.
BLE 12 Click configuration object.
Definition ble12.h:201
uint32_t baud_rate
Definition ble12.h:213
pin_name_t wkp
Definition ble12.h:208
bool uart_blocking
Definition ble12.h:214
pin_name_t cmd
Definition ble12.h:209
pin_name_t req
Definition ble12.h:210
uart_data_bits_t data_bit
Definition ble12.h:215
pin_name_t tx_pin
Definition ble12.h:204
pin_name_t rx_pin
Definition ble12.h:203
uart_stop_bits_t stop_bit
Definition ble12.h:217
uart_parity_t parity_bit
Definition ble12.h:216
pin_name_t rst
Definition ble12.h:207
BLE 12 Click context object.
Definition ble12.h:178
digital_out_t cmd
Definition ble12.h:182
uart_t uart
Definition ble12.h:188
digital_in_t req
Definition ble12.h:185
digital_out_t wkp
Definition ble12.h:181
digital_out_t rst
Definition ble12.h:180