bletx 2.0.0.0
bletx.h File Reference

This file contains API for BLE TX Click Driver. More...

#include "drv_digital_out.h"
#include "drv_digital_in.h"
#include "drv_i2c_master.h"

Go to the source code of this file.

Data Structures

struct  bletx_t
 BLE TX Click context object. More...
 
struct  bletx_cfg_t
 BLE TX Click configuration object. More...
 
struct  bletx_adv_cfg_t
 BLE TX Click advertising settings object. More...
 
struct  bletx_create_adv_data_packet_t
 BLE TX Click advertising data packet. More...
 
struct  bletx_eddystone_data_t
 BLE TX Click Eddystone™ data packet. More...
 

Macros

#define BLETX_SEL_INTERFACE_I2C   0
 BLE TX interface selection description register.
 
#define BLETX_SEL_INTERFACE_UART   1
 
#define BLETX_SEL_BAUD_RATE_9600   9600
 BLE TX UART baud rate description register.
 
#define BLETX_SEL_BAUD_RATE_115200   115200
 
#define BLETX_REG_SETTING_1   0x01
 BLE TX description register.
 
#define BLETX_REG_SETTING_2   0x02
 
#define BLETX_REG_SETTING_3   0x03
 
#define BLETX_REG_SETTING_4   0x04
 
#define BLETX_REG_SETTING_5   0x05
 
#define BLETX_REG_SETTING_6   0x06
 
#define BLETX_REG_PREAMBLE   0x07
 
#define BLETX_REG_ACCESS_ADDRESS_0   0x08
 
#define BLETX_REG_ACCESS_ADDRESS_1   0x09
 
#define BLETX_REG_ACCESS_ADDRESS_2   0x0A
 
#define BLETX_REG_ACCESS_ADDRESS_3   0x0B
 
#define BLETX_REG_PDU_HEADER_0   0x0C
 
#define BLETX_REG_PDU_HEADER_1   0x0D
 
#define BLETX_REG_PDU_ADV_ADDR_0   0x0E
 
#define BLETX_REG_PDU_ADV_ADDR_1   0x0F
 
#define BLETX_REG_PDU_ADV_ADDR_2   0x10
 
#define BLETX_REG_PDU_ADV_ADDR_3   0x11
 
#define BLETX_REG_PDU_ADV_ADDR_4   0x12
 
#define BLETX_REG_PDU_ADV_ADDR_5   0x13
 
#define BLETX_REG_PDU_ADV_DATA_START   0x14
 
#define BLETX_REG_PDU_ADV_EDDYSTONE_DATA   0x17
 
#define BLETX_REG_PDU_ADV_EDDYSTONE_UID   0x2F
 
#define BLETX_REG_CRC_0   0x33
 
#define BLETX_REG_CRC_1   0x34
 
#define BLETX_REG_CRC_2   0x35
 
#define BLETX_REG_MODE   0x36
 
#define BLETX_REG_SOFT_RESET   0x3F
 
#define BLETX_AD_TYPE_FLAGS   0x01
 BLE TX AD type name description setting.
 
#define BLETX_AD_TYPE_FLAGS_CLASS_UUID_16   0x02
 
#define BLETX_AD_TYPE_FLAGS_COMPLETE_UUID_16   0x03
 
#define BLETX_AD_TYPE_FLAGS_SHORT_LOCAL_NAME   0x08
 
#define BLETX_AD_TYPE_FLAGS_COMPLETE_LOCAL_NAME   0x09
 
#define BLETX_AD_TYPE_FLAGS_TX_POWER_LEVEL   0x0A
 
#define BLETX_AD_TYPE_FLAGS_CLASS_OF_DEVICE   0x0D
 
#define BLETX_AD_TYPE_FLAGS_SIMPLE_PAIR_HASH_C   0x0E
 
#define BLETX_AD_TYPE_FLAGS_DEVICE_ID   0x10
 
#define BLETX_AD_TYPE_FLAGS_SERVICE_DATA_UUID_16   0x16
 
#define BLETX_AD_TYPE_FLAGS_PUBLIC_TARGET_ADDR   0x17
 
#define BLETX_AD_TYPE_FLAGS_RANDOM_TARGET_ADDR   0x18
 
#define BLETX_AD_TYPE_FLAGS_APPEARANCE   0x19
 
#define BLETX_AD_TYPE_FLAGS_ADVERTISING_INTERVAL   0x1A
 
#define BLETX_AD_TYPE_FLAGS_BLE_DEVICE_ADDR   0x1B
 
#define BLETX_AD_TYPE_FLAGS_RANDOM_LE_ROLE   0x1C
 
#define BLETX_AD_TYPE_FLAGS_URI   0x24
 
#define BLETX_AD_TYPE_FLAGS_INDOOR_POSITIONING   0x25
 
#define BLETX_AD_TYPE_FLAGS_TRANSPORT_DISCOVERY   0x26
 
#define BLETX_AD_TYPE_FLAGS_BROADCAST_CODE   0x2D
 
#define BLETX_AD_TYPE_FLAGS_MANUFACTURER_SPEC_DATA   0xFF
 
#define BLETX_SOFT_RESET_CMD   0xAA
 BLE TX software reset description setting.
 
#define BLETX_PREAMBLE   0xAA
 BLE TX preamble description setting.
 
#define BLETX_HEADER_PDU_TYPE_ADV_IND   0x00
 BLE TX PDU type name description setting.
 
#define BLETX_HEADER_PDU_TYPE_ADV_NONCONN_IND   0x02
 
#define BLETX_HEADER_PDU_TYPE_ADV_SCAN_IND   0x06
 
#define BLETX_TX_POWER_LVL_MODE_LOWEST   0x00
 BLE TX TX power level description setting.
 
#define BLETX_TX_POWER_LVL_MODE_LOW   0x01
 
#define BLETX_TX_POWER_LVL_MODE_MEDIUM   0x02
 
#define BLETX_TX_POWER_LVL_MODE_HIGH   0x03
 
#define BLETX_ADV_DELAY_ENABLE   0x80
 BLE TX advertising delay description setting.
 
#define BLETX_ADV_DELAY_DISABLE   0x00
 
#define BLETX_CRC_ENABLE   0x80
 BLE TX CRC description setting.
 
#define BLETX_CRC_DISABLE   0x00
 
#define BLETX_WHITE_ENABLE   0x40
 BLE TX white description setting.
 
#define BLETX_WHITE_DISABLE   0x00
 
#define BLETX_CHARACTER_CODES_DOT_COM   0x07
 BLE TX character codes description setting.
 
#define BLETX_CHARACTER_CODES_DOT_ORG   0x08
 
#define BLETX_CHARACTER_CODES_DOT_EDU   0x09
 
#define BLETX_CHARACTER_CODES_DOT_NET   0x0A
 
#define BLETX_CHARACTER_CODES_DOT_INFO   0x0B
 
#define BLETX_CHARACTER_CODES_DOT_BIZ   0x0C
 
#define BLETX_CHARACTER_CODES_DOT_GOV   0x0D
 
#define BLETX_EDDYSTONE_SPEC_DATA_HTTP_WWW   0x00
 BLE TX Eddystone spec data description setting.
 
#define BLETX_EDDYSTONE_SPEC_DATA_HTTPS_WWW   0x01
 
#define BLETX_EDDYSTONE_SPEC_DATA_HTTP   0x02
 
#define BLETX_EDDYSTONE_SPEC_DATA_HTTPS   0x03
 
#define BLETX_EDDYSTONE_SPEC_DATA_UDI   0x63
 
#define BLETX_EDDYSTONE_SPEC_DATA_TLM   0x63
 
#define BLETX_EDDYSTONE_SERVICE_UUID   0xAAFE
 BLE TX Eddystone service UUID description setting.
 
#define BLETX_EDDYSTONE_SERVICE_DATA_TYPE_VALUE   0x16
 
#define BLETX_EDDYSTONE_FRAME_TYPE_UID   0x00
 BLE TX Eddystone frame type description setting.
 
#define BLETX_EDDYSTONE_FRAME_TYPE_URL   0x10
 
#define BLETX_EDDYSTONE_FRAME_TYPE_TLM   0x20
 
#define BLETX_EDDYSTONE_FRAME_TYPE_EID   0x30
 
#define BLETX_SET_DEV_ADDR   0x28
 BLE TX device address setting.
 
#define BLETX_ACCESS_ADDRESS   0xD6BE898Eul
 BLE TX access address setting.
 
#define BLETX_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Enumerations

enum  bletx_advch_value_t {
  ADVCH1_37_Ch_2402_MHz = 0x00 , ADVCH1_37_Ch_2480_MHz = 0x30 , ADVCH1_38_Ch_2426_MHz = 0x10 , ADVCH1_39_Ch_2480_MHz = 0x20 ,
  ADVCH2_37_Ch_2402_MHz = 0x00 , ADVCH2_38_Ch_2426_MHz = 0x04 , ADVCH2_39_Ch_2480_MHz = 0x08 , ADVCH2_NO_TX_OUTPUT = 0x0C ,
  ADVCH3_37_Ch_2402_MHz = 0x00 , ADVCH3_38_Ch_2426_MHz = 0x01 , ADVCH3_39_Ch_2480_MHz = 0x02 , ADVCH3_NO_TX_OUTPUT = 0x03
}
 BLE TX Click Advertising channel setting. More...
 
enum  bletx_tx_output_power_value_t {
  TX_POWER_0_dBm = 0x00 , TX_POWER_MINUS_3_dBm , TX_POWER_MINUS_6_dBm , TX_POWER_MINUS_9_dBm ,
  TX_POWER_MINUS_12_dBm , TX_POWER_MINUS_15_dBm , TX_POWER_MINUS_20_dBm , TX_POWER_MINUS_32_dBm
}
 BLE TX Click TX output power setting. More...
 
enum  bletx_txdata_value_t { BURST_TRANSMISSION = 0x00 , CONTINUOUS_TRANSMISSION = 0x10 , GFSK = 0x00 , CONTINUOUS_WAVE = 0x08 }
 BLE TX Click TX data loop. More...
 
enum  bletx_eventnum_value_t {
  ADVERTISING_EVENT_REPEAT = 0x00 , ADVERTISING_EVENT_1_TIME , ADVERTISING_EVENT_2_TIME , ADVERTISING_EVENT_3_TIME ,
  ADVERTISING_EVENT_4_TIME , ADVERTISING_EVENT_5_TIME , ADVERTISING_EVENT_6_TIME , ADVERTISING_EVENT_7_TIME
}
 BLE TX Click advertising event setting. More...
 
enum  bletx_return_value_t { BLETX_OK = 0 , BLETX_ERROR = -1 }
 BLE TX Click return value data. More...
 

Functions

void bletx_cfg_setup (bletx_cfg_t *cfg)
 BLE TX configuration object setup function.
 
err_t bletx_init (bletx_t *ctx, bletx_cfg_t *cfg)
 BLE TX initialization function.
 
err_t bletx_default_cfg (bletx_t *ctx)
 BLE TX default configuration function.
 
err_t bletx_power_down (bletx_t *ctx)
 BLE TX full power down function.
 
err_t bletx_power_up (bletx_t *ctx)
 BLE TX full power up function.
 
err_t bletx_hw_reset (bletx_t *ctx)
 BLE TX hardware reset function.
 
err_t bletx_soft_reset (bletx_t *ctx)
 BLE TX software reset function.
 
err_t bletx_interface_selection (bletx_t *ctx, uint8_t sel_interface)
 BLE TX interface selection function.
 
err_t bletx_slave_address_selection (bletx_t *ctx, uint8_t sel_slave_address)
 BLE TX slave address selection function.
 
err_t bletx_baud_rate_selection (bletx_t *ctx, uint32_t sel_baud_rate)
 BLE TX baud rate selection function.
 
err_t bletx_generic_write (bletx_t *ctx, uint8_t reg, uint8_t *tx_buf, uint8_t tx_len)
 BLE TX I2C writing function.
 
err_t bletx_generic_read (bletx_t *ctx, uint8_t reg, uint8_t *rx_buf, uint8_t rx_len)
 BLE TX I2C reading function.
 
err_t bletx_start_advertising (bletx_t *ctx)
 BLE TX start advertising function.
 
err_t bletx_stop_advertising (bletx_t *ctx)
 BLE TX stop advertising function.
 
err_t bletx_set_cfg_adv_channel (bletx_t *ctx, bletx_advch_value_t advch_data)
 BLE TX advertising channel setting function.
 
err_t bletx_set_output_power (bletx_t *ctx, bletx_tx_output_power_value_t power_data)
 BLE TX output power setting function.
 
err_t bletx_set_tx_data (bletx_t *ctx, bletx_txdata_value_t txdata_data)
 BLE TX TX data setting function.
 
err_t bletx_set_eventnum (bletx_t *ctx, bletx_eventnum_value_t eventnum_data)
 BLE TX eventnum setting function.
 
err_t bletx_set_adv_delay (bletx_t *ctx, float adv_delay_ms)
 BLE TX advertising delay setting function.
 
err_t bletx_set_configuration (bletx_t *ctx, bletx_adv_cfg_t adv_cfg)
 BLE TX configuration setting function.
 
err_t bletx_create_adv_data_packet (bletx_t *ctx, bletx_create_adv_data_packet_t adv_data_packet)
 BLE TX create advertising data packet function.
 
err_t bletx_create_eddystone_uri (bletx_t *ctx, bletx_eddystone_data_t adv_data)
 BLE TX create Eddystone™ URI data packet function.
 
err_t bletx_create_eddystone_uid (bletx_t *ctx, bletx_eddystone_data_t adv_data)
 BLE TX create Eddystone™ UID data packet function.
 
err_t bletx_create_eddystone_tlm (bletx_t *ctx, bletx_eddystone_data_t adv_data)
 BLE TX create Eddystone™ TLM data packet function.
 

Detailed Description

This file contains API for BLE TX Click Driver.

Enumeration Type Documentation

◆ bletx_advch_value_t

BLE TX Click Advertising channel setting.

Predefined enum values for advertising 1st, 2nd and 3rd channel setting.

Enumerator
ADVCH1_37_Ch_2402_MHz 
ADVCH1_37_Ch_2480_MHz 
ADVCH1_38_Ch_2426_MHz 
ADVCH1_39_Ch_2480_MHz 
ADVCH2_37_Ch_2402_MHz 
ADVCH2_38_Ch_2426_MHz 
ADVCH2_39_Ch_2480_MHz 
ADVCH2_NO_TX_OUTPUT 
ADVCH3_37_Ch_2402_MHz 
ADVCH3_38_Ch_2426_MHz 
ADVCH3_39_Ch_2480_MHz 
ADVCH3_NO_TX_OUTPUT 

◆ bletx_eventnum_value_t

BLE TX Click advertising event setting.

Predefined enum values for the number of advertising event setting.

Enumerator
ADVERTISING_EVENT_REPEAT 
ADVERTISING_EVENT_1_TIME 
ADVERTISING_EVENT_2_TIME 
ADVERTISING_EVENT_3_TIME 
ADVERTISING_EVENT_4_TIME 
ADVERTISING_EVENT_5_TIME 
ADVERTISING_EVENT_6_TIME 
ADVERTISING_EVENT_7_TIME 

◆ bletx_return_value_t

BLE TX Click return value data.

Predefined enum values for driver return values.

Enumerator
BLETX_OK 
BLETX_ERROR 

◆ bletx_tx_output_power_value_t

BLE TX Click TX output power setting.

Predefined enum values for TX output power [ dBm ] setting.

Enumerator
TX_POWER_0_dBm 
TX_POWER_MINUS_3_dBm 
TX_POWER_MINUS_6_dBm 
TX_POWER_MINUS_9_dBm 
TX_POWER_MINUS_12_dBm 
TX_POWER_MINUS_15_dBm 
TX_POWER_MINUS_20_dBm 
TX_POWER_MINUS_32_dBm 

◆ bletx_txdata_value_t

BLE TX Click TX data loop.

Predefined enum values for TX data loop, burst transmission or continuous transmission setting.

Enumerator
BURST_TRANSMISSION 
CONTINUOUS_TRANSMISSION 
GFSK 
CONTINUOUS_WAVE