ble

Dependencies:   HC_SR04_Ultrasonic_Library Servo mbed

Fork of FIP_REV1 by Robotique FIP

Committer:
julientiron
Date:
Tue May 19 16:53:44 2015 +0000
Revision:
1:bdbf36f8408d
ddd; ;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
julientiron 1:bdbf36f8408d 1 /**
julientiron 1:bdbf36f8408d 2 ******************************************************************************
julientiron 1:bdbf36f8408d 3 * @file x_nucleo_iks01a1.h
julientiron 1:bdbf36f8408d 4 * @author MEMS Application Team
julientiron 1:bdbf36f8408d 5 * @version V1.0.0
julientiron 1:bdbf36f8408d 6 * @date 30-July-2014
julientiron 1:bdbf36f8408d 7 * @brief This file contains definitions for the x_nucleo_iks01a1.c
julientiron 1:bdbf36f8408d 8 * board specific functions.
julientiron 1:bdbf36f8408d 9 ******************************************************************************
julientiron 1:bdbf36f8408d 10 * @attention
julientiron 1:bdbf36f8408d 11 *
julientiron 1:bdbf36f8408d 12 * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
julientiron 1:bdbf36f8408d 13 *
julientiron 1:bdbf36f8408d 14 * Redistribution and use in source and binary forms, with or without modification,
julientiron 1:bdbf36f8408d 15 * are permitted provided that the following conditions are met:
julientiron 1:bdbf36f8408d 16 * 1. Redistributions of source code must retain the above copyright notice,
julientiron 1:bdbf36f8408d 17 * this list of conditions and the following disclaimer.
julientiron 1:bdbf36f8408d 18 * 2. Redistributions in binary form must reproduce the above copyright notice,
julientiron 1:bdbf36f8408d 19 * this list of conditions and the following disclaimer in the documentation
julientiron 1:bdbf36f8408d 20 * and/or other materials provided with the distribution.
julientiron 1:bdbf36f8408d 21 * 3. Neither the name of STMicroelectronics nor the names of its contributors
julientiron 1:bdbf36f8408d 22 * may be used to endorse or promote products derived from this software
julientiron 1:bdbf36f8408d 23 * without specific prior written permission.
julientiron 1:bdbf36f8408d 24 *
julientiron 1:bdbf36f8408d 25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
julientiron 1:bdbf36f8408d 26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
julientiron 1:bdbf36f8408d 27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
julientiron 1:bdbf36f8408d 28 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
julientiron 1:bdbf36f8408d 29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
julientiron 1:bdbf36f8408d 30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
julientiron 1:bdbf36f8408d 31 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
julientiron 1:bdbf36f8408d 32 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
julientiron 1:bdbf36f8408d 33 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
julientiron 1:bdbf36f8408d 34 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
julientiron 1:bdbf36f8408d 35 *
julientiron 1:bdbf36f8408d 36 ******************************************************************************
julientiron 1:bdbf36f8408d 37 */
julientiron 1:bdbf36f8408d 38
julientiron 1:bdbf36f8408d 39
julientiron 1:bdbf36f8408d 40 /* Define to prevent recursive inclusion -------------------------------------*/
julientiron 1:bdbf36f8408d 41 #ifndef __X_NUCLEO_IKS01A1_H
julientiron 1:bdbf36f8408d 42 #define __X_NUCLEO_IKS01A1_H
julientiron 1:bdbf36f8408d 43
julientiron 1:bdbf36f8408d 44 #include "cube_hal.h"
julientiron 1:bdbf36f8408d 45
julientiron 1:bdbf36f8408d 46 #ifdef __cplusplus
julientiron 1:bdbf36f8408d 47 extern "C" {
julientiron 1:bdbf36f8408d 48 #endif
julientiron 1:bdbf36f8408d 49
julientiron 1:bdbf36f8408d 50 /* Includes ------------------------------------------------------------------*/
julientiron 1:bdbf36f8408d 51 #ifdef USE_STM32F4XX_NUCLEO
julientiron 1:bdbf36f8408d 52 #include "stm32f4xx_hal.h"
julientiron 1:bdbf36f8408d 53 #endif
julientiron 1:bdbf36f8408d 54 #ifdef USE_STM32L0XX_NUCLEO
julientiron 1:bdbf36f8408d 55 #include "stm32l0xx_hal.h"
julientiron 1:bdbf36f8408d 56 #endif
julientiron 1:bdbf36f8408d 57 #include <stdint.h>
julientiron 1:bdbf36f8408d 58
julientiron 1:bdbf36f8408d 59 /** @addtogroup BSP
julientiron 1:bdbf36f8408d 60 * @{
julientiron 1:bdbf36f8408d 61 */
julientiron 1:bdbf36f8408d 62
julientiron 1:bdbf36f8408d 63 /** @addtogroup X_NUCLEO_IKS01A1
julientiron 1:bdbf36f8408d 64 * @{
julientiron 1:bdbf36f8408d 65 */
julientiron 1:bdbf36f8408d 66
julientiron 1:bdbf36f8408d 67 /** @defgroup X_NUCLEO_IKS01A1_Exported_Types
julientiron 1:bdbf36f8408d 68 * @{
julientiron 1:bdbf36f8408d 69 */
julientiron 1:bdbf36f8408d 70
julientiron 1:bdbf36f8408d 71 typedef struct {
julientiron 1:bdbf36f8408d 72 int32_t AXIS_X;
julientiron 1:bdbf36f8408d 73 int32_t AXIS_Y;
julientiron 1:bdbf36f8408d 74 int32_t AXIS_Z;
julientiron 1:bdbf36f8408d 75 } AxesRaw_TypeDef;
julientiron 1:bdbf36f8408d 76
julientiron 1:bdbf36f8408d 77 /**
julientiron 1:bdbf36f8408d 78 * @}
julientiron 1:bdbf36f8408d 79 */
julientiron 1:bdbf36f8408d 80
julientiron 1:bdbf36f8408d 81 /** @defgroup X_NUCLEO_IKS01A1_Exported_Constants
julientiron 1:bdbf36f8408d 82 * @{
julientiron 1:bdbf36f8408d 83 */
julientiron 1:bdbf36f8408d 84
julientiron 1:bdbf36f8408d 85 /* I2C clock speed configuration (in Hz) */
julientiron 1:bdbf36f8408d 86 #ifndef NUCLEO_I2C_SHIELDS_SPEED
julientiron 1:bdbf36f8408d 87 #define NUCLEO_I2C_SHIELDS_SPEED 100000
julientiron 1:bdbf36f8408d 88 #endif /* I2C_ONBOARD_SENSORS_SPEED */
julientiron 1:bdbf36f8408d 89
julientiron 1:bdbf36f8408d 90 /* I2C peripheral configuration defines (control interface of the audio codec) */
julientiron 1:bdbf36f8408d 91 #define NUCLEO_I2C_SHIELDS I2C1
julientiron 1:bdbf36f8408d 92 #define NUCLEO_I2C_SHIELDS_CLK_ENABLE() __I2C1_CLK_ENABLE()
julientiron 1:bdbf36f8408d 93 #define NUCLEO_I2C_SHIELDS_SCL_SDA_GPIO_CLK_ENABLE() __GPIOB_CLK_ENABLE()
julientiron 1:bdbf36f8408d 94 #define NUCLEO_I2C_SHIELDS_SCL_SDA_AF GPIO_AF4_I2C1
julientiron 1:bdbf36f8408d 95 #define NUCLEO_I2C_SHIELDS_SCL_SDA_GPIO_PORT GPIOB
julientiron 1:bdbf36f8408d 96 #define NUCLEO_I2C_SHIELDS_SCL_PIN GPIO_PIN_8
julientiron 1:bdbf36f8408d 97 #define NUCLEO_I2C_SHIELDS_SDA_PIN GPIO_PIN_9
julientiron 1:bdbf36f8408d 98
julientiron 1:bdbf36f8408d 99 #define NUCLEO_I2C_SHIELDS_FORCE_RESET() __I2C1_FORCE_RESET()
julientiron 1:bdbf36f8408d 100 #define NUCLEO_I2C_SHIELDS_RELEASE_RESET() __I2C1_RELEASE_RESET()
julientiron 1:bdbf36f8408d 101
julientiron 1:bdbf36f8408d 102 /* I2C interrupt requests */
julientiron 1:bdbf36f8408d 103 //#define NUCLEO_I2C_SHIELDS_EV_IRQn I2C1_EV_IRQn
julientiron 1:bdbf36f8408d 104 #ifdef STM32F401xE
julientiron 1:bdbf36f8408d 105 #define NUCLEO_I2C_SHIELDS_EV_IRQn I2C1_EV_IRQn
julientiron 1:bdbf36f8408d 106 #endif
julientiron 1:bdbf36f8408d 107 #ifdef STM32L053xx
julientiron 1:bdbf36f8408d 108 #define NUCLEO_I2C_SHIELDS_EV_IRQn I2C1_IRQn
julientiron 1:bdbf36f8408d 109 #endif
julientiron 1:bdbf36f8408d 110 #define NUCLEO_I2C_SHIELDS_ER_IRQn I2C1_ER_IRQn
julientiron 1:bdbf36f8408d 111
julientiron 1:bdbf36f8408d 112 #ifdef USE_FREE_RTOS
julientiron 1:bdbf36f8408d 113 #define NUCLEO_I2C_SHIELDS_MUTEX I2C1_Mutex_id
julientiron 1:bdbf36f8408d 114 #define NUCLEO_I2C_SHIELDS_MUTEX_TAKE() osMutexWait(NUCLEO_I2C_SHIELDS_MUTEX, 0)
julientiron 1:bdbf36f8408d 115 #define NUCLEO_I2C_SHIELDS_MUTEX_RELEASE() osMutexRelease(NUCLEO_I2C_SHIELDS_MUTEX)
julientiron 1:bdbf36f8408d 116 #endif
julientiron 1:bdbf36f8408d 117
julientiron 1:bdbf36f8408d 118 /* Maximum Timeout values for flags waiting loops. These timeouts are not based
julientiron 1:bdbf36f8408d 119 on accurate values, they just guarantee that the application will not remain
julientiron 1:bdbf36f8408d 120 stuck if the SPI communication is corrupted.
julientiron 1:bdbf36f8408d 121 You may modify these timeout values depending on CPU frequency and application
julientiron 1:bdbf36f8408d 122 conditions (interrupts routines ...). */
julientiron 1:bdbf36f8408d 123 #define NUCLEO_I2C_SHIELDS_TIMEOUT_MAX 0x1000 /*<! The value of the maximal timeout for BUS waiting loops */
julientiron 1:bdbf36f8408d 124
julientiron 1:bdbf36f8408d 125
julientiron 1:bdbf36f8408d 126
julientiron 1:bdbf36f8408d 127 /* User can use this section to tailor USARTx/UARTx instance used and associated
julientiron 1:bdbf36f8408d 128 resources */
julientiron 1:bdbf36f8408d 129 /* Definition for USARTx clock resources */
julientiron 1:bdbf36f8408d 130 #define USARTx USART2
julientiron 1:bdbf36f8408d 131 #define USARTx_CLK_ENABLE() __USART2_CLK_ENABLE();
julientiron 1:bdbf36f8408d 132 #define DMAx_CLK_ENABLE() __DMA1_CLK_ENABLE()
julientiron 1:bdbf36f8408d 133 #define USARTx_RX_GPIO_CLK_ENABLE() __GPIOA_CLK_ENABLE()
julientiron 1:bdbf36f8408d 134 #define USARTx_TX_GPIO_CLK_ENABLE() __GPIOA_CLK_ENABLE()
julientiron 1:bdbf36f8408d 135
julientiron 1:bdbf36f8408d 136 #define USARTx_FORCE_RESET() __USART2_FORCE_RESET()
julientiron 1:bdbf36f8408d 137 #define USARTx_RELEASE_RESET() __USART2_RELEASE_RESET()
julientiron 1:bdbf36f8408d 138
julientiron 1:bdbf36f8408d 139 /* Definition for USARTx Pins */
julientiron 1:bdbf36f8408d 140 #define USARTx_TX_PIN GPIO_PIN_2
julientiron 1:bdbf36f8408d 141 #define USARTx_TX_GPIO_PORT GPIOA
julientiron 1:bdbf36f8408d 142 #define USARTx_TX_AF GPIO_AF7_USART2
julientiron 1:bdbf36f8408d 143 #define USARTx_RX_PIN GPIO_PIN_3
julientiron 1:bdbf36f8408d 144 #define USARTx_RX_GPIO_PORT GPIOA
julientiron 1:bdbf36f8408d 145 #define USARTx_RX_AF GPIO_AF7_USART2
julientiron 1:bdbf36f8408d 146
julientiron 1:bdbf36f8408d 147 /* Definition for USARTx's DMA */
julientiron 1:bdbf36f8408d 148 #define USARTx_TX_DMA_CHANNEL DMA_CHANNEL_4
julientiron 1:bdbf36f8408d 149 #define USARTx_TX_DMA_STREAM DMA1_Stream6
julientiron 1:bdbf36f8408d 150 #define USARTx_RX_DMA_CHANNEL DMA_CHANNEL_4
julientiron 1:bdbf36f8408d 151 #define USARTx_RX_DMA_STREAM DMA1_Stream5
julientiron 1:bdbf36f8408d 152
julientiron 1:bdbf36f8408d 153
julientiron 1:bdbf36f8408d 154
julientiron 1:bdbf36f8408d 155 /* Definition for interrupt Pins */
julientiron 1:bdbf36f8408d 156 #define HUM_TEMP_DRDY_GPIO_PORT GPIOB
julientiron 1:bdbf36f8408d 157 #define HUM_TEMP_DRDY_GPIO_CLK_ENABLE() __GPIOB_CLK_ENABLE()
julientiron 1:bdbf36f8408d 158 #define HUM_TEMP_DRDY_GPIO_CLK_DISABLE() __GPIOB_CLK_DISABLE()
julientiron 1:bdbf36f8408d 159 #define HUM_TEMP_DRDY_PIN GPIO_PIN_10
julientiron 1:bdbf36f8408d 160 #define HUM_TEMP_DRDY_EXTI_IRQn EXTI15_10_IRQn
julientiron 1:bdbf36f8408d 161
julientiron 1:bdbf36f8408d 162 #define IMU_6AXES_INT1_GPIO_PORT GPIOB
julientiron 1:bdbf36f8408d 163 #define IMU_6AXES_INT1_GPIO_CLK_ENABLE() __GPIOB_CLK_ENABLE()
julientiron 1:bdbf36f8408d 164 #define IMU_6AXES_INT1_GPIO_CLK_DISABLE() __GPIOB_CLK_DISABLE()
julientiron 1:bdbf36f8408d 165 #define IMU_6AXES_INT1_PIN GPIO_PIN_5
julientiron 1:bdbf36f8408d 166 #define IMU_6AXES_INT1_EXTI_IRQn EXTI9_5_IRQn
julientiron 1:bdbf36f8408d 167
julientiron 1:bdbf36f8408d 168 #define MAGNETO_DRDY_GPIO_PORT GPIOC
julientiron 1:bdbf36f8408d 169 #define MAGNETO_DRDY_GPIO_CLK_ENABLE() __GPIOC_CLK_ENABLE()
julientiron 1:bdbf36f8408d 170 #define MAGNETO_DRDY_GPIO_CLK_DISABLE() __GPIOC_CLK_DISABLE()
julientiron 1:bdbf36f8408d 171 #define MAGNETO_DRDY_PIN GPIO_PIN_0
julientiron 1:bdbf36f8408d 172 #define MAGNETO_DRDY_EXTI_IRQn EXTI0_IRQn
julientiron 1:bdbf36f8408d 173
julientiron 1:bdbf36f8408d 174 #define MAGNETO_INT1_GPIO_PORT GPIOC
julientiron 1:bdbf36f8408d 175 #define MAGNETO_INT1_GPIO_CLK_ENABLE() __GPIOC_CLK_ENABLE()
julientiron 1:bdbf36f8408d 176 #define MAGNETO_INT1_GPIO_CLK_DISABLE() __GPIOC_CLK_DISABLE()
julientiron 1:bdbf36f8408d 177 #define MAGNETO_INT1_PIN GPIO_PIN_1
julientiron 1:bdbf36f8408d 178 #define MAGNETO_INT1_EXTI_IRQn EXTI1_IRQn
julientiron 1:bdbf36f8408d 179
julientiron 1:bdbf36f8408d 180 #define PRESSURE_INT1_GPIO_PORT GPIOB
julientiron 1:bdbf36f8408d 181 #define PRESSURE_INT1_GPIO_CLK_ENABLE() __GPIOB_CLK_ENABLE()
julientiron 1:bdbf36f8408d 182 #define PRESSURE_INT1_GPIO_CLK_DISABLE() __GPIOB_CLK_DISABLE()
julientiron 1:bdbf36f8408d 183 #define PRESSURE_INT1_PIN GPIO_PIN_4
julientiron 1:bdbf36f8408d 184 #define PRESSURE_INT1_EXTI_IRQn EXTI4_IRQn
julientiron 1:bdbf36f8408d 185
julientiron 1:bdbf36f8408d 186 // ready for use
julientiron 1:bdbf36f8408d 187 #define USER_INT_GPIO_PORT GPIOA
julientiron 1:bdbf36f8408d 188 #define USER_INT_GPIO_CLK_ENABLE() __GPIOA_CLK_ENABLE()
julientiron 1:bdbf36f8408d 189 #define USER_INT_GPIO_CLK_DISABLE() __GPIOA_CLK_DISABLE()
julientiron 1:bdbf36f8408d 190 #define USER_INT_PIN GPIO_PIN_10
julientiron 1:bdbf36f8408d 191 #define USER_INT_EXTI_IRQn EXTI15_10_IRQn
julientiron 1:bdbf36f8408d 192
julientiron 1:bdbf36f8408d 193 // ready for use
julientiron 1:bdbf36f8408d 194 #define MEMS_INT1_GPIO_PORT GPIOA
julientiron 1:bdbf36f8408d 195 #define MEMS_INT1_GPIO_CLK_ENABLE() __GPIOA_CLK_ENABLE()
julientiron 1:bdbf36f8408d 196 #define MEMS_INT1_GPIO_CLK_DISABLE() __GPIOA_CLK_DISABLE()
julientiron 1:bdbf36f8408d 197 #define MEMS_INT1_PIN GPIO_PIN_4
julientiron 1:bdbf36f8408d 198 #define MEMS_INT1_EXTI_IRQn EXTI4_IRQn
julientiron 1:bdbf36f8408d 199
julientiron 1:bdbf36f8408d 200 // ready for use
julientiron 1:bdbf36f8408d 201 #define MEMS_INT2_GPIO_PORT GPIOB
julientiron 1:bdbf36f8408d 202 #define MEMS_INT2_GPIO_CLK_ENABLE() __GPIOB_CLK_ENABLE()
julientiron 1:bdbf36f8408d 203 #define MEMS_INT2_GPIO_CLK_DISABLE() __GPIOB_CLK_DISABLE()
julientiron 1:bdbf36f8408d 204 #define MEMS_INT2_PIN GPIO_PIN_0
julientiron 1:bdbf36f8408d 205 #define MEMS_INT2_EXTI_IRQn EXTI0_IRQn
julientiron 1:bdbf36f8408d 206
julientiron 1:bdbf36f8408d 207
julientiron 1:bdbf36f8408d 208 /** @defgroup X_NUCLEO_IKS01A1_Exported_Macros
julientiron 1:bdbf36f8408d 209 * @{
julientiron 1:bdbf36f8408d 210 */
julientiron 1:bdbf36f8408d 211
julientiron 1:bdbf36f8408d 212 /**
julientiron 1:bdbf36f8408d 213 * @}
julientiron 1:bdbf36f8408d 214 */
julientiron 1:bdbf36f8408d 215
julientiron 1:bdbf36f8408d 216 /** @defgroup X_NUCLEO_IKS01A1_Exported_Functions
julientiron 1:bdbf36f8408d 217 * @{
julientiron 1:bdbf36f8408d 218 */
julientiron 1:bdbf36f8408d 219
julientiron 1:bdbf36f8408d 220
julientiron 1:bdbf36f8408d 221 /**
julientiron 1:bdbf36f8408d 222 * @}
julientiron 1:bdbf36f8408d 223 */
julientiron 1:bdbf36f8408d 224
julientiron 1:bdbf36f8408d 225 /**
julientiron 1:bdbf36f8408d 226 * @}
julientiron 1:bdbf36f8408d 227 */
julientiron 1:bdbf36f8408d 228
julientiron 1:bdbf36f8408d 229 /**
julientiron 1:bdbf36f8408d 230 * @}
julientiron 1:bdbf36f8408d 231 */
julientiron 1:bdbf36f8408d 232
julientiron 1:bdbf36f8408d 233 #ifdef __cplusplus
julientiron 1:bdbf36f8408d 234 }
julientiron 1:bdbf36f8408d 235 #endif
julientiron 1:bdbf36f8408d 236
julientiron 1:bdbf36f8408d 237 #endif /* __X_NUCLEO_IKS01A1_H */
julientiron 1:bdbf36f8408d 238
julientiron 1:bdbf36f8408d 239
julientiron 1:bdbf36f8408d 240
julientiron 1:bdbf36f8408d 241 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
julientiron 1:bdbf36f8408d 242