my fork

Dependencies:   mbed

Committer:
filartrix
Date:
Wed Apr 08 14:17:20 2015 +0000
Revision:
4:987b201ec4b1
first

Who changed what in which revision?

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