| BlueNRG-1 SDK drivers APIs

- Main Page
- Modules
- Classes
- Files

- File List
- File Members

lsm6ds3_hal.h
Go to the documentation of this file.
1
24 /* Define to prevent recursive inclusion -------------------------------------*/
25 #ifndef __LSM6DS3_HAL_H
26 #define __LSM6DS3_HAL_H
27
28 /* Includes ------------------------------------------------------------------*/
29 #include "SDK_EVAL_SPI.h"
30 #include "LSM6DS3.h"
31
32
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36
37
38
74 #define LSM6DS3_IRQ_PIN SDK_EVAL_IRQ_SENSOR_PIN
75 #define LSM6DS3_SPI_FREQUENCY (8000000)
76
87 #ifdef BLUENRG1_SPI_DMA
88
89 #define LSM6DS3_IO_Init() (IMU_6AXES_StatusTypeDef)SdkEvalSpiDmaInit(LSM6DS3_SPI_FREQUENCY)
90 #define LSM6DS3_IO_Write(pBuffer, DeviceAddr, RegisterAddr, NumByteToWrite) (IMU_6AXES_StatusTypeDef)SdkEvalSpiDmaWrite(pBuffer, RegisterAddr, NumByteToWrite)
91 #define LSM6DS3_IO_Read(pBuffer, DeviceAddr, RegisterAddr, NumByteToRead) (IMU_6AXES_StatusTypeDef)SdkEvalSpiDmaRead(pBuffer, RegisterAddr, NumByteToRead)
92
93 #else
94 #ifdef BLUENRG1_SPI_IRQ
95
96 #define LSM6DS3_IO_Init() (IMU_6AXES_StatusTypeDef)SdkEvalSpiIrqInit(LSM6DS3_SPI_FREQUENCY)
97 #define LSM6DS3_IO_Write(pBuffer, DeviceAddr, RegisterAddr, NumByteToWrite) (IMU_6AXES_StatusTypeDef)SdkEvalSpiIrqWrite(pBuffer, RegisterAddr, NumByteToWrite)
98 #define LSM6DS3_IO_Read(pBuffer, DeviceAddr, RegisterAddr, NumByteToRead) (IMU_6AXES_StatusTypeDef)SdkEvalSpiIrqRead(pBuffer, RegisterAddr, NumByteToRead)
99
100 #else /* BLUENRG1_SPI_POLL */
101
102 #define LSM6DS3_IO_Init() (IMU_6AXES_StatusTypeDef)SdkEvalSpiInit(LSM6DS3_SPI_FREQUENCY)
103 #define LSM6DS3_IO_Write(pBuffer, DeviceAddr, RegisterAddr, NumByteToWrite) (IMU_6AXES_StatusTypeDef)SdkEvalSpiWrite(pBuffer, RegisterAddr, NumByteToWrite)
104 #define LSM6DS3_IO_Read(pBuffer, DeviceAddr, RegisterAddr, NumByteToRead) (IMU_6AXES_StatusTypeDef)SdkEvalSpiRead(pBuffer, RegisterAddr, NumByteToRead)
105
106 #endif /* BLUENRG1_SPI_IRQ */
107 #endif /* BLUENRG1_SPI_DMA */
108
109 /* Configures IRQ pin */
110 #define LSM6DS3_IO_ITConfig() {SysCtrl_PeripheralClockCmd(CLOCK_PERIPH_GPIO, ENABLE); \
111 GPIO_Init(&(GPIO_InitType){LSM6DS3_IRQ_PIN, GPIO_Input, DISABLE, DISABLE}); \
112 NVIC_Init(&(NVIC_InitType){GPIO_IRQn, LOW_PRIORITY, ENABLE}); \
113 GPIO_EXTIConfig(&(GPIO_EXTIConfigType){LSM6DS3_IRQ_PIN, GPIO_IrqSense_Edge, IRQ_ON_FALLING_EDGE}); \
114 GPIO_ClearITPendingBit(LSM6DS3_IRQ_PIN); \
115 GPIO_EXTICmd(LSM6DS3_IRQ_PIN, ENABLE);}
116
138 #ifdef __cplusplus
139 }
140 #endif
141
142 #endif
143
144 /******************* (C) COPYRIGHT 2015 STMicroelectronics *****END OF FILE****/
SDK_EVAL_SPI.h
This file provides all the low level API to manage SPI interface for eval board.
lsm6ds3.h
This file contains definitions for the lsm6ds3.c firmware driver.