Go to the documentation of this file.
51 #define BLE9_MAP_MIKROBUS( cfg, mikrobus ) \
52 cfg.tx_pin = MIKROBUS( mikrobus, MIKROBUS_TX ); \
53 cfg.rx_pin = MIKROBUS( mikrobus, MIKROBUS_RX );
60 #define BLE9_RETVAL uint8_t
70 #define BLE9_RSP_READY 1
71 #define BLE9_RSP_NOT_READY 0
80 #define BLE9_CMD_SYSTEM_HELLO_ID 0x00010020
81 #define BLE9_CMD_SYSTEM_DATA_BUFFER_CLEAR_ID 0x14010020
82 #define BLE9_CMD_SYSTEM_RESET_ID 0x01010020
83 #define BLE9_CMD_SYSTEM_HALT_ID 0x2001010C
84 #define BLE9_CMD_SYSTEM_SET_TX_POWER_ID 0x17010020
85 #define BLE9_CMD_SYSTEM_GET_VERSION_ID 0x1B010020
86 #define BLE9_CMD_SYSTEM_SET_SOFT_TIMER_ID 0x19010020
87 #define BLE9_CMD_SYSTEM_SET_LAZY_SOFT_TIMER_ID 0x1A010020
88 #define BLE9_CMD_SYSTEM_SET_IDENTITY_ADDRESS_ID 0x13010020
89 #define BLE9_CMD_SYSTEM_GET_IDENTITY_ADDRESS_ID 0x15010020
90 #define BLE9_CMD_SYSTEM_DATA_BUFFER_WRITE_ID 0x12010020
93 #define BLE9_CMD_GAP_SET_PRIVACY_MODE_ID 0x01020020
94 #define BLE9_CMD_GAP_ENABLE_WHITELISTING_ID 0x03020020
97 #define BLE9_CMD_ADVERTISER_CREATE_ID 0x01040020
98 #define BLE9_CMD_ADVERTISER_DELETE_SET_ID 0x02040020
99 #define BLE9_CMD_ADVERTISER_START_ID 0x09040320
100 #define BLE9_CMD_ADVERTISER_STOP_ID 0x0A040020
101 #define BLE9_CMD_ADVERTISER_SET_TIMING_ID 0x03040020
102 #define BLE9_CMD_ADVERTISER_SET_PHY_ID 0x06040020
103 #define BLE9_CMD_ADVERTISER_SET_CHANNEL_MAP_ID 0x04040020
104 #define BLE9_CMD_ADVERTISER_SET_TX_POWER_ID 0x0B040020
105 #define BLE9_CMD_ADVERTISER_SET_REPORT_SCAN_REQUEST_ID 0x05040020
106 #define BLE9_CMD_ADVERTISER_SET_CONFIGURATION_ID 0x07040020
107 #define BLE9_CMD_ADVERTISER_CLEAR_CONFIGURATION_ID 0x08040020
108 #define BLE9_CMD_ADVERTISER_SET_DATA_ID 0x0F040020
109 #define BLE9_CMD_ADVERTISER_SET_LONG_DATA_ID 0x0E040020
110 #define BLE9_CMD_ADVERTISER_START_PERIODIC_ADVERTISING_ID 0x0C040020
111 #define BLE9_CMD_ADVERTISER_STOP_PERIODIC_ADVERTISING_ID 0x0D040020
114 #define BLE9_CMD_NULL 0
115 #define BLE9_SYSTEM_RESUME 0
116 #define BLE9_SYSTEM_HALT 1
122 #define DRV_RX_BUFFER_SIZE 100
123 #define DRV_TX_BUFFER_SIZE 100
571 uint16_t interval_max, uint16_t duration,
695 size_t adv_data_len,
const uint8_t *adv_data );
784 uint16_t interval_max, uint8_t flags );
uart_t uart
Definition: ble9.h:264
#define DRV_RX_BUFFER_SIZE
Definition: ble9.h:122
uart_data_bits_t data_bit
Definition: ble9.h:282
@ BLE9_DFU_RESET_MODE_OTA
Definition: ble9.h:138
BLE9_RETVAL ble9_advertiser_set_data(ble9_t *ctx, ble9_package_type_t packet_type, size_t adv_data_len, const uint8_t *adv_data)
Set user-defined data in advertising packets, scan response packets, or periodic advertising packets....
BLE9_RETVAL ble9_system_get_identity_address(ble9_t *ctx, uint8_t *data_buf, uint8_t type)
Read the Bluetooth identity address used by the device, which can be a public or random static device...
BLE9_RETVAL ble9_system_halt(ble9_t *ctx, uint8_t halt)
Force radio to idle state and allow device to sleep. Advertising, scanning, connections,...
BLE9_RETVAL ble9_advertiser_set_long_data(ble9_t *ctx, ble9_package_type_t packet_type)
Set advertising data for a specified packet type and advertising set. Data currently in the system da...
@ BLE9_CHANNEL_ALL
Definition: ble9.h:151
uart_stop_bits_t stop_bit
Definition: ble9.h:284
BLE9_RETVAL ble9_advertiser_start_periodic_advertising(ble9_t *ctx, uint16_t interval_min, uint16_t interval_max, uint8_t flags)
Start periodic advertising on the given advertising set. The stack enables the advertising set automa...
ble9_dfu_reset_mode_t
Definition: ble9.h:132
@ BLE9_ADVERTISER_MODE_DISCOVERABLE_BROADCAST
Send advertising and/or scan response data defined by the user. The limited/general discoverable flag...
Definition: ble9.h:191
ble9_advertiser_mode_discoverable_t
Definition: ble9.h:179
uint16_t version_major
Major release version.
Definition: ble9.h:223
@ BLE9_ADVERTISER_MODE_DISCOVERABLE_GENERAL
Device is not discoverable in either limited or generic discovery procedure but may be discovered usi...
Definition: ble9.h:187
BLE9_RETVAL ble9_advertiser_set_timing(ble9_t *ctx, uint16_t interval_min, uint16_t interval_max, uint16_t duration, uint8_t maxevents)
Set the advertising timing parameters of the given advertising set. This setting will take effect nex...
BLE9_RETVAL ble9_system_set_lazy_soft_timer(ble9_t *ctx, ble9_timer_t *ble9_timer)
Start a software timer with slack. The slack parameter allows the stack to optimize wakeups and save ...
@ BLE9_CHANNEL_37_39
Definition: ble9.h:149
BLE9_RETVAL ble9_advertiser_delete_id(ble9_t *ctx)
Delete an advertising ID.
void ble9_cfg_setup(ble9_cfg_t *cfg)
Config Object Initialization function.
uart_parity_t parity_bit
Definition: ble9.h:283
uint32_t ble9_timer_slack
Definition: ble9.h:253
BLE9_RETVAL ble9_advertiser_set_channel_map(ble9_t *ctx, ble9_channel_t channel_map)
Set the primary advertising channel map of the given advertising set. This setting will take effect n...
void ble9_system_set_tx_power(ble9_t *ctx, int16_t min_power, int16_t max_power)
Set the global minimum and maximum radiated TX power levels for Bluetooth. This returns selected powe...
BLE9_RETVAL ble9_advertiser_set_phy(ble9_t *ctx, ble9_phy_type_t primary_phy, ble9_phy_type_t secondary_phy)
Set advertising PHYs of the given advertising set. This setting will take effect next time that adver...
uint32_t version_bootloader
Version hash.
Definition: ble9.h:231
BLE9_RETVAL ble9_init(ble9_t *ctx, ble9_cfg_t *cfg)
Initialization function.
BLE9_RETVAL ble9_advertiser_start(ble9_t *ctx, ble9_advertiser_mode_discoverable_t discover, ble9_advertiser_mode_connectable_t connect)
Start advertising of a given advertising set with specified discoverable and connectable modes....
BLE9_RETVAL ble9_system_get_version(ble9_t *ctx)
Get the firmware version information.
ble9_advertiser_mode_connectable_t
Definition: ble9.h:199
uint16_t version_build
Bootloader version.
Definition: ble9.h:229
@ BLE9_ADVERTISER_MODE_CONNECTABLE_DIRECTED
Undirected connectable scannable. This mode can only be used in legacy advertising PDUs.
Definition: ble9.h:204
uint32_t ble9_timer_time
Slack time in hardware clock ticks.
Definition: ble9.h:251
@ BLE9_PHY_TYPE_2M
(0x4) Coded PHY, 125k (S=8) or 500k (S=2).
Definition: ble9.h:159
#define BLE9_RETVAL
Definition: ble9.h:60
@ BLE9_PHY_TYPE_CODED
(0xFF) Any PHYs the device supports.
Definition: ble9.h:162
@ BLE9_PACKAGE_TYPE_PERIODIC_ADVERTISING
Definition: ble9.h:175
@ BLE9_CHANNEL_37
Definition: ble9.h:145
@ BLE9_CHANNEL_38
Definition: ble9.h:146
@ BLE9_PHY_TYPE_1M
(0x1) 1M PHY.
Definition: ble9.h:157
Click configuration structure definition.
Definition: ble9.h:274
BLE9_RETVAL ble9_system_hello(ble9_t *ctx)
Verify whether the communication between the host and the device is functional.
@ BLE9_ADVERTISER_MODE_CONNECTABLE_NONE_SCANABLE
Definition: ble9.h:213
BLE9_RETVAL ble9_system_data_buffer_write(ble9_t *ctx, size_t data_len, const uint8_t *wr_data)
Write data into the system data buffer. Data will be appended to the end of existing data.
Click ctx object definition.
Definition: ble9.h:260
BLE9_RETVAL ble9_advertiser_create_id(ble9_t *ctx)
Create an advertising ID. The handle of the created advertising ID is returned in response.
@ BLE9_ADVERTISER_MODE_CONNECTABLE_NONE
Non-connectable non-scannable.
Definition: ble9.h:201
BLE9_RETVAL ble9_advertiser_set_configuration(ble9_t *ctx, uint8_t configurations)
Enable advertising configuration flags on the given advertising set. The configuration change will ta...
uint16_t version_patch
Build number.
Definition: ble9.h:227
@ BLE9_PHY_TYPE_ANY
Definition: ble9.h:165
@ BLE9_CHANNEL_39
Definition: ble9.h:148
uint32_t baud_rate
Definition: ble9.h:280
ble9_package_type_t
Definition: ble9.h:169
@ BLE9_CHANNEL_37_38
Definition: ble9.h:147
BLE9_RETVAL ble9_advertiser_set_report_scan_request(ble9_t *ctx, bool report_scan_req)
Enable or disable the scan request notification of a given advertising set. This setting will take ef...
BLE9_RETVAL ble9_gap_set_privacy_mode(ble9_t *ctx, bool privacy, uint8_t interval_in_minutes)
Enable or disable the privacy feature on all GAP roles. New privacy mode will take effect for adverti...
uint8_t ble9_timer_single_shot
Frequency interval of events, which indicates how often to send events in hardware clock ticks (1 sec...
Definition: ble9.h:244
@ BLE9_ADVERTISER_MODE_CONNECTABLE_NONE_CONNECTABLE
Undirected connectable non-scannable. This mode can only be used in extended advertising PDUs.
Definition: ble9.h:210
@ BLE9_PACKAGE_TYPE_ADVERTISING
Advertising packets.
Definition: ble9.h:171
void ble9_generic_write(ble9_t *ctx, char *data_buf)
Generic write function.
uint8_t ble9_advertiser_handle
Definition: ble9.h:261
@ BLE9_CHANNEL_38_39
Definition: ble9.h:150
@ BLE9_ADVERTISER_MODE_DISCOVERABLE_NONE
Not discoverable.
Definition: ble9.h:181
pin_name_t tx_pin
Definition: ble9.h:277
BLE9_RETVAL ble9_advertiser_clear_configuration(ble9_t *ctx, uint8_t configurations)
Disable advertising configuration flags on the given advertising set. The configuration change will t...
ble9_phy_type_t
Definition: ble9.h:155
uint32_t version_hash
Definition: ble9.h:233
uint8_t ble9_timer_handle
Timer handle to use, which is returned in timeout event.
Definition: ble9.h:239
@ BLE9_ADVERTISER_MODE_DISCOVERABLE_USER_DATA
Definition: ble9.h:195
BLE9_RETVAL ble9_advertiser_stop(ble9_t *ctx)
Stop the advertising of the given advertising set. Counterpart with ble9_advertiser_start....
pin_name_t rx_pin
Definition: ble9.h:276
#define DRV_TX_BUFFER_SIZE
Definition: ble9.h:123
void ble9_send_command(ble9_t *ctx, char *command, uint8_t buf_length)
Function for transmiting commands.
BLE9_RETVAL ble9_system_set_soft_timer(ble9_t *ctx, ble9_timer_t *ble9_timer)
Start a software timer. Multiple concurrent timers can be running simultaneously. 256 unique timer ha...
int32_t ble9_generic_read(ble9_t *ctx, char *data_buf, uint16_t max_len)
Generic read function.
ble9_version_t * ble9_version
Definition: ble9.h:262
@ BLE9_ADVERTISER_MODE_CONNECTABLE_SCANNABLE
Undirected scannable (Non-connectable but responds to scan requests)
Definition: ble9.h:207
bool uart_blocking
Definition: ble9.h:281
BLE9_RETVAL ble9_gap_enable_whitelisting(ble9_t *ctx, bool enable)
Enable or disable whitelisting. The setting will be effective the next time that scanning is enabled.
ble9_channel_t
Definition: ble9.h:144
void ble9_system_reset(ble9_t *ctx, ble9_dfu_reset_mode_t reset_mode)
Reset the system. The command does not have a response but it triggers one of the boot events (normal...
@ BLE9_DFU_RESET_MODE_UART
Boot to OTA DFU mode.
Definition: ble9.h:136
uint16_t version_minor
Patch release version.
Definition: ble9.h:225
@ BLE9_ADVERTISER_MODE_DISCOVERABLE_LIMITED
Discoverable using general discovery procedure.
Definition: ble9.h:184
@ BLE9_DFU_RESET_MODE_NORMAL
Boot to normal mode.
Definition: ble9.h:134
@ BLE9_PACKAGE_TYPE_SCAN_RESPONSE
Periodic advertising packets.
Definition: ble9.h:173
BLE9_RETVAL ble9_advertiser_stop_periodic_advertising(ble9_t *ctx)
Stop the periodic advertising on the given advertising set. Counterpart with ble9_advertiser_start_pe...
void ble9_system_set_identity_address(ble9_t *ctx, uint8_t *address, uint8_t type)
Set the device's Bluetooth identity address. The address can be a public device address or a static d...
BLE9_RETVAL ble9_advertiser_set_tx_power(ble9_t *ctx, int16_t power, int16_t *set_power)
Limit the maximum advertising TX power on the given advertising set. The maximum TX power of legacy a...
BLE9_RETVAL ble9_system_data_buffer_clear(ble9_t *ctx)
Remove all data from the system data buffer.