bluetooth2 2.0.0.0
|
API for configuring and manipulating Bluetooth2 Click driver. More...
Topics | |
Bluetooth2 Registers Settings | |
Settings for registers of Bluetooth2 Click driver. | |
Bluetooth2 MikroBUS Map | |
MikroBUS pin mapping of Bluetooth2 Click driver. | |
Functions | |
void | bluetooth2_cfg_setup (bluetooth2_cfg_t *cfg) |
Bluetooth2 configuration object setup function. | |
err_t | bluetooth2_init (bluetooth2_t *ctx, bluetooth2_cfg_t *cfg) |
Bluetooth2 initialization function. | |
void | bluetooth2_default_cfg (bluetooth2_t *ctx) |
Bluetooth2 default configuration function. | |
err_t | bluetooth2_generic_write (bluetooth2_t *ctx, char *data_buf, uint16_t len) |
Bluetooth2 data writing function. | |
err_t | bluetooth2_generic_read (bluetooth2_t *ctx, char *data_buf, uint16_t max_len) |
Bluetooth2 data reading function. | |
err_t | bluetooth2_read_an_pin_value (bluetooth2_t *ctx, uint16_t *data_out) |
Bluetooth2 read AN pin value function. | |
err_t | bluetooth2_read_an_pin_voltage (bluetooth2_t *ctx, float *data_out) |
Bluetooth2 read AN pin voltage level function. | |
void | bluetooth2_set_cts_pin (bluetooth2_t *ctx, uint8_t state) |
Bluetooth2 set clear to send pin function. | |
void | bluetooth2_set_rst_pin (bluetooth2_t *ctx, uint8_t state) |
Bluetooth2 set reset pin function. | |
void | bluetooth2_set_io7_pin (bluetooth2_t *ctx, uint8_t state) |
Bluetooth2 set PIO7 pin function. | |
uint8_t | bluetooth2_get_rts_pin (bluetooth2_t *ctx) |
Bluetooth2 get request to send pin function. | |
err_t | bluetooth2_write_command (bluetooth2_t *ctx, char *data_buf) |
Bluetooth2 write command function. | |
void | bluetooth2_hw_reset (bluetooth2_t *ctx) |
Bluetooth2 hw reset function. | |
err_t | bluetooth2_toggle_mode (bluetooth2_t *ctx) |
Bluetooth2 toggle mode function. | |
err_t | bluetooth2_factory_reset (bluetooth2_t *ctx) |
Bluetooth2 factory reset function. | |
err_t | bluetooth2_sw_reset (bluetooth2_t *ctx) |
Bluetooth2 sw reset function. | |
err_t | bluetooth2_remove_pairings (bluetooth2_t *ctx) |
Bluetooth2 remove pairings function. | |
err_t | bluetooth2_list_pairings (bluetooth2_t *ctx) |
Bluetooth2 list current pairings function. | |
err_t | bluetooth2_set_device_name (bluetooth2_t *ctx, char *dev_name) |
Bluetooth2 set local device name function. | |
err_t | bluetooth2_find_other_devices (bluetooth2_t *ctx, uint8_t timeout) |
Bluetooth2 find other devices function. | |
err_t | bluetooth2_pair (bluetooth2_t *ctx, uint8_t *dev_addr) |
Bluetooth2 set local device name function. | |
err_t | bluetooth2_enable_ok_response (bluetooth2_t *ctx) |
Bluetooth2 enable OK response function. | |
API for configuring and manipulating Bluetooth2 Click driver.
Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.
void bluetooth2_cfg_setup | ( | bluetooth2_cfg_t * | cfg | ) |
Bluetooth2 configuration object setup function.
This function initializes click configuration structure to initial values.
[out] | cfg | : Click configuration structure. See bluetooth2_cfg_t object definition for detailed explanation. |
void bluetooth2_default_cfg | ( | bluetooth2_t * | ctx | ) |
Bluetooth2 default configuration function.
This function executes a default configuration of Bluetooth2 click board.
[in] | ctx | : Click context object. See bluetooth2_t object definition for detailed explanation. |
err_t bluetooth2_enable_ok_response | ( | bluetooth2_t * | ctx | ) |
Bluetooth2 enable OK response function.
This function enables OK response. The module will display "OK." after each successful command.
[in] | ctx | : Click context object. See bluetooth2_t object definition for detailed explanation. |
>=0
- Success, <0
- Error.err_t bluetooth2_factory_reset | ( | bluetooth2_t * | ctx | ) |
Bluetooth2 factory reset function.
This function factory resets the device.
[in] | ctx | : Click context object. See bluetooth2_t object definition for detailed explanation. |
>=0
- Success, <0
- Error.err_t bluetooth2_find_other_devices | ( | bluetooth2_t * | ctx, |
uint8_t | timeout ) |
Bluetooth2 find other devices function.
This function is used to find other Bluetooth devices in the area i.e. to make a device discovery.
[in] | ctx | : Click context object. See bluetooth2_t object definition for detailed explanation. |
[in] | timeout | : The maximum amount of time (in units of 1.28 seconds) before the inquiry process is halted. Range: 1-48. |
>=0
- Success, <0
- Error.err_t bluetooth2_generic_read | ( | bluetooth2_t * | ctx, |
char * | data_buf, | ||
uint16_t | max_len ) |
Bluetooth2 data reading function.
This function reads a desired number of data bytes by using UART serial interface.
[in] | ctx | : Click context object. See bluetooth2_t object definition for detailed explanation. |
[out] | data_buf | : Output read data. |
[in] | max_len | : Number of bytes to be read. |
>0
- Number of data bytes read, <=0
- Error/Empty Ring buffer.err_t bluetooth2_generic_write | ( | bluetooth2_t * | ctx, |
char * | data_buf, | ||
uint16_t | len ) |
Bluetooth2 data writing function.
This function writes a desired number of data bytes by using UART serial interface.
[in] | ctx | : Click context object. See bluetooth2_t object definition for detailed explanation. |
[in] | data_buf | : Data buffer for sending. |
[in] | len | : Number of bytes for sending. |
>=0
- Success, <0
- Error.uint8_t bluetooth2_get_rts_pin | ( | bluetooth2_t * | ctx | ) |
Bluetooth2 get request to send pin function.
This function returns the RTS pin logic state.
[in] | ctx | : Click context object. See bluetooth2_t object definition for detailed explanation. |
void bluetooth2_hw_reset | ( | bluetooth2_t * | ctx | ) |
Bluetooth2 hw reset function.
This function resets the module by toggling the RST pin.
[in] | ctx | : Click context object. See bluetooth2_t object definition for detailed explanation. |
err_t bluetooth2_init | ( | bluetooth2_t * | ctx, |
bluetooth2_cfg_t * | cfg ) |
Bluetooth2 initialization function.
This function initializes all necessary pins and peripherals used for this click board.
[out] | ctx | : Click context object. See bluetooth2_t object definition for detailed explanation. |
[in] | cfg | : Click configuration structure. See bluetooth2_cfg_t object definition for detailed explanation. |
0
- Success, -1
- Error.err_t bluetooth2_list_pairings | ( | bluetooth2_t * | ctx | ) |
Bluetooth2 list current pairings function.
This function lists all current pairings.
[in] | ctx | : Click context object. See bluetooth2_t object definition for detailed explanation. |
>=0
- Success, <0
- Error.err_t bluetooth2_pair | ( | bluetooth2_t * | ctx, |
uint8_t * | dev_addr ) |
Bluetooth2 set local device name function.
This function sets the local device name.
[in] | ctx | : Click context object. See bluetooth2_t object definition for detailed explanation. |
[in] | dev_addr | : Bluetooth device address of the remote device in format xx:xx:xx:xx:xx:xx where x is a hexadecimal digit. |
>=0
- Success, <0
- Error.err_t bluetooth2_read_an_pin_value | ( | bluetooth2_t * | ctx, |
uint16_t * | data_out ) |
Bluetooth2 read AN pin value function.
This function reads results of AD conversion of the AN pin.
[in] | ctx | : Click context object. See bluetooth2_t object definition for detailed explanation. |
[out] | data_out | : Output ADC result. |
0
- Success, -1
- Error.err_t bluetooth2_read_an_pin_voltage | ( | bluetooth2_t * | ctx, |
float * | data_out ) |
Bluetooth2 read AN pin voltage level function.
This function reads results of AD conversion of the AN pin and converts them to proportional voltage level.
[in] | ctx | : Click context object. See bluetooth2_t object definition for detailed explanation. |
[out] | data_out | : Output voltage level of the analog pin [V]. |
0
- Success, -1
- Error.err_t bluetooth2_remove_pairings | ( | bluetooth2_t * | ctx | ) |
Bluetooth2 remove pairings function.
This function removes all the device pairings.
[in] | ctx | : Click context object. See bluetooth2_t object definition for detailed explanation. |
>=0
- Success, <0
- Error.void bluetooth2_set_cts_pin | ( | bluetooth2_t * | ctx, |
uint8_t | state ) |
Bluetooth2 set clear to send pin function.
This function sets the CTS pin to a desired state.
[in] | ctx | : Click context object. See bluetooth2_t object definition for detailed explanation. |
[in] | state | : Pin logic state. |
err_t bluetooth2_set_device_name | ( | bluetooth2_t * | ctx, |
char * | dev_name ) |
Bluetooth2 set local device name function.
This function sets the local device name.
[in] | ctx | : Click context object. See bluetooth2_t object definition for detailed explanation. |
[in] | dev_name | : Device name ( up to 140 characters ). |
>=0
- Success, <0
- Error.void bluetooth2_set_io7_pin | ( | bluetooth2_t * | ctx, |
uint8_t | state ) |
Bluetooth2 set PIO7 pin function.
This function sets the PIO7 pin to a desired state.
[in] | ctx | : Click context object. See bluetooth2_t object definition for detailed explanation. |
[in] | state | : Pin logic state. |
void bluetooth2_set_rst_pin | ( | bluetooth2_t * | ctx, |
uint8_t | state ) |
Bluetooth2 set reset pin function.
This function sets the RST pin to a desired state.
[in] | ctx | : Click context object. See bluetooth2_t object definition for detailed explanation. |
[in] | state | : Pin logic state. |
err_t bluetooth2_sw_reset | ( | bluetooth2_t * | ctx | ) |
Bluetooth2 sw reset function.
This function sw resets the device.
[in] | ctx | : Click context object. See bluetooth2_t object definition for detailed explanation. |
>=0
- Success, <0
- Error.err_t bluetooth2_toggle_mode | ( | bluetooth2_t * | ctx | ) |
Bluetooth2 toggle mode function.
This function is used to toggle between command mode and data mode by issuing the escape sequence.
[in] | ctx | : Click context object. See bluetooth2_t object definition for detailed explanation. |
>=0
- Success, <0
- Error.err_t bluetooth2_write_command | ( | bluetooth2_t * | ctx, |
char * | data_buf ) |
Bluetooth2 write command function.
This function sends a desired command with the CR byte appended to.
[in] | ctx | : Click context object. See bluetooth2_t object definition for detailed explanation. |
[in] | data_buf | : Command string. |
>=0
- Success, <0
- Error.