bt 2.0.0.0
|
API for configuring and manipulating BT Click driver. More...
Topics | |
BT Device Settings | |
Settings for BT Click driver. | |
BT MikroBUS Map | |
MikroBUS pin mapping of BT Click driver. | |
Functions | |
void | bt_cfg_setup (bt_cfg_t *cfg) |
BT configuration object setup function. | |
err_t | bt_init (bt_t *ctx, bt_cfg_t *cfg) |
BT initialization function. | |
err_t | bt_default_cfg (bt_t *ctx) |
BT default configuration function. | |
err_t | bt_generic_write (bt_t *ctx, char *data_buf, uint16_t len) |
BT data writing function. | |
err_t | bt_generic_read (bt_t *ctx, char *data_buf, uint16_t max_len) |
BT data reading function. | |
void | bt_set_an_pin (bt_t *ctx, uint8_t state) |
BT set AN pin function. | |
void | bt_set_rst_pin (bt_t *ctx, uint8_t state) |
BT set RST pin function. | |
void | bt_set_cts_pin (bt_t *ctx, uint8_t state) |
BT set CTS pin function. | |
void | bt_set_bt0_pin (bt_t *ctx, uint8_t state) |
BT set BT0 pin function. | |
uint8_t | bt_get_rts_pin (bt_t *ctx) |
BT get RTS pin function. | |
err_t | bt_send_package (bt_t *ctx, bt_package_t pkg) |
BT send package function. | |
err_t | bt_read_package (bt_t *ctx, bt_package_t *pkg) |
BT read package function. | |
err_t | bt_set_local_name (bt_t *ctx, char *name) |
BT set local name function. | |
err_t | bt_set_bondable_mode (bt_t *ctx, uint8_t mode) |
BT set bondable mode function. | |
err_t | bt_delete_bondings (bt_t *ctx) |
BT delete bondings function. | |
err_t | bt_set_class_of_device (bt_t *ctx, uint32_t cod) |
BT set class of device function. | |
err_t | bt_set_gap_mode (bt_t *ctx, uint8_t connectable, uint8_t discoverable, uint8_t limited) |
BT set gap mode function. | |
err_t | bt_rfcomm_start_server (bt_t *ctx, uint8_t sdp_id, uint8_t stream_dest) |
BT rfcomm start server function. | |
err_t | bt_rfcomm_stop_server (bt_t *ctx, uint8_t sdp_id) |
BT rfcomm stop server function. | |
err_t | bt_factory_reset (bt_t *ctx) |
BT factory reset function. | |
err_t | bt_system_reset (bt_t *ctx, uint8_t mode) |
BT system reset function. | |
err_t | bt_hardware_config_gpio (bt_t *ctx, uint8_t port, uint16_t pin_index, uint8_t mode, uint8_t pullup) |
BT hardware config gpio function. | |
err_t | bt_hardware_read_gpio (bt_t *ctx, uint8_t port, uint16_t mask, uint16_t *port_data) |
BT hardware read gpio function. | |
err_t | bt_hardware_write_gpio (bt_t *ctx, uint8_t port, uint16_t mask, uint16_t port_data) |
BT hardware write gpio function. | |
err_t | bt_endpoint_send_data (bt_t *ctx, uint8_t *endpoint, char *msg) |
BT endpoint send data function. | |
API for configuring and manipulating BT Click driver.
Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.
void bt_cfg_setup | ( | bt_cfg_t * | cfg | ) |
BT configuration object setup function.
This function initializes click configuration structure to initial values.
[out] | cfg | : Click configuration structure. See bt_cfg_t object definition for detailed explanation. |
err_t bt_default_cfg | ( | bt_t * | ctx | ) |
BT default configuration function.
This function executes a default configuration of BT click board.
[in] | ctx | : Click context object. See bt_t object definition for detailed explanation. |
0
- Success, -1
- Error.err_t bt_delete_bondings | ( | bt_t * | ctx | ) |
BT delete bondings function.
This function deletes all bondings.
[in] | ctx | : Click context object. See bt_t object definition for detailed explanation. |
0
- Success, -1
- Error.err_t bt_endpoint_send_data | ( | bt_t * | ctx, |
uint8_t * | endpoint, | ||
char * | msg ) |
BT endpoint send data function.
This function sends data to the defined endpoint.
[in] | ctx | : Click context object. See bt_t object definition for detailed explanation. |
[in,out] | endpoint | : The pointer to index of the endpoint to which the data will be sent. It will be overwritten by the endpoint index value of the response to this command. |
[in] | msg | : Data to be sent. |
0
- Success, -1
- Error.err_t bt_factory_reset | ( | bt_t * | ctx | ) |
BT factory reset function.
This function resets the device to factory settings.
[in] | ctx | : Click context object. See bt_t object definition for detailed explanation. |
0
- Success, -1
- Error.err_t bt_generic_read | ( | bt_t * | ctx, |
char * | data_buf, | ||
uint16_t | max_len ) |
BT data reading function.
This function reads a desired number of data bytes by using UART serial interface.
[in] | ctx | : Click context object. See bt_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 bt_generic_write | ( | bt_t * | ctx, |
char * | data_buf, | ||
uint16_t | len ) |
BT data writing function.
This function writes a desired number of data bytes by using UART serial interface.
[in] | ctx | : Click context object. See bt_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 bt_get_rts_pin | ( | bt_t * | ctx | ) |
BT get RTS pin function.
This function returns the RTS pin logic state.
[in] | ctx | : Click context object. See bt_t object definition for detailed explanation. |
err_t bt_hardware_config_gpio | ( | bt_t * | ctx, |
uint8_t | port, | ||
uint16_t | pin_index, | ||
uint8_t | mode, | ||
uint8_t | pullup ) |
BT hardware config gpio function.
This function configures the GPIO pins.
[in] | ctx | : Click context object. See bt_t object definition for detailed explanation. |
[in] | port | :
|
[in] | pin_index | : The index of the GPIO pin on the port which this function affects. |
[in] | mode | :
|
[in] | pullup | :
|
0
- Success, -1
- Error.err_t bt_hardware_read_gpio | ( | bt_t * | ctx, |
uint8_t | port, | ||
uint16_t | mask, | ||
uint16_t * | port_data ) |
BT hardware read gpio function.
This function reads the state of a desired GPIO pins.
[in] | ctx | : Click context object. See bt_t object definition for detailed explanation. |
[in] | port | :
|
[in] | mask | : Bitmask of which pins on the port should be read. |
[in] | port_data | : Port data read. |
0
- Success, -1
- Error.err_t bt_hardware_write_gpio | ( | bt_t * | ctx, |
uint8_t | port, | ||
uint16_t | mask, | ||
uint16_t | port_data ) |
BT hardware write gpio function.
This function sets the state of a desired GPIO pins.
[in] | ctx | : Click context object. See bt_t object definition for detailed explanation. |
[in] | port | :
|
[in] | mask | : Bitmask which determines the pins this function is used to set. |
[in] | port_data | : Bitmask of which pins to set high and which pins to set low (1 - high, 0 - low). |
0
- Success, -1
- Error.BT initialization function.
This function initializes all necessary pins and peripherals used for this click board.
[out] | ctx | : Click context object. See bt_t object definition for detailed explanation. |
[in] | cfg | : Click configuration structure. See bt_cfg_t object definition for detailed explanation. |
0
- Success, -1
- Error.err_t bt_read_package | ( | bt_t * | ctx, |
bt_package_t * | pkg ) |
BT read package function.
This function waits for the command or event type of message to arrive and then reads the complete message and stores it to pkg structure.
[in] | ctx | : Click context object. See bt_t object definition for detailed explanation. |
[out] | pkg | : Pointer to structure where the read data is being stored. See bt_package_t object definition for detailed explanation. |
0
- Success, -1
- Error.err_t bt_rfcomm_start_server | ( | bt_t * | ctx, |
uint8_t | sdp_id, | ||
uint8_t | stream_dest ) |
BT rfcomm start server function.
This function starts the RFCOMM server as defined in the SDP-entry.
[in] | ctx | : Click context object. See bt_t object definition for detailed explanation. |
[in] | sdp_id | : ID of the SDP entry [ Default: 0x02 ]. |
[in] | stream_dest | : Streaming destination [ Default: 0x00 ]. |
0
- Success, -1
- Error.err_t bt_rfcomm_stop_server | ( | bt_t * | ctx, |
uint8_t | sdp_id ) |
BT rfcomm stop server function.
This function stops the RFCOMM server.
[in] | ctx | : Click context object. See bt_t object definition for detailed explanation. |
[in] | sdp_id | : ID of the SDP entry [ Default: 0x02 ]. |
0
- Success, -1
- Error.err_t bt_send_package | ( | bt_t * | ctx, |
bt_package_t | pkg ) |
BT send package function.
This function sends a data package to the click board.
[in] | ctx | : Click context object. See bt_t object definition for detailed explanation. |
[in] | pkg | : Data package to be written. See bt_package_t object definition for detailed explanation. |
>=0
- Success, <0
- Error.void bt_set_an_pin | ( | bt_t * | ctx, |
uint8_t | state ) |
BT set AN pin function.
This function sets the AN pin logic state.
[in] | ctx | : Click context object. See bt_t object definition for detailed explanation. |
[in] | state | : Pin logic state. |
err_t bt_set_bondable_mode | ( | bt_t * | ctx, |
uint8_t | mode ) |
BT set bondable mode function.
This function sets the bondable mode of the device.
[in] | ctx | : Click context object. See bt_t object definition for detailed explanation. |
[in] | mode | :
|
0
- Success, -1
- Error.void bt_set_bt0_pin | ( | bt_t * | ctx, |
uint8_t | state ) |
BT set BT0 pin function.
This function sets the BT0 pin logic state.
[in] | ctx | : Click context object. See bt_t object definition for detailed explanation. |
[in] | state | : Pin logic state. |
err_t bt_set_class_of_device | ( | bt_t * | ctx, |
uint32_t | cod ) |
BT set class of device function.
This function sets the class of the device.
[in] | ctx | : Click context object. See bt_t object definition for detailed explanation. |
[in] | cod | : Class of the device. |
0
- Success, -1
- Error.void bt_set_cts_pin | ( | bt_t * | ctx, |
uint8_t | state ) |
BT set CTS pin function.
This function sets the CTS pin logic state.
[in] | ctx | : Click context object. See bt_t object definition for detailed explanation. |
[in] | state | : Pin logic state. |
err_t bt_set_gap_mode | ( | bt_t * | ctx, |
uint8_t | connectable, | ||
uint8_t | discoverable, | ||
uint8_t | limited ) |
BT set gap mode function.
This function sets the GAP mode.
[in] | ctx | : Click context object. See bt_t object definition for detailed explanation. |
[in] | connectable | :
|
[in] | discoverable | :
|
[in] | limited | :
|
0
- Success, -1
- Error.err_t bt_set_local_name | ( | bt_t * | ctx, |
char * | name ) |
BT set local name function.
This function sets the local name of the device.
[in] | ctx | : Click context object. See bt_t object definition for detailed explanation. |
[in] | name | : Local device name ( up to 30 characters ). |
0
- Success, -1
- Error.void bt_set_rst_pin | ( | bt_t * | ctx, |
uint8_t | state ) |
BT set RST pin function.
This function sets the RST pin logic state.
[in] | ctx | : Click context object. See bt_t object definition for detailed explanation. |
[in] | state | : Pin logic state. |
err_t bt_system_reset | ( | bt_t * | ctx, |
uint8_t | mode ) |
BT system reset function.
This function resets the device.
[in] | ctx | : Click context object. See bt_t object definition for detailed explanation. |
[in] | mode | :
|
0
- Success, -1
- Error.