System#
Modules#
Key | Description |
---|---|
Indicates that the device has started and the radio is ready. | |
Indicates that an error has occurred. | |
Indicates that a hardware-related error has occurred. | |
Indicates that the external signals have been received. | |
Indicates that the device is awake and no longer in sleep mode. | |
Indicates that a soft timer has lapsed. |
Enumerations#
Name | Value |
---|---|
enum | |
system_boot_mode_uart_dfu = 0x1, | |
system_boot_mode_ota_dfu = 0x2}System boot mode. | |
enum | |
}Link Layer Configuration Keys. |
Functions#
Key | Value |
---|---|
sl_status_t | |
void | sl_bt_system_reset(uint8_tdfu) |
sl_status_t | sl_bt_system_halt (uint8_t halt) |
sl_status_t | sl_bt_system_linklayer_configure (uint8_t key, size_t data_len, const uint8_t *data) |
sl_status_t | sl_bt_system_set_max_tx_power (int16_t power, int16_t *set_power) |
sl_status_t | sl_bt_system_set_identity_address (bd_addr address, uint8_t type) |
sl_status_t | sl_bt_system_get_identity_address (bd_addr *address, uint8_t *type) |
sl_status_t | sl_bt_system_get_random_data (uint8_t length, size_t max_data_size, size_t *data_len, uint8_t *data) |
sl_status_t | sl_bt_system_data_buffer_write (size_t data_len, const uint8_t *data) |
sl_status_t | |
sl_status_t | sl_bt_system_get_counters (uint8_t reset, uint16_t *tx_packets, uint16_t *rx_packets, uint16_t *crc_errors, uint16_t *failures) |
sl_status_t | sl_bt_system_set_soft_timer (uint32_t time, uint8_t handle, uint8_t single_shot) |
sl_status_t | sl_bt_system_set_lazy_soft_timer (uint32_t time, uint32_t slack, uint8_t handle, uint8_t single_shot) |
Detailed Description#
System.
Commands and events in this class can be used to access and query the local device.
Enumeration Type Documentation#
system_boot_mode_t#
enum system_boot_mode_t
System boot mode.
Enumerator | |
---|---|
system_boot_mode_normal | (0x0) Boot to normal mode |
system_boot_mode_uart_dfu | (0x1) Boot to UART DFU mode |
system_boot_mode_ota_dfu | (0x2) Boot to OTA DFU mode |
system_linklayer_config_key_t#
enum system_linklayer_config_key_t
Link Layer Configuration Keys.
Enumerator | |
---|---|
system_linklayer_config_key_halt | (0x1) Same as system_halt command, value-0 Stop Radio 1- Start Radio |
system_linklayer_config_key_priority_range | (0x2) Sets the RAIL priority_mapping offset field of the link layer priority configuration structure to the first byte of the value field. |
system_linklayer_config_key_scan_channels | (0x3) Sets channels to scan on. The first byte of the value is the channel map. 0x1 = Channel 37, 0x2 = Channel 38, 0x4 = Channel 39 |
system_linklayer_config_key_set_flags | (0x4) Sets the link layer configuration flags. The value is a little endian 32-bit integer. Flag Values:
|
system_linklayer_config_key_clr_flags | (0x5) Value is flags to clear. Flags are the same as in SET_FLAGS command. |
system_linklayer_config_key_set_afh_interval | (0x7) Set afh_scan_interval field of Link Layer priority configuration structure. |
system_linklayer_config_key_set_priority_table | (0x9) Value contains priority table to be copied over the existing table. If value is smaller than full table then only those values are updated. see sl_btbluetooth_ll_priorities struct for the definition of priority table. |
Function Documentation#
sl_bt_system_hello()#
sl_status_t sl_bt_system_hello ( )
Verify whether the communication between the host and the device is functional.
ReturnsSL_STATUS_OK if successful. Error code otherwise.
sl_bt_system_reset()#
void sl_bt_system_reset ( uint8_t dfu
)
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.
Parameters | ||
---|---|---|
[in] |
| Enum system_boot_mode_t. Boot mode.Values:
|
Events#
sl_bt_evt_system_boot - Sent after the device has booted in normal mode.
sl_bt_evt_dfu_boot - Sent after the device has booted in UART DFU mode.
sl_bt_system_halt()#
sl_status_t sl_bt_system_halt ( 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 system is resumed before connection supervision timeout.
Use this command only for a short time period (a few seconds at maximum). Although it halts Bluetooth activity, all tasks and operations still exist inside the stack with their own concepts of time. Halting the system for a long time period may have negative consequences on stack's internal states.
NOTE: The software timer is also halted. Hardware interrupts are the only way to wake up from energy mode 2 when the system is halted.
Parameters | ||
---|---|---|
[in] |
| Values:
|
ReturnsSL_STATUS_OK if successful. Error code otherwise.
sl_bt_system_linklayer_configure()#
sl_status_t sl_bt_system_linklayer_configure | ( uint8_t size_t const uint8_t *) |
|
Send configuration data to the link layer. This command fine tunes low-level Bluetooth operations.
Parameters | ||
---|---|---|
[in] |
| Enum system_linklayer_config_key_t. Key to configure. Values:
|
[in] |
| Array length |
[in] |
| Configuration data. Length and contents of the data field depend on the key value used. |
ReturnsSL_STATUS_OK if successful. Error code otherwise.
sl_bt_system_set_max_tx_power()#
sl_status_t sl_bt_system_set_max_tx_power | ( int16_t int16_t * ) |
|
Set the global maximum TX power for Bluetooth. The returned value is the selected maximum output power level after applying the RF path compensation. If the GATT server contains a TX power service, the TX Power Level attribute will be updated accordingly.
The selected power level may be less than the specified value if the device does not meet the power requirements. For Bluetooth connections, the maximum TX power is limited to 10 dBm if Adaptive Frequency Hopping (AFH) is not enabled.
By default, the global maximum TX power value is 8 dBm.
NOTE: Do not use this command while advertising, scanning, or during connection.
Parameters
[in] |
| TX power in 0.1 dBm steps. For example, the value of 10 is 1 dBm and 55 is 5.5 dBm. |
[out] |
| The selected maximum power level |
ReturnsSL_STATUS_OK if successful. Error code otherwise.
sl_bt_system_set_identity_address()#
sl_status_t sl_bt_system_set_identity_address | ( bd_addr uint8_t ) |
|
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.
Note: Because the NVM keys are located in flash and flash wearing can occur, avoid calling this command regularly.
Parameters | ||
---|---|---|
[in] |
| Bluetooth identity address in little endian format |
[in] |
| Address type* 0: Public device address |
1: Static device address |
ReturnsSL_STATUS_OK if successful. Error code otherwise.
sl_bt_system_get_identity_address()#
sl_status_t sl_bt_system_get_identity_address | ( bd_addr * |
|
uint8_t * |
| |
) |
Read the Bluetooth identity address used by the device, which can be a public or random static device address.
Parameters | ||
---|---|---|
[out] |
| Bluetooth public address in little endian format |
[out] |
| Address type* 0: Public device address |
1: Static random address |
ReturnsSL_STATUS_OK if successful. Error code otherwise.
sl_bt_system_get_random_data()#
sl_status_t sl_bt_system_get_random_data | ( | uint8_t |
|
size_t |
| ||
size_t * |
| ||
uint8_t * |
| ||
) |
Get random data up to 16 bytes.
Parameters | ||
---|---|---|
[in] |
| Length of random data. Maximum length is 16 bytes. |
[in] |
| Size of output buffer passed in |
[out] |
| On return, set to the length of output data written to |
[out] |
| Random data |
ReturnsSL_STATUS_OK if successful. Error code otherwise.
sl_bt_system_data_buffer_write()#
sl_status_t sl_bt_system_data_buffer_write | ( | size_t |
|
const uint8_t * |
| ||
) |
Write data into the system data buffer. Data will be appended to the end of existing data.
Parameters | ||
---|---|---|
[in] |
| Array length |
[in] |
| Data to write |
ReturnsSL_STATUS_OK if successful. Error code otherwise.
sl_bt_system_data_buffer_clear()#
sl_status_t sl_bt_system_data_buffer_clear | ( | ) |
Remove all data from the system data buffer.
ReturnsSL_STATUS_OK if successful. Error code otherwise.
sl_bt_system_get_counters()#
sl_status_t sl_bt_system_get_counters | ( | uint8_t |
|
uint16_t * |
| ||
uint16_t * |
| ||
uint16_t * |
| ||
uint16_t * |
| ||
) |
Get packet and error counters. Passing a non-zero value also resets counters.
Parameters | ||
---|---|---|
[in] |
| Reset counters if the parameter value is not zero. |
[out] |
| The number of successfully transmitted packets |
[out] |
| The number of successfully received packets |
[out] |
| The number of received packets with CRC errors |
[out] |
| The number of radio failures, such as aborted TX/RX packets, scheduling failures, and so on. |
ReturnsSL_STATUS_OK if successful. Error code otherwise.
bsl_bt_system_set_soft_timer()#
sl_status_t sl_bt_system_set_soft_timer | ( | uint32_t |
|
uint8_t |
| ||
uint8_t |
| ||
) |
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.
Parameters | ||
---|---|---|
[in] |
|
|
[in] |
| Timer handle to use, which is returned in timeout event |
[in] |
| Timer mode. Values:
|
Returns#
SL_STATUS_OK if successful. Error code otherwise.
Events#
sl_bt_evt_system_soft_timer - Sent after this timer has lapsed.
sl_bt_system_set_lazy_soft_timer()#
sl_status_t sl_bt_system_set_lazy_soft_timer | ( | uint32_t |
|
uint32_t |
| ||
uint8_t |
| ||
uint8_t |
| ||
) |
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
. See also description of sl_bt_system_set_soft_timer command.
Parameters | ||
---|---|---|
[in] |
|
|
[in] |
| Slack time in hardware clock ticks |
[in] |
| Timer handle to use, which is returned in timeout event |
[in] |
| Timer mode. Values: |
Returns#
SL_STATUS_OK if successful. Error code otherwise.
Events#
sl_bt_evt_system_soft_timer - Sent after this timer has lapsed.