Beta
Dependencies: ST_INTERFACES X_NUCLEO_COMMON
Fork of X_NUCLEO_IKS01A2 by
Diff: Components/LSM6DSLSensor/LSM6DSLSensor.h
- Revision:
- 6:671fd10a51b7
- Parent:
- 5:63b2b4c21092
- Child:
- 9:038121268b07
--- a/Components/LSM6DSLSensor/LSM6DSLSensor.h Thu Dec 15 14:03:46 2016 +0000 +++ b/Components/LSM6DSLSensor/LSM6DSLSensor.h Tue Mar 14 13:41:32 2017 +0100 @@ -46,7 +46,7 @@ /* Includes ------------------------------------------------------------------*/ #include "DevI2C.h" -#include "LSM6DSL_ACC_GYRO_driver.h" +#include "LSM6DSL_acc_gyro_driver.h" #include "MotionSensor.h" #include "GyroSensor.h" @@ -127,65 +127,65 @@ public: LSM6DSLSensor(DevI2C &i2c, PinName INT1_pin, PinName INT2_pin); LSM6DSLSensor(DevI2C &i2c, PinName INT1_pin, PinName INT2_pin, uint8_t address); - virtual int Init(void *init); - virtual int ReadID(uint8_t *id); - virtual int Get_X_Axes(int32_t *pData); - virtual int Get_G_Axes(int32_t *pData); - virtual int Get_X_Sensitivity(float *pfData); - virtual int Get_G_Sensitivity(float *pfData); - virtual int Get_X_AxesRaw(int16_t *pData); - virtual int Get_G_AxesRaw(int16_t *pData); - virtual int Get_X_ODR(float *odr); - virtual int Get_G_ODR(float *odr); - virtual int Set_X_ODR(float odr); - virtual int Set_G_ODR(float odr); - virtual int Get_X_FS(float *fullScale); - virtual int Get_G_FS(float *fullScale); - virtual int Set_X_FS(float fullScale); - virtual int Set_G_FS(float fullScale); - int Enable_X(void); - int Enable_G(void); - int Disable_X(void); - int Disable_G(void); - int Enable_Free_Fall_Detection(LSM6DSL_Interrupt_Pin_t pin = LSM6DSL_INT1_PIN); - int Disable_Free_Fall_Detection(void); - int Set_Free_Fall_Threshold(uint8_t thr); - int Enable_Pedometer(void); - int Disable_Pedometer(void); - int Get_Step_Counter(uint16_t *step_count); - int Reset_Step_Counter(void); - int Set_Pedometer_Threshold(uint8_t thr); - int Enable_Tilt_Detection(LSM6DSL_Interrupt_Pin_t pin = LSM6DSL_INT1_PIN); - int Disable_Tilt_Detection(void); - int Enable_Wake_Up_Detection(LSM6DSL_Interrupt_Pin_t pin = LSM6DSL_INT2_PIN); - int Disable_Wake_Up_Detection(void); - int Set_Wake_Up_Threshold(uint8_t thr); - int Enable_Single_Tap_Detection(LSM6DSL_Interrupt_Pin_t pin = LSM6DSL_INT1_PIN); - int Disable_Single_Tap_Detection(void); - int Enable_Double_Tap_Detection(LSM6DSL_Interrupt_Pin_t pin = LSM6DSL_INT1_PIN); - int Disable_Double_Tap_Detection(void); - int Set_Tap_Threshold(uint8_t thr); - int Set_Tap_Shock_Time(uint8_t time); - int Set_Tap_Quiet_Time(uint8_t time); - int Set_Tap_Duration_Time(uint8_t time); - int Enable_6D_Orientation(LSM6DSL_Interrupt_Pin_t pin = LSM6DSL_INT1_PIN); - int Disable_6D_Orientation(void); - int Get_6D_Orientation_XL(uint8_t *xl); - int Get_6D_Orientation_XH(uint8_t *xh); - int Get_6D_Orientation_YL(uint8_t *yl); - int Get_6D_Orientation_YH(uint8_t *yh); - int Get_6D_Orientation_ZL(uint8_t *zl); - int Get_6D_Orientation_ZH(uint8_t *zh); - int Get_Event_Status(LSM6DSL_Event_Status_t *status); - int ReadReg(uint8_t reg, uint8_t *data); - int WriteReg(uint8_t reg, uint8_t data); + virtual int init(void *init); + virtual int read_id(uint8_t *id); + virtual int get_x_axes(int32_t *pData); + virtual int get_g_axes(int32_t *pData); + virtual int get_x_sensitivity(float *pfData); + virtual int get_g_sensitivity(float *pfData); + virtual int get_x_axesRaw(int16_t *pData); + virtual int get_g_axesRaw(int16_t *pData); + virtual int get_x_odr(float *odr); + virtual int get_g_odr(float *odr); + virtual int set_x_odr(float odr); + virtual int set_g_odr(float odr); + virtual int get_x_fs(float *fullScale); + virtual int get_g_fs(float *fullScale); + virtual int set_x_fs(float fullScale); + virtual int set_g_fs(float fullScale); + int enable_x(void); + int enable_g(void); + int disable_x(void); + int disable_g(void); + int enable_free_fall_detection(LSM6DSL_Interrupt_Pin_t pin = LSM6DSL_INT1_PIN); + int disable_free_fall_detection(void); + int set_free_fall_threshold(uint8_t thr); + int enable_pedometer(void); + int disable_pedometer(void); + int get_step_counter(uint16_t *step_count); + int reset_step_counter(void); + int set_pedometer_threshold(uint8_t thr); + int enable_tilt_detection(LSM6DSL_Interrupt_Pin_t pin = LSM6DSL_INT1_PIN); + int disable_tilt_detection(void); + int enable_wake_up_detection(LSM6DSL_Interrupt_Pin_t pin = LSM6DSL_INT2_PIN); + int disable_wake_up_detection(void); + int set_wake_up_threshold(uint8_t thr); + int enable_single_tap_detection(LSM6DSL_Interrupt_Pin_t pin = LSM6DSL_INT1_PIN); + int disable_single_tap_detection(void); + int enable_double_tap_detection(LSM6DSL_Interrupt_Pin_t pin = LSM6DSL_INT1_PIN); + int disable_double_tap_detection(void); + int set_tap_threshold(uint8_t thr); + int set_tap_shock_time(uint8_t time); + int set_tap_quiet_time(uint8_t time); + int set_tap_duration_time(uint8_t time); + int enable_6d_orientation(LSM6DSL_Interrupt_Pin_t pin = LSM6DSL_INT1_PIN); + int disable_6d_orientation(void); + int get_6d_orientation_xl(uint8_t *xl); + int get_6d_orientation_xh(uint8_t *xh); + int get_6d_orientation_yl(uint8_t *yl); + int get_6d_orientation_yh(uint8_t *yh); + int get_6d_orientation_zl(uint8_t *zl); + int get_6d_orientation_zh(uint8_t *zh); + int get_event_status(LSM6DSL_Event_Status_t *status); + int read_reg(uint8_t reg, uint8_t *data); + int write_reg(uint8_t reg, uint8_t data); /** * @brief Attaching an interrupt handler to the INT1 interrupt. * @param fptr An interrupt handler. * @retval None. */ - void AttachINT1IRQ(void (*fptr)(void)) + void attach_int1_irq(void (*fptr)(void)) { INT1_irq.rise(fptr); } @@ -195,7 +195,7 @@ * @param None. * @retval None. */ - void EnableINT1IRQ(void) + void enable_int1_irq(void) { INT1_irq.enable_irq(); } @@ -205,7 +205,7 @@ * @param None. * @retval None. */ - void DisableINT1IRQ(void) + void disable_int1_irq(void) { INT1_irq.disable_irq(); } @@ -215,7 +215,7 @@ * @param fptr An interrupt handler. * @retval None. */ - void AttachINT2IRQ(void (*fptr)(void)) + void attach_int2_irq(void (*fptr)(void)) { INT2_irq.rise(fptr); } @@ -225,7 +225,7 @@ * @param None. * @retval None. */ - void EnableINT2IRQ(void) + void enable_int2_irq(void) { INT2_irq.enable_irq(); } @@ -235,7 +235,7 @@ * @param None. * @retval None. */ - void DisableINT2IRQ(void) + void disable_int2_irq(void) { INT2_irq.disable_irq(); } @@ -247,7 +247,7 @@ * @param NumByteToRead: number of bytes to be read. * @retval 0 if ok, an error code otherwise. */ - uint8_t IO_Read(uint8_t* pBuffer, uint8_t RegisterAddr, uint16_t NumByteToRead) + uint8_t io_read(uint8_t* pBuffer, uint8_t RegisterAddr, uint16_t NumByteToRead) { return (uint8_t) dev_i2c.i2c_read(pBuffer, address, RegisterAddr, NumByteToRead); } @@ -259,16 +259,16 @@ * @param NumByteToWrite: number of bytes to write. * @retval 0 if ok, an error code otherwise. */ - uint8_t IO_Write(uint8_t* pBuffer, uint8_t RegisterAddr, uint16_t NumByteToWrite) + uint8_t io_write(uint8_t* pBuffer, uint8_t RegisterAddr, uint16_t NumByteToWrite) { return (uint8_t) dev_i2c.i2c_write(pBuffer, address, RegisterAddr, NumByteToWrite); } private: - int Set_X_ODR_When_Enabled(float odr); - int Set_G_ODR_When_Enabled(float odr); - int Set_X_ODR_When_Disabled(float odr); - int Set_G_ODR_When_Disabled(float odr); + int set_x_odr_when_enabled(float odr); + int set_g_odr_when_enabled(float odr); + int set_x_odr_when_disabled(float odr); + int set_g_odr_when_disabled(float odr); /* Helper classes. */ DevI2C &dev_i2c; @@ -288,8 +288,8 @@ #ifdef __cplusplus extern "C" { #endif -uint8_t LSM6DSL_IO_Write( void *handle, uint8_t WriteAddr, uint8_t *pBuffer, uint16_t nBytesToWrite ); -uint8_t LSM6DSL_IO_Read( void *handle, uint8_t ReadAddr, uint8_t *pBuffer, uint16_t nBytesToRead ); +uint8_t LSM6DSL_io_write( void *handle, uint8_t WriteAddr, uint8_t *pBuffer, uint16_t nBytesToWrite ); +uint8_t LSM6DSL_io_read( void *handle, uint8_t ReadAddr, uint8_t *pBuffer, uint16_t nBytesToRead ); #ifdef __cplusplus } #endif