ble9 2.0.0.0
Public function

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.
 

Detailed Description

Function Documentation

◆ 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.

Parameters
ctxClick object.
configurationsAdvertising configuration flags to disable. This value can be a bitmask of multiple flags. See ble9_adv_set_configuration for possible flags.
Returns
err_t

◆ ble9_adv_create_id()

err_t ble9_adv_create_id ( ble9_t * ctx)

Create an advertising ID. The handle of the created advertising ID is returned in response.

Parameters
ctxClick object.
Returns
err_t

◆ ble9_adv_delete_id()

err_t ble9_adv_delete_id ( ble9_t * ctx)

Delete an advertising ID.

Parameters
ctxClick object.
Returns
err_t

◆ ble9_adv_set_channel_map()

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.

Parameters
ctxClick object.
channel_mapAdvertising channel map which determines which of the three channels will be used for advertising. This value is given as a bitmask.
Returns
err_t
Note
See ble9_channel_t for more information.
Recommended value: 7

◆ ble9_adv_set_configuration()

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.

Parameters
ctxClick object.
configurationsAdvertising configuration flags to enable. This value can be a bitmask of multiple flags. Flags: 1 (Bit 0): Use legacy advertising PDUs. 2 (Bit 1): Omit advertiser's address from all PDUs (anonymous advertising). This flag is effective only in extended advertising. 4 (Bit 2): Use gap_non_resolvable address type. Advertising must be in non-connectable mode if this configuration is enabled. 8 (Bit 3): Include TX power in advertising packets. This flag is effective only in extended advertising. Default value: 1
Returns
err_t

◆ ble9_adv_set_data()

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.

Parameters
ctxClick object.
packet_typeThis value selects whether data is intended for advertising packets, scan response packets, or periodic advertising packets. Values:
Field Description
0 Advertising packets
1 Scan response packets
8 Periodic advertising packets
adv_data_lenArray length.
adv_dataData to be set.
Returns
err_t
Note
See ble9_package_type_t for more information.

◆ ble9_adv_set_long_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.

Parameters
ctxClick object.
packet_typeThis value selects whether data is intended for advertising packets, scan response packets, or periodic advertising packets. Values:
Field Description
0 Advertising packets
1 Scan response packets
8 Periodic advertising packets
Returns
err_t
Note
See ble9_package_type_t for more information.

◆ ble9_adv_set_phy()

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.

Parameters
ctxClick object.
primary_phyThe PHY on which the advertising packets are transmitted on the primary advertising channel. If legacy advertising PDUs are used, 1M PHY must be used.
secondary_phyThe PHY on which the advertising packets are transmitted on the secondary advertising channel.
Note
See ble9_phy_type_t for more information.
Returns
err_t

◆ ble9_adv_set_report_scan_req()

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.

Parameters
ctxClick object.
report_scan_reqIf non-zero, enables scan request notification and scan requests will be reported as events. Default value: 0
Returns
err_t

◆ ble9_adv_set_timing()

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.

Parameters
ctxClick object.
interval_minMinimum advertising interval. Value in units of 0.625 ms Range: 0x20 to 0xFFFF Time range: 20 ms to 40.96 s Default value: 100 ms
interval_maxMaximum advertising interval. Value in units of 0.625 ms Range: 0x20 to 0xFFFF Time range: 20 ms to 40.96 s Note: interval_max should be bigger than interval_min Default value: 200 ms
durationAdvertising duration for this advertising set. Value 0 indicates no advertising duration limit and advertising continues until it is disabled. A non-zero value sets the duration in units of 10 ms. The duration begins at the start of the first advertising event of this advertising set. Range: 0x0001 to 0xFFFF Time range: 10 ms to 655.35 s Default value: 0
maxeventsIf non-zero, indicates the maximum number of advertising events to send before the advertiser is stopped. Value 0 indicates no maximum number limit. Default value: 0
Returns
err_t

◆ ble9_adv_set_tx_power()

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.

Parameters
ctxClick object.
powerTX power in 0.1 dBm steps. For example, the value of 10 is 1 dBm and 55 is 5.5 dBm.
set_powerThe selected maximum advertising TX power.
Returns
err_t

◆ ble9_adv_start()

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.

Parameters
ctxClick object.
discoverDiscoverable mode. See ble9_adv_mode_discoverable_t for more information.
connectConnectable mode. See ble9_adv_mode_connectable_t for more information.
Returns
err_t
Warning
BLE9_ADVERTISER_MODE_CONNECTABLE_DIRECTED is reserver. Do not use it.

◆ ble9_adv_start_per_adv()

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.

Parameters
ctxClick object.
interval_minMinimum periodic advertising interval. Value in units of 1.25 ms.
Field Description
Range 0x06 to 0xFFFF
Time range 7.5 ms to 81.92 s
Default value 100 ms
interval_maxMaximum periodic advertising interval. Value in units of 1.25 ms.
Field Description
Range 0x06 to 0xFFFF
Time range 7.5 ms to 81.92 s
Default value 200 ms
flagsPeriodic advertising configurations. Bitmask of the following: Bit 0: Include TX power in advertising PDU.
Returns
err_t
Note
interval_max should be bigger than interval_min

◆ ble9_adv_stop()

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.

Parameters
ctxClick object.
Returns
err_t

◆ ble9_adv_stop_per_adv()

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.

Parameters
ctxClick object.
Returns
err_t

◆ ble9_cfg_setup()

void ble9_cfg_setup ( ble9_cfg_t * cfg)

Config Object Initialization function.

Parameters
cfgClick configuration structure. @description This function initializes click configuration structure to default state.
Note
All used pins will be set to unconnected state.

◆ ble9_gap_en_wlist()

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.

Parameters
ctxClick object.
enable1 Enable 0 Disable
Returns
err_t

◆ ble9_gap_set_privacy_mode()

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.

Parameters
ctxClick object.
privacy1 Enable privacy 0 Disable privacy
interval_in_minutesThe minimum time interval between a private address change. This parameter is ignored if this command is issued to disable privacy mode. Values: 0: Use default interval, 15 minutes. n: The time interval in minutes.
Returns
err_t

◆ ble9_generic_read()

int32_t ble9_generic_read ( ble9_t * ctx,
uint8_t * data_buf,
uint16_t max_len )

Generic read function.

Parameters
ctxClick object.
data_bufData buffer.
max_lenMaximum length of data that can be read.
Returns
Number of bytes read.

◆ ble9_generic_write()

void ble9_generic_write ( ble9_t * ctx,
uint8_t * data_buf,
uint16_t len )

Generic write function.

Parameters
ctxClick object.
data_bufData buffer.
lenLength of data to be written.

◆ ble9_init()

err_t ble9_init ( ble9_t * ctx,
ble9_cfg_t * cfg )

Initialization function.

Parameters
ctxClick object.
cfgClick configuration structure. @description This function initializes all necessary pins and peripherals used for this click.
Returns
err_t

◆ ble9_send_command()

void ble9_send_command ( ble9_t * ctx,
uint32_t command )

Function for transmiting commands.

Parameters
ctxClick object.
commandCommand to be transmitted.

@description This function allows the user to transmit data and send commands to the module.

◆ ble9_sys_data_buf_clear()

err_t ble9_sys_data_buf_clear ( ble9_t * ctx)

Remove all data from the system data buffer.

Parameters
ctxClick object.
Returns
err_t

◆ ble9_sys_data_buf_write()

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.

Parameters
ctxClick object.
data_lenArray length.
wr_dataData to write.
Returns
err_t

◆ ble9_sys_get_id_address()

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.

Parameters
ctxClick object.
data_bufArray address for storing return values.
typeAddress type. 1 Static device address 0 Public device address
Returns
err_t

◆ ble9_sys_get_version()

err_t ble9_sys_get_version ( ble9_t * ctx)

Get the firmware version information.

ctx->ble9_version values:

Field Description
version_major Major release version
version_minor Minor release version
version_patch Patch release number
version_build Build number
version_bootloader Bootloader version
version_hash Version hash
Parameters
ctxClick object.
Returns
err_t
Note
See ble9_version_t for more information.

◆ ble9_sys_halt()

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.

Parameters
ctxClick object.
halt1 halt 0 resume
Returns
err_t
Note
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 period of time may have negative consequences on stack's internal states.
Warning
The software timer is also halted. Hardware interrupts are the only way to wake up from energy mode 2 when the system is halted.

◆ ble9_sys_hello()

err_t ble9_sys_hello ( ble9_t * ctx)

Verify whether the communication between the host and the device is functional.

Parameters
ctxClick object.
Returns
err_t

◆ ble9_sys_reset()

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.

Parameters
ctxClick object.
reset_modeSee ble9_dfu_reset_mode_t for more information.

◆ ble9_sys_set_id_addr()

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.

Parameters
ctxClick object.
addressBluetooth identity address in little endian format.
typeAddress type. 1 Static device address 0 Public device address
Note
Because the NVM keys are located in flash and flash wearing can occur, avoid calling this command regularly.

◆ ble9_sys_set_lazy_soft_timer()

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.

Parameters
ctxClick object.
ble9_timerTimer structure. See ble9_timer_t for more information.
Returns
err_t

◆ ble9_sys_set_soft_timer()

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.

Parameters
ctxClick object.
ble9_timerTimer structure. See ble9_timer_t for more information.
Returns
err_t

◆ ble9_sys_set_tx_power()

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.

Parameters
ctxClick object.
min_powerMinimum radiated TX power. Unit: 0.1 dBm. For example, the value 10 means 1 dBm.
max_powerMaximum radiated TX power. Unit: 0.1 dBm. For example, the value 10 means 1 dBm.
Warning
Do not use this command while advertising or scanning. Furthermore, the stack does not allow setting TX powers during connections.