My fork of X_NUCLEO_IDB0XA1

Fork of X_NUCLEO_IDB0XA1 by ST

Embed: (wiki syntax)

« Back to documentation index

HAL functions

HAL functions
[HAL]

API for BlueNRG HAL layer. More...

Functions

tBleStatus aci_hal_write_config_data (uint8_t offset, uint8_t len, const uint8_t *val)
 This command writes a value to a low level configure data structure.
tBleStatus aci_hal_read_config_data (uint8_t offset, uint16_t data_len, uint8_t *data_len_out_p, uint8_t *data)
 This command requests the value in the low level configure data structure.
tBleStatus aci_hal_set_tx_power_level (uint8_t en_high_power, uint8_t pa_level)
 This command sets the TX power level of the BlueNRG.
tBleStatus aci_hal_le_tx_test_packet_number (uint32_t *number_of_packets)
 This command returns the number of packets sent in Direct Test Mode.
tBleStatus aci_hal_device_standby (void)
 Put the device in standby mode.
tBleStatus aci_hal_tone_start (uint8_t rf_channel)
 This command starts a carrier frequency, i.e.
tBleStatus aci_hal_tone_stop (void)
 This command is used to stop the previously started aci_hal_tone_start() command.

Detailed Description

API for BlueNRG HAL layer.


Function Documentation

tBleStatus aci_hal_device_standby ( void   )

Put the device in standby mode.

Note:
Normally the BlueNRG will automatically enter sleep mode to save power. This command puts the device into the Standby mode instead of the sleep mode. The difference is that, in sleep mode, the device can still wake up itself with the internal timer. But in standby mode, this timer is disabled. So the only possibility to wake up the device is by external signals, e.g. a HCI command sent via SPI bus. The command is only accepted when there is no other Bluetooth activity. Otherwise an error code ERR_COMMAND_DISALLOWED will be returned.
Returns:
Value indicating success or error code.

Definition at line 126 of file bluenrg_hal_aci.c.

tBleStatus aci_hal_le_tx_test_packet_number ( uint32_t *  number_of_packets )

This command returns the number of packets sent in Direct Test Mode.

Note:
When the Direct TX test is started, a 32-bit counter is used to count how many packets have been transmitted. This command can be used to check how many packets have been sent during the Direct TX test.
The counter starts from 0 and counts upwards. The counter can wrap and start from 0 again. The counter is not cleared until the next Direct TX test starts.
Parameters:
[out]number_of_packetsNumber of packets sent during the last Direct TX test.
Returns:
Value indicating success or error code.
tBleStatus aci_hal_read_config_data ( uint8_t  offset,
uint16_t  data_len,
uint8_t *  data_len_out_p,
uint8_t *  data 
)

This command requests the value in the low level configure data structure.

The number of read bytes changes for different Offset.

Parameters:
offsetOffset in the data structure. The starting member in the data structure will have an offset 0.
See Offsets and lengths for configuration values..
data_lenLength of the data buffer
[out]data_len_out_plength of the data returned by the read.
[out]dataRead data
Returns:
Value indicating success or error code.

Definition at line 70 of file bluenrg_hal_aci.c.

tBleStatus aci_hal_set_tx_power_level ( uint8_t  en_high_power,
uint8_t  pa_level 
)

This command sets the TX power level of the BlueNRG.

Note:
By controlling the EN_HIGH_POWER and the PA_LEVEL, the combination of the 2 determines the output power level (dBm). When the system starts up or reboots, the default TX power level will be used, which is the maximum value of 8dBm. Once this command is given, the output power will be changed instantly, regardless if there is Bluetooth communication going on or not. For example, for debugging purpose, the BlueNRG can be set to advertise all the time and use this command to observe the signal strength changing. The system will keep the last received TX power level from the command, i.e. the 2nd command overwrites the previous TX power level. The new TX power level remains until another Set TX Power command, or the system reboots.
Parameters:
en_high_powerCan be only 0 or 1. Set high power bit on or off. It is strongly adviced to use the right value, depending on the selected hardware configuration for the RF network: normal mode or high power mode.
pa_levelCan be from 0 to 7. Set the PA level value.
Returns:
Value indicating success or error code.

Definition at line 99 of file bluenrg_hal_aci.c.

tBleStatus aci_hal_tone_start ( uint8_t  rf_channel )

This command starts a carrier frequency, i.e.

a tone, on a specific channel.

Note:
The frequency sine wave at the specific channel may be used for test purpose only. The channel ID is a parameter from 0 to 39 for the 40 BLE channels, e.g. 0 for 2.402GHz, 1 for 2.404GHz etc. This command shouldn't be used when normal Bluetooth activities are ongoing. The tone should be stopped by aci_hal_tone_stop() command.
Parameters:
rf_channelBLE Channel ID, from 0 to 39 meaning (2.402 + 2*N) GHz. Actually the tone will be emitted at the channel central frequency minus 250 kHz.
Returns:
Value indicating success or error code.

Definition at line 143 of file bluenrg_hal_aci.c.

tBleStatus aci_hal_tone_stop ( void   )

This command is used to stop the previously started aci_hal_tone_start() command.

Returns:
Value indicating success or error code.

Definition at line 165 of file bluenrg_hal_aci.c.

tBleStatus aci_hal_write_config_data ( uint8_t  offset,
uint8_t  len,
const uint8_t *  val 
)

This command writes a value to a low level configure data structure.

Note:
It is useful to setup directly some low level parameters for the system at runtime.
Parameters:
offsetOffset in the data structure. The starting member in the data structure will have an offset 0.
See Offsets and lengths for configuration values..
lenLength of data to be written
[out]valData to be written
Returns:
Value indicating success or error code.

Definition at line 31 of file bluenrg_hal_aci.c.