bt 2.0.0.0
bt.h File Reference

This file contains API for BT Click Driver. More...

#include "drv_digital_out.h"
#include "drv_digital_in.h"
#include "drv_uart.h"

Go to the source code of this file.

Data Structures

struct  bt_t
 BT Click context object. More...
 
struct  bt_cfg_t
 BT Click configuration object. More...
 
struct  bt_package_t
 BT Click packet structure object. More...
 

Macros

#define BT_MSG_TYPE_COMMAND   0x20
 BT message type setting.
 
#define BT_MSG_TYPE_RESPONSE   0x20
 
#define BT_MSG_TYPE_EVENT   0xA0
 
#define BT_MSG_CLASS_DFU   0x00
 BT message class setting.
 
#define BT_MSG_CLASS_SYSTEM   0x01
 
#define BT_MSG_CLASS_GAP   0x02
 
#define BT_MSG_CLASS_LE_GAP   0x03
 
#define BT_MSG_CLASS_RFCOMM   0x04
 
#define BT_MSG_CLASS_IDENTITY   0x05
 
#define BT_MSG_CLASS_SDP   0x06
 
#define BT_MSG_CLASS_CONNECTION   0x07
 
#define BT_MSG_CLASS_LE_CONNECTION   0x08
 
#define BT_MSG_CLASS_GATT   0x09
 
#define BT_MSG_CLASS_GATT_SERVER   0x0A
 
#define BT_MSG_CLASS_ENDPOINT   0x0B
 
#define BT_MSG_CLASS_HARDWARE   0x0C
 
#define BT_MSG_CLASS_FLASH_PS   0x0D
 
#define BT_MSG_CLASS_TEST   0x0E
 
#define BT_MSG_CLASS_SM   0x0F
 
#define BT_MSG_CLASS_UTIL   0x11
 
#define BT_MSG_CLASS_HID   0x13
 
#define BT_MSG_CLASS_LE_SERIAL   0x14
 
#define BT_MSG_ID_SYSTEM_RESET   0x01
 BT message ID setting.
 
#define BT_MSG_ID_SYSTEM_GET_BT_ADDRESS   0x03
 
#define BT_MSG_ID_SYSTEM_GET_CLASS_OF_DEV   0x05
 
#define BT_MSG_ID_SYSTEM_SET_CLASS_OF_DEV   0x06
 
#define BT_MSG_ID_SYSTEM_FACTORY_RESET   0x07
 
#define BT_MSG_ID_SYSTEM_SET_LOCAL_NAME   0x08
 
#define BT_MSG_ID_SYSTEM_GET_LOCAL_NAME   0x09
 
#define BT_MSG_ID_SM_SET_BONDABLE_MODE   0x00
 
#define BT_MSG_ID_SM_DELETE_BONDINGS   0x07
 
#define BT_MSG_ID_GAP_SET_MODE   0x03
 
#define BT_MSG_ID_HARDWARE_CONFIG_GPIO   0x01
 
#define BT_MSG_ID_HARDWARE_WRITE_GPIO   0x02
 
#define BT_MSG_ID_HARDWARE_READ_GPIO   0x03
 
#define BT_MSG_ID_ENDPOINT_SEND_DATA   0x00
 
#define BT_MSG_ID_RFCOMM_START_SERVER   0x01
 
#define BT_MSG_ID_RFCOMM_STOP_SERVER   0x03
 
#define BT_MSG_ID_EVT_ENDPOINT_DATA   0x01
 
#define BT_MSG_ID_EVT_CONNECTION_OPENED   0x00
 
#define BT_MSG_ID_EVT_CONNECTION_CLOSED   0x01
 
#define BT_MSG_ID_EVT_SM_BONDED   0x03
 
#define BT_MSG_ID_EVT_RFCOMM_OPENED   0x00
 
#define BT_MSG_ID_EVT_RFCOMM_MODEM_STATUS   0x01
 
#define BT_SYSTEM_RESET_NORMAL   0x00
 BT reset mode setting.
 
#define BT_SYSTEM_RESET_BOOT_TO_DFU   0x01
 
#define BT_SM_SET_BONDABLE_NOT_ACCEPTED   0x00
 BT bondable mode setting.
 
#define BT_SM_SET_BONDABLE_ALLOWED   0x01
 
#define BT_GAP_MODE_NOT_CONNECTABLE   0x00
 BT gap mode setting.
 
#define BT_GAP_MODE_CONNECTABLE   0x01
 
#define BT_GAP_MODE_NOT_DISCOVERABLE   0x00
 
#define BT_GAP_MODE_DISCOVERABLE   0x01
 
#define BT_GAP_MODE_NOT_LIMITED   0x00
 
#define BT_GAP_MODE_LIMITED   0x01
 
#define BT_RFCOMM_SERVER_DEF_SDP_ID   0x02
 BT rfcomm server setting.
 
#define BT_RFCOMM_SERVER_DEF_STREAM_DEST   0x00
 
#define BT_HARDWARE_CONFIG_PORT_A   0x00
 BT hardware config gpio setting.
 
#define BT_HARDWARE_CONFIG_PORT_B   0x01
 
#define BT_HARDWARE_CONFIG_GPIO_FLOAT   0x00
 
#define BT_HARDWARE_CONFIG_GPIO_PULLUP   0x01
 
#define BT_HARDWARE_CONFIG_GPIO_PULLDOWN   0x02
 
#define BT_HARDWARE_CONFIG_GPIO_INPUT   0x00
 
#define BT_HARDWARE_CONFIG_GPIO_OUTPUT   0x01
 
#define BT_HARDWARE_CONFIG_GPIO_FUNCTION   0x02
 
#define BT_HARDWARE_CONFIG_GPIO_ANALOG   0x03
 
#define BT_HARDWARE_BUTTON1_PIN_INDEX   0x08
 
#define BT_HARDWARE_BUTTON2_PIN_INDEX   0x09
 
#define BT_HARDWARE_BUTTON3_PIN_INDEX   0x0A
 
#define BT_HARDWARE_BUTTON4_PIN_INDEX   0x0C
 
#define BT_HARDWARE_BUTTON5_PIN_INDEX   0x0D
 
#define BT_HARDWARE_LED1_PIN_INDEX   0x0E
 
#define BT_HARDWARE_LED2_PIN_INDEX   0x0F
 
#define BT_HARDWARE_BUTTON1_PIN_MASK   0x0100
 
#define BT_HARDWARE_BUTTON2_PIN_MASK   0x0200
 
#define BT_HARDWARE_BUTTON3_PIN_MASK   0x0400
 
#define BT_HARDWARE_BUTTON4_PIN_MASK   0x1000
 
#define BT_HARDWARE_BUTTON5_PIN_MASK   0x2000
 
#define BT_HARDWARE_ALL_BUTTONS_PIN_MASK   0x3700
 
#define BT_HARDWARE_LED1_PIN_MASK   0x4000
 
#define BT_HARDWARE_LED2_PIN_MASK   0x8000
 
#define BT_HARDWARE_ALL_LEDS_PIN_MASK   0xC000
 
#define BT_MAX_PAYLOAD_LEN   0x40
 BT payload setting.
 
#define DRV_BUFFER_SIZE   200
 BT driver buffer size.
 
#define BT_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Enumerations

enum  bt_return_value_t { BT_OK = 0 , BT_ERROR = -1 }
 BT Click return value data. More...
 

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.
 

Detailed Description

This file contains API for BT Click Driver.

Enumeration Type Documentation

◆ bt_return_value_t

BT Click return value data.

Predefined enum values for driver return values.

Enumerator
BT_OK 
BT_ERROR