Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: Hello_BLE F446RE-BLE
Fork of X_NUCLEO_IDB0XA1 by
BlueNRG_HCI/includes/bluenrg_hal_aci.h@129:57997390c086, 2015-11-03 (annotated)
- Committer:
- leonardoaraujosantos
- Date:
- Tue Nov 03 23:10:27 2015 +0000
- Revision:
- 129:57997390c086
- Parent:
- 70:d20d30f59b1c
Changing pin D13
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Silvio Lucio Oliva |
70:d20d30f59b1c | 1 | /******************** (C) COPYRIGHT 2014 STMicroelectronics ******************** |
Silvio Lucio Oliva |
70:d20d30f59b1c | 2 | * File Name : bluenrg_hal_aci.h |
Silvio Lucio Oliva |
70:d20d30f59b1c | 3 | * Author : AMS - AAS |
Silvio Lucio Oliva |
70:d20d30f59b1c | 4 | * Version : V1.0.0 |
Silvio Lucio Oliva |
70:d20d30f59b1c | 5 | * Date : 26-Jun-2014 |
Silvio Lucio Oliva |
70:d20d30f59b1c | 6 | * Description : Header file with HCI commands for BlueNRG FW6.3. |
Silvio Lucio Oliva |
70:d20d30f59b1c | 7 | ******************************************************************************** |
Silvio Lucio Oliva |
70:d20d30f59b1c | 8 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS |
Silvio Lucio Oliva |
70:d20d30f59b1c | 9 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. |
Silvio Lucio Oliva |
70:d20d30f59b1c | 10 | * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, |
Silvio Lucio Oliva |
70:d20d30f59b1c | 11 | * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE |
Silvio Lucio Oliva |
70:d20d30f59b1c | 12 | * CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING |
Silvio Lucio Oliva |
70:d20d30f59b1c | 13 | * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. |
Silvio Lucio Oliva |
70:d20d30f59b1c | 14 | *******************************************************************************/ |
Silvio Lucio Oliva |
70:d20d30f59b1c | 15 | |
Silvio Lucio Oliva |
70:d20d30f59b1c | 16 | #ifndef __BLUENRG_HAL_ACI_H__ |
Silvio Lucio Oliva |
70:d20d30f59b1c | 17 | #define __BLUENRG_HAL_ACI_H__ |
Silvio Lucio Oliva |
70:d20d30f59b1c | 18 | |
Silvio Lucio Oliva |
70:d20d30f59b1c | 19 | /** |
Silvio Lucio Oliva |
70:d20d30f59b1c | 20 | *@addtogroup HAL HAL |
Silvio Lucio Oliva |
70:d20d30f59b1c | 21 | *@brief Hardware Abstraction Layer. |
Silvio Lucio Oliva |
70:d20d30f59b1c | 22 | *@{ |
Silvio Lucio Oliva |
70:d20d30f59b1c | 23 | */ |
Silvio Lucio Oliva |
70:d20d30f59b1c | 24 | |
Silvio Lucio Oliva |
70:d20d30f59b1c | 25 | /** |
Silvio Lucio Oliva |
70:d20d30f59b1c | 26 | * @defgroup HAL_Functions HAL functions |
Silvio Lucio Oliva |
70:d20d30f59b1c | 27 | * @brief API for BlueNRG HAL layer. |
Silvio Lucio Oliva |
70:d20d30f59b1c | 28 | * @{ |
Silvio Lucio Oliva |
70:d20d30f59b1c | 29 | */ |
Silvio Lucio Oliva |
70:d20d30f59b1c | 30 | |
Silvio Lucio Oliva |
70:d20d30f59b1c | 31 | /** |
Silvio Lucio Oliva |
70:d20d30f59b1c | 32 | * @brief This command writes a value to a low level configure data structure. |
Silvio Lucio Oliva |
70:d20d30f59b1c | 33 | * @note It is useful to setup directly some low level parameters for the system at runtime. |
Silvio Lucio Oliva |
70:d20d30f59b1c | 34 | * @param offset Offset in the data structure. The starting member in the data structure will have an offset 0.\n |
Silvio Lucio Oliva |
70:d20d30f59b1c | 35 | * See @ref Config_vals. |
Silvio Lucio Oliva |
70:d20d30f59b1c | 36 | * |
Silvio Lucio Oliva |
70:d20d30f59b1c | 37 | * @param len Length of data to be written |
Silvio Lucio Oliva |
70:d20d30f59b1c | 38 | * @param[out] val Data to be written |
Silvio Lucio Oliva |
70:d20d30f59b1c | 39 | * @return Value indicating success or error code. |
Silvio Lucio Oliva |
70:d20d30f59b1c | 40 | */ |
Silvio Lucio Oliva |
70:d20d30f59b1c | 41 | tBleStatus aci_hal_write_config_data(uint8_t offset, |
Silvio Lucio Oliva |
70:d20d30f59b1c | 42 | uint8_t len, |
Silvio Lucio Oliva |
70:d20d30f59b1c | 43 | const uint8_t *val); |
Silvio Lucio Oliva |
70:d20d30f59b1c | 44 | |
Silvio Lucio Oliva |
70:d20d30f59b1c | 45 | /** |
Silvio Lucio Oliva |
70:d20d30f59b1c | 46 | * @brief This command sets the TX power level of the BlueNRG. |
Silvio Lucio Oliva |
70:d20d30f59b1c | 47 | * @note By controlling the EN_HIGH_POWER and the PA_LEVEL, the combination of the 2 determines |
Silvio Lucio Oliva |
70:d20d30f59b1c | 48 | * the output power level (dBm). |
Silvio Lucio Oliva |
70:d20d30f59b1c | 49 | * When the system starts up or reboots, the default TX power level will be used, which is |
Silvio Lucio Oliva |
70:d20d30f59b1c | 50 | * the maximum value of 8dBm. Once this command is given, the output power will be changed |
Silvio Lucio Oliva |
70:d20d30f59b1c | 51 | * instantly, regardless if there is Bluetooth communication going on or not. For example, |
Silvio Lucio Oliva |
70:d20d30f59b1c | 52 | * for debugging purpose, the BlueNRG can be set to advertise all the time and use this |
Silvio Lucio Oliva |
70:d20d30f59b1c | 53 | * command to observe the signal strength changing. The system will keep the last received |
Silvio Lucio Oliva |
70:d20d30f59b1c | 54 | * TX power level from the command, i.e. the 2nd command overwrites the previous TX power |
Silvio Lucio Oliva |
70:d20d30f59b1c | 55 | * level. The new TX power level remains until another Set TX Power command, or the system |
Silvio Lucio Oliva |
70:d20d30f59b1c | 56 | * reboots.\n |
Silvio Lucio Oliva |
70:d20d30f59b1c | 57 | * @param en_high_power Can be only 0 or 1. Set high power bit on or off. It is strongly adviced to use the |
Silvio Lucio Oliva |
70:d20d30f59b1c | 58 | * right value, depending on the selected hardware configuration for the RF network: |
Silvio Lucio Oliva |
70:d20d30f59b1c | 59 | * normal mode or high power mode. |
Silvio Lucio Oliva |
70:d20d30f59b1c | 60 | * @param pa_level Can be from 0 to 7. Set the PA level value. |
Silvio Lucio Oliva |
70:d20d30f59b1c | 61 | * @return Value indicating success or error code. |
Silvio Lucio Oliva |
70:d20d30f59b1c | 62 | */ |
Silvio Lucio Oliva |
70:d20d30f59b1c | 63 | tBleStatus aci_hal_set_tx_power_level(uint8_t en_high_power, uint8_t pa_level); |
Silvio Lucio Oliva |
70:d20d30f59b1c | 64 | |
Silvio Lucio Oliva |
70:d20d30f59b1c | 65 | /** |
Silvio Lucio Oliva |
70:d20d30f59b1c | 66 | * @brief Put the device in standby mode. |
Silvio Lucio Oliva |
70:d20d30f59b1c | 67 | * @note Normally the BlueNRG will automatically enter sleep mode to save power. This command puts the |
Silvio Lucio Oliva |
70:d20d30f59b1c | 68 | * device into the Standby mode instead of the sleep mode. The difference is that, in sleep mode, |
Silvio Lucio Oliva |
70:d20d30f59b1c | 69 | * the device can still wake up itself with the internal timer. But in standby mode, this timer is |
Silvio Lucio Oliva |
70:d20d30f59b1c | 70 | * disabled. So the only possibility to wake up the device is by external signals, e.g. a HCI command |
Silvio Lucio Oliva |
70:d20d30f59b1c | 71 | * sent via SPI bus. |
Silvio Lucio Oliva |
70:d20d30f59b1c | 72 | * The command is only accepted when there is no other Bluetooth activity. Otherwise an error code |
Silvio Lucio Oliva |
70:d20d30f59b1c | 73 | * ERR_COMMAND_DISALLOWED will be returned. |
Silvio Lucio Oliva |
70:d20d30f59b1c | 74 | * |
Silvio Lucio Oliva |
70:d20d30f59b1c | 75 | * @return Value indicating success or error code. |
Silvio Lucio Oliva |
70:d20d30f59b1c | 76 | */ |
Silvio Lucio Oliva |
70:d20d30f59b1c | 77 | tBleStatus aci_hal_device_standby(void); |
Silvio Lucio Oliva |
70:d20d30f59b1c | 78 | |
Silvio Lucio Oliva |
70:d20d30f59b1c | 79 | /** |
Silvio Lucio Oliva |
70:d20d30f59b1c | 80 | * @brief This command starts a carrier frequency, i.e. a tone, on a specific channel. |
Silvio Lucio Oliva |
70:d20d30f59b1c | 81 | * @note The frequency sine wave at the specific channel may be used for test purpose only. |
Silvio Lucio Oliva |
70:d20d30f59b1c | 82 | * 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. |
Silvio Lucio Oliva |
70:d20d30f59b1c | 83 | * This command shouldn't be used when normal Bluetooth activities are ongoing. |
Silvio Lucio Oliva |
70:d20d30f59b1c | 84 | * The tone should be stopped by aci_hal_tone_stop() command. |
Silvio Lucio Oliva |
70:d20d30f59b1c | 85 | * |
Silvio Lucio Oliva |
70:d20d30f59b1c | 86 | * @param rf_channel BLE Channel ID, from 0 to 39 meaning (2.402 + 2*N) GHz. Actually the tone will be emitted at the |
Silvio Lucio Oliva |
70:d20d30f59b1c | 87 | * channel central frequency minus 250 kHz. |
Silvio Lucio Oliva |
70:d20d30f59b1c | 88 | * @return Value indicating success or error code. |
Silvio Lucio Oliva |
70:d20d30f59b1c | 89 | */ |
Silvio Lucio Oliva |
70:d20d30f59b1c | 90 | tBleStatus aci_hal_tone_start(uint8_t rf_channel); |
Silvio Lucio Oliva |
70:d20d30f59b1c | 91 | |
Silvio Lucio Oliva |
70:d20d30f59b1c | 92 | /** |
Silvio Lucio Oliva |
70:d20d30f59b1c | 93 | * This command is used to stop the previously started aci_hal_tone_start() command. |
Silvio Lucio Oliva |
70:d20d30f59b1c | 94 | * @return Value indicating success or error code. |
Silvio Lucio Oliva |
70:d20d30f59b1c | 95 | */ |
Silvio Lucio Oliva |
70:d20d30f59b1c | 96 | tBleStatus aci_hal_tone_stop(void); |
Silvio Lucio Oliva |
70:d20d30f59b1c | 97 | |
Silvio Lucio Oliva |
70:d20d30f59b1c | 98 | /** |
Silvio Lucio Oliva |
70:d20d30f59b1c | 99 | * @} |
Silvio Lucio Oliva |
70:d20d30f59b1c | 100 | */ |
Silvio Lucio Oliva |
70:d20d30f59b1c | 101 | |
Silvio Lucio Oliva |
70:d20d30f59b1c | 102 | /** |
Silvio Lucio Oliva |
70:d20d30f59b1c | 103 | * @defgroup Config_vals Offsets and lengths for configuration values. |
Silvio Lucio Oliva |
70:d20d30f59b1c | 104 | * @brief Offsets and lengths for configuration values. |
Silvio Lucio Oliva |
70:d20d30f59b1c | 105 | * See aci_hal_write_config_data(). |
Silvio Lucio Oliva |
70:d20d30f59b1c | 106 | * @{ |
Silvio Lucio Oliva |
70:d20d30f59b1c | 107 | */ |
Silvio Lucio Oliva |
70:d20d30f59b1c | 108 | |
Silvio Lucio Oliva |
70:d20d30f59b1c | 109 | /** |
Silvio Lucio Oliva |
70:d20d30f59b1c | 110 | * @name Configuration values. |
Silvio Lucio Oliva |
70:d20d30f59b1c | 111 | * See @ref aci_hal_write_config_data(). |
Silvio Lucio Oliva |
70:d20d30f59b1c | 112 | * @{ |
Silvio Lucio Oliva |
70:d20d30f59b1c | 113 | */ |
Silvio Lucio Oliva |
70:d20d30f59b1c | 114 | #define CONFIG_DATA_PUBADDR_OFFSET (0x00) /**< Bluetooth public address */ |
Silvio Lucio Oliva |
70:d20d30f59b1c | 115 | #define CONFIG_DATA_DIV_OFFSET (0x06) /**< DIV used to derive CSRK */ |
Silvio Lucio Oliva |
70:d20d30f59b1c | 116 | #define CONFIG_DATA_ER_OFFSET (0x08) /**< Encryption root key used to derive LTK and CSRK */ |
Silvio Lucio Oliva |
70:d20d30f59b1c | 117 | #define CONFIG_DATA_IR_OFFSET (0x18) /**< Identity root key used to derive LTK and CSRK */ |
Silvio Lucio Oliva |
70:d20d30f59b1c | 118 | #define CONFIG_DATA_LL_WITHOUT_HOST (0x2C) /**< Switch on/off Link Layer only mode. Set to 1 to disable Host. |
Silvio Lucio Oliva |
70:d20d30f59b1c | 119 | It can be written only if aci_hal_write_config_data() is the first command |
Silvio Lucio Oliva |
70:d20d30f59b1c | 120 | after reset. */ |
Silvio Lucio Oliva |
70:d20d30f59b1c | 121 | |
Silvio Lucio Oliva |
70:d20d30f59b1c | 122 | /** |
Silvio Lucio Oliva |
70:d20d30f59b1c | 123 | * Select the BlueNRG roles and mode configurations.\n |
Silvio Lucio Oliva |
70:d20d30f59b1c | 124 | * @li Mode 1: slave or master, 1 connection, RAM1 only (small GATT DB) |
Silvio Lucio Oliva |
70:d20d30f59b1c | 125 | * @li Mode 2: slave or master, 1 connection, RAM1 and RAM2 (large GATT DB) |
Silvio Lucio Oliva |
70:d20d30f59b1c | 126 | * @li Mode 3: master only, 8 connections, RAM1 and RAM2. |
Silvio Lucio Oliva |
70:d20d30f59b1c | 127 | */ |
Silvio Lucio Oliva |
70:d20d30f59b1c | 128 | #define CONFIG_DATA_ROLE (0x2D) |
Silvio Lucio Oliva |
70:d20d30f59b1c | 129 | /** |
Silvio Lucio Oliva |
70:d20d30f59b1c | 130 | * @} |
Silvio Lucio Oliva |
70:d20d30f59b1c | 131 | */ |
Silvio Lucio Oliva |
70:d20d30f59b1c | 132 | |
Silvio Lucio Oliva |
70:d20d30f59b1c | 133 | /** |
Silvio Lucio Oliva |
70:d20d30f59b1c | 134 | * @name Length for configuration values. |
Silvio Lucio Oliva |
70:d20d30f59b1c | 135 | * See @ref aci_hal_write_config_data(). |
Silvio Lucio Oliva |
70:d20d30f59b1c | 136 | * @{ |
Silvio Lucio Oliva |
70:d20d30f59b1c | 137 | */ |
Silvio Lucio Oliva |
70:d20d30f59b1c | 138 | #define CONFIG_DATA_PUBADDR_LEN (6) |
Silvio Lucio Oliva |
70:d20d30f59b1c | 139 | #define CONFIG_DATA_DIV_LEN (2) |
Silvio Lucio Oliva |
70:d20d30f59b1c | 140 | #define CONFIG_DATA_ER_LEN (16) |
Silvio Lucio Oliva |
70:d20d30f59b1c | 141 | #define CONFIG_DATA_IR_LEN (16) |
Silvio Lucio Oliva |
70:d20d30f59b1c | 142 | #define CONFIG_DATA_LL_WITHOUT_HOST_LEN (1) |
Silvio Lucio Oliva |
70:d20d30f59b1c | 143 | #define CONFIG_DATA_ROLE_LEN (1) |
Silvio Lucio Oliva |
70:d20d30f59b1c | 144 | /** |
Silvio Lucio Oliva |
70:d20d30f59b1c | 145 | * @} |
Silvio Lucio Oliva |
70:d20d30f59b1c | 146 | */ |
Silvio Lucio Oliva |
70:d20d30f59b1c | 147 | |
Silvio Lucio Oliva |
70:d20d30f59b1c | 148 | /** |
Silvio Lucio Oliva |
70:d20d30f59b1c | 149 | * @} |
Silvio Lucio Oliva |
70:d20d30f59b1c | 150 | */ |
Silvio Lucio Oliva |
70:d20d30f59b1c | 151 | |
Silvio Lucio Oliva |
70:d20d30f59b1c | 152 | /** |
Silvio Lucio Oliva |
70:d20d30f59b1c | 153 | * @} |
Silvio Lucio Oliva |
70:d20d30f59b1c | 154 | */ |
Silvio Lucio Oliva |
70:d20d30f59b1c | 155 | |
Silvio Lucio Oliva |
70:d20d30f59b1c | 156 | |
Silvio Lucio Oliva |
70:d20d30f59b1c | 157 | #endif /* __BLUENRG_HAL_ACI_H__ */ |