Go to the documentation of this file.
35 #include "drv_digital_out.h"
36 #include "drv_digital_in.h"
37 #include "drv_analog_in.h"
60 #define BLUETOOTH2_ESCAPE_SEQUENCE "+++"
61 #define BLUETOOTH2_FACTORY_RESET "SET RESET"
62 #define BLUETOOTH2_LIST_PAIRINGS "SET BT PAIR"
63 #define BLUETOOTH2_REMOVE_PAIRINGS "SET BT PAIR *"
64 #define BLUETOOTH2_SW_RESET "RESET"
65 #define BLUETOOTH2_SET_DEVICE_NAME "SET BT NAME "
66 #define BLUETOOTH2_FIND_OTHER_DEVICES "INQUIRY "
67 #define BLUETOOTH2_PAIR "PAIR "
68 #define BLUETOOTH2_SET_CONTROL_CONFIG "SET CONTROL CONFIG "
69 #define BLUETOOTH2_ENABLE_OK_WITH_DEFAULT_VALUES "0040 1100"
70 #define BLUETOOTH2_DEV_ADDRESS_FORMAT "xx:xx:xx:xx:xx:xx"
77 #define DRV_BUFFER_SIZE 200
95 #define BLUETOOTH2_MAP_MIKROBUS( cfg, mikrobus ) \
96 cfg.tx_pin = MIKROBUS( mikrobus, MIKROBUS_TX ); \
97 cfg.rx_pin = MIKROBUS( mikrobus, MIKROBUS_RX ); \
98 cfg.cts = MIKROBUS( mikrobus, MIKROBUS_CS ); \
99 cfg.aio = MIKROBUS( mikrobus, MIKROBUS_AN ); \
100 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST ); \
101 cfg.io7 = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
102 cfg.rts = MIKROBUS( mikrobus, MIKROBUS_INT )
461 #endif // BLUETOOTH2_H
err_t bluetooth2_enable_ok_response(bluetooth2_t *ctx)
Bluetooth2 enable OK response function.
err_t bluetooth2_write_command(bluetooth2_t *ctx, char *data_buf)
Bluetooth2 write command function.
uart_t uart
Definition: bluetooth2.h:117
analog_in_resolution_t resolution
Definition: bluetooth2.h:139
pin_name_t aio
Definition: bluetooth2.h:134
bool uart_blocking
Definition: bluetooth2.h:143
uint32_t baud_rate
Definition: bluetooth2.h:142
uart_parity_t parity_bit
Definition: bluetooth2.h:145
@ BLUETOOTH2_OK
Definition: bluetooth2.h:156
err_t bluetooth2_list_pairings(bluetooth2_t *ctx)
Bluetooth2 list current pairings function.
uart_stop_bits_t stop_bit
Definition: bluetooth2.h:146
Bluetooth2 Click context object.
Definition: bluetooth2.h:111
digital_out_t cts
Definition: bluetooth2.h:114
pin_name_t rx_pin
Definition: bluetooth2.h:131
char uart_tx_buffer[DRV_BUFFER_SIZE]
Definition: bluetooth2.h:121
err_t bluetooth2_read_an_pin_voltage(bluetooth2_t *ctx, float *data_out)
Bluetooth2 read AN pin voltage level function.
#define DRV_BUFFER_SIZE
Bluetooth2 driver buffer size.
Definition: bluetooth2.h:77
pin_name_t cts
Definition: bluetooth2.h:133
err_t bluetooth2_init(bluetooth2_t *ctx, bluetooth2_cfg_t *cfg)
Bluetooth2 initialization function.
err_t bluetooth2_sw_reset(bluetooth2_t *ctx)
Bluetooth2 sw reset function.
uint8_t bluetooth2_get_rts_pin(bluetooth2_t *ctx)
Bluetooth2 get request to send pin function.
pin_name_t rts
Definition: bluetooth2.h:137
err_t bluetooth2_factory_reset(bluetooth2_t *ctx)
Bluetooth2 factory reset function.
pin_name_t tx_pin
Definition: bluetooth2.h:132
void bluetooth2_cfg_setup(bluetooth2_cfg_t *cfg)
Bluetooth2 configuration object setup function.
uart_data_bits_t data_bit
Definition: bluetooth2.h:144
void bluetooth2_set_cts_pin(bluetooth2_t *ctx, uint8_t state)
Bluetooth2 set clear to send pin function.
err_t bluetooth2_remove_pairings(bluetooth2_t *ctx)
Bluetooth2 remove pairings function.
void bluetooth2_set_io7_pin(bluetooth2_t *ctx, uint8_t state)
Bluetooth2 set PIO7 pin function.
err_t bluetooth2_find_other_devices(bluetooth2_t *ctx, uint8_t timeout)
Bluetooth2 find other devices function.
analog_in_t adc
Definition: bluetooth2.h:118
void bluetooth2_hw_reset(bluetooth2_t *ctx)
Bluetooth2 hw reset function.
char uart_rx_buffer[DRV_BUFFER_SIZE]
Definition: bluetooth2.h:120
pin_name_t io7
Definition: bluetooth2.h:136
struct bluetooth2_s bluetooth2_t
Bluetooth2 Click context object.
@ BLUETOOTH2_ERROR
Definition: bluetooth2.h:157
digital_out_t io7
Definition: bluetooth2.h:113
pin_name_t rst
Definition: bluetooth2.h:135
Bluetooth2 Click configuration object.
Definition: bluetooth2.h:130
bluetooth2_return_value_t
Bluetooth2 Click return value data.
Definition: bluetooth2.h:155
err_t bluetooth2_toggle_mode(bluetooth2_t *ctx)
Bluetooth2 toggle mode function.
digital_in_t rts
Definition: bluetooth2.h:115
float vref
Definition: bluetooth2.h:140
err_t bluetooth2_read_an_pin_value(bluetooth2_t *ctx, uint16_t *data_out)
Bluetooth2 read AN pin value function.
err_t bluetooth2_pair(bluetooth2_t *ctx, uint8_t *dev_addr)
Bluetooth2 set local device name function.
err_t bluetooth2_set_device_name(bluetooth2_t *ctx, char *dev_name)
Bluetooth2 set local device name function.
void bluetooth2_default_cfg(bluetooth2_t *ctx)
Bluetooth2 default configuration function.
void bluetooth2_set_rst_pin(bluetooth2_t *ctx, uint8_t state)
Bluetooth2 set reset pin function.
err_t bluetooth2_generic_read(bluetooth2_t *ctx, char *data_buf, uint16_t max_len)
Bluetooth2 data reading function.
digital_out_t rst
Definition: bluetooth2.h:112
err_t bluetooth2_generic_write(bluetooth2_t *ctx, char *data_buf, uint16_t len)
Bluetooth2 data writing function.