bluetooth control motor

Dependents:   BLE_LED_IDB0XA1_demo MOTOR_BLE_V2 Motor_Ble_v1 Motor_Ble_v10223 ... more

Fork of X_NUCLEO_IDB0XA1 by ST

Committer:
Wolfgang Betz
Date:
Wed Oct 07 08:39:04 2015 +0200
Revision:
132:51056160fa4a
Child:
229:9981f62cdb1a
Andrea's version as of mail from 10/06/2015 05:56 PM

From: Andrea PALMIERI <andrea.palmieri@st.com>
To: Wolfgang BETZ <wolfgang.betz@st.com>, Rohit Grover <rohit.grover@arm.com>,
Antonio VILEI <antonio.vilei@st.com>, Mihail Stoyanov
<Mihail.Stoyanov@arm.com>
CC: Nicola CAPOVILLA <nicola.capovilla@st.com>, Silvio Lucio OLIVA
<silvio.oliva@st.com>, "jonathan.austin@arm.com" <jonathan.austin@arm.com>
Content-Class: urn:content-classes:message
Date: Tue, 6 Oct 2015 17:56:34 +0200
Subject: RE: Arduino Compatibility of X-NUCLEO-IDB04A1

Who changed what in which revision?

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