ble9 2.0.0.0
|
This file contains API for BLE 9 Click driver. More...
#include "drv_uart.h"
Go to the source code of this file.
Data Structures | |
struct | ble9_version_t |
struct | ble9_timer_t |
struct | ble9_t |
Click ctx object definition. More... | |
struct | ble9_cfg_t |
Click configuration structure definition. More... | |
Functions | |
void | ble9_cfg_setup (ble9_cfg_t *cfg) |
Config Object Initialization function. | |
err_t | ble9_init (ble9_t *ctx, ble9_cfg_t *cfg) |
Initialization function. | |
err_t | ble9_sys_hello (ble9_t *ctx) |
Verify whether the communication between the host and the device is functional. | |
err_t | ble9_sys_get_version (ble9_t *ctx) |
Get the firmware version information. | |
void | ble9_sys_set_id_addr (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 device address. A valid address set with this command will be written into persistent storage using NVM keys. The stack returns an error if the static device address does not conform to the Bluetooth specification. The new address will be effective in the next system reboot. The stack will use the address in the NVM keys when present. Otherwise, it uses the default Bluetooth public device address which is programmed at production. The stack treats 00:00:00:00:00:00 and ff:ff:ff:ff:ff:ff as invalid addresses. Therefore, passing one of them into this command will cause the stack to delete the NVM keys and use the default address in the next system reboot. | |
err_t | ble9_sys_get_id_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 address. | |
void | ble9_sys_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 reset or boot to DFU mode) depending on the selected boot mode. | |
err_t | ble9_sys_halt (ble9_t *ctx, uint8_t halt) |
Force radio to idle state and allow device to sleep. Advertising, scanning, connections, and software timers are halted by this command. Halted operations resume after calling this command with parameter 0. Connections stay alive if the system is resumed before connection supervision timeout. | |
void | ble9_sys_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 power levels that are radiated from the antenna at TX. The transmitter power at antenna pin will apply the RF TX path gain to match this setting. RF TX path gain can be set in the Bluetooth configuration. If the GATT server contains a TX power service, the TX Power Level attribute will be updated with the selected maximum power level. A selected power level may be different than the requested value if the device cannot meet the requirement. For Bluetooth connections, the maximum radiated TX power is limited to 10 dBm if Adaptive Frequency Hopping (AFH) is not enabled. The minimum TX power setting is used by LE power control. It has no effect in Bluetooth stack if the LE power control feature is not enabled. However, the application may still use this setting for other purposes, e.g., setting the minimum TX power for DTM transmitter test. The minimum and maximum radiated TX power levels can also be configured in the Bluetooth configuration and passed into the Bluetooth stack initialization. By default, the minimum radiated TX power level is configured to -3 dBm and the maximum radiated TX power level to 8 dBm. | |
err_t | ble9_sys_data_buf_write (ble9_t *ctx, uint16_t data_len, uint8_t *wr_data) |
Write data into the system data buffer. Data will be appended to the end of existing data. | |
err_t | ble9_sys_data_buf_clear (ble9_t *ctx) |
Remove all data from the system data buffer. | |
err_t | ble9_sys_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 handles (IDs) are available. The maximum number of concurrent timers is configurable at device initialization. Up to 16 concurrent timers can be configured. The default configuration is 4. As the RAM for storing timer data is pre-allocated at initialization, an application should not configure the amount more than it needs for minimizing RAM usage. | |
err_t | ble9_sys_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 power. The timer event is triggered between time and time + slack. | |
err_t | ble9_gap_set_privacy_mode (ble9_t *ctx, uint8_t privacy, uint8_t interval_in_minutes) |
Enable or disable the privacy feature on all GAP roles. New privacy mode will take effect for advertising next time advertising is enabled, for scanning next time scanning is enabled, and for initiating on the next open connection command. When privacy is enabled and the device is advertising or scanning, the stack will maintain a periodic timer with the specified time interval as a timeout value. At each timeout, the stack will generate a new private resolvable address and use it in advertising data packets and scanning requests. By default, privacy feature is disabled. | |
err_t | ble9_gap_en_wlist (ble9_t *ctx, uint8_t enable) |
Enable or disable whitelisting. The setting will be effective the next time that scanning is enabled. | |
err_t | ble9_adv_create_id (ble9_t *ctx) |
Create an advertising ID. The handle of the created advertising ID is returned in response. | |
err_t | ble9_adv_delete_id (ble9_t *ctx) |
Delete an advertising ID. | |
err_t | ble9_adv_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 next time that advertising is enabled. | |
err_t | ble9_adv_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 advertising is enabled. The invalid parameter error is returned if a PHY value is invalid or the device does not support a given PHY. | |
err_t | ble9_adv_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 next time that advertising is enabled. | |
err_t | ble9_adv_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 advertising is further constrained to be less than +10 dBm. Extended advertising TX power can be +10 dBm and over if Adaptive Frequency Hopping is enabled. This setting will take effect next time advertising is enabled. | |
err_t | ble9_adv_set_report_scan_req (ble9_t *ctx, uint8_t report_scan_req) |
Enable or disable the scan request notification of a given advertising set. This setting will take effect next time that advertising is enabled. | |
err_t | ble9_adv_set_configuration (ble9_t *ctx, uint8_t configurations) |
Enable advertising configuration flags on the given advertising set. The configuration change will take effect next time that advertising is enabled. These configuration flags can be disabled using ble9_adv_clear_configuration. | |
err_t | ble9_adv_clear_configuration (ble9_t *ctx, uint8_t configurations) |
Disable advertising configuration flags on the given advertising set. The configuration change will take effect next time that advertising is enabled. These configuration flags can be enabled using ble9_adv_set_configuration. | |
err_t | ble9_adv_set_data (ble9_t *ctx, ble9_package_type_t packet_type, uint16_t adv_data_len, uint8_t *adv_data) |
Set user-defined data in advertising packets, scan response packets, or periodic advertising packets. Maximum 31 bytes of data can be set for legacy advertising. Maximum 191 bytes of data can be set for connectable extended advertising. Maximum 253 bytes of data can be set for periodic and non-connectable extended advertising. For setting longer advertising data, use command ble9_adv_set_long_data. If advertising mode is currently enabled, the new advertising data will be used immediately. Advertising mode can be enabled using command ble9_adv_start. Periodic advertising mode can be enabled using command ble9_adv_start_per_adv. The invalid parameter error will be returned in the following situations: Data length is more than 31 bytes but the advertiser can only advertise using legacy advertising PDUs. Data is too long to fit into a single advertisement. Set data of the advertising data packet when the advertiser is advertising in scannable mode using extended advertising PDUs. Set data of the scan response data packet when the advertiser is advertising in connectable mode using extended advertising PDUs. Note that the user-defined data may be overwritten by the system when the advertising is later enabled in a discoverable mode other than user_data. | |
err_t | ble9_adv_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 data buffer will be extracted as the advertising data. The buffer will be emptied after this command regardless of the completion status. Prior to calling this command, add data to the buffer with one or multiple calls to #ble9_sys_data_buffer_write. Maximum 31 bytes of data can be set for legacy advertising. Maximum 191 bytes of data can be set for connectable extended advertising. Maximum 1650 bytes of data can be set for periodic and non-connectable extended advertising, but advertising parameters may limit the amount of data that can be sent in a single advertisement. See ble9_adv_set_data for more details on advertising data. | |
err_t | ble9_adv_start (ble9_t *ctx, ble9_adv_mode_discoverable_t discover, ble9_adv_mode_connectable_t connect) |
Start advertising of a given advertising set with specified discoverable and connectable modes. The number of concurrent advertising is limited by MAX_ADVERTISERS configuration. The number of concurrent connectable advertising is also limited by MAX_CONNECTIONS configuration. For example, only one connectable advertising can be enabled if the device has (MAX_CONNECTIONS - 1) connections when this command is called. The limitation does not apply to non-connectable advertising. The default advertising configuration in the stack is set to using legacy advertising PDUs on 1M PHY. | |
err_t | ble9_adv_stop (ble9_t *ctx) |
Stop the advertising of the given advertising set. Counterpart with ble9_adv_start. This command does not affect the enable state of the periodic advertising set, i.e., periodic advertising is not stopped. | |
err_t | ble9_adv_start_per_adv (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 automatically if the set was not enabled and the set can advertise using extended advertising PDUs beside the syncInfo, which is needed for the periodic advertising. The invalid parameter error is returned if the application has configured legacy advertising PDUs or anonymous advertising, or the advertising set is enabled using legacy advertising PDUs. To stop periodic advertising, use ble9_adv_stop_per_adv command with the handle received in response from this command. | |
err_t | ble9_adv_stop_per_adv (ble9_t *ctx) |
Stop the periodic advertising on the given advertising set. Counterpart with ble9_adv_start_per_adv. This command does not affect the enable state of the advertising set, i.e., legacy or extended advertising is not stopped. | |
void | ble9_generic_write (ble9_t *ctx, uint8_t *data_buf, uint16_t len) |
Generic write function. | |
int32_t | ble9_generic_read (ble9_t *ctx, uint8_t *data_buf, uint16_t max_len) |
Generic read function. | |
void | ble9_send_command (ble9_t *ctx, uint32_t command) |
Function for transmiting commands. | |
This file contains API for BLE 9 Click driver.