GlobLib
HAL and API libraries for MCUs and hardware.
lsm9ds1.h File Reference

Header file for STMicroelectronics LSM9DS1 9DOF IMU. More...

#include <stdio.h>

Go to the source code of this file.

Data Structures

struct  LSM9DS1
 Data structure containing variables specific to individual slave devices. More...
 

Macros

#define LSM9DS1_DEFAULT_MAG_SCALE   LSM9DS1_MAG_8
 Default mag range set by LSM9DS1_setup()
 
#define LSM9DS1_DEFAULT_GYR_SCALE   LSM9DS1_GYR_500
 Default mag range set by LSM9DS1_setup()
 
#define LSM9DS1_DEFAULT_ACC_SCALE   LSM9DS1_ACC_4
 Default mag range set by LSM9DS1_setup()
 
#define LSM9DS1_DATA_RANGE   32767.0f
 Data range for each axis.
 
#define LSM9DS1_GX   0
 Used by read and write function to select gyro/accel.
 
#define LSM9DS1_M   1
 Used by read/write functions to select mag.
 

Enumerations

Functions

void LSM9DS1_setup (LSM9DS1 *target, uint8_t spiPort, uint16_t gx_port, uint32_t gx_pin, uint16_t m_port, uint32_t m_pin, uint8_t cs_pol)
 Initalizes the slave device and populates data structure variable. More...
 
uint8_t LSM9DS1_magReady (LSM9DS1 *target)
 Check if the magnetometer has new data available. More...
 
void LSM9DS1_getMag (LSM9DS1 *target, int16_t *data)
 Get the latest magnometer readings. More...
 
uint8_t LSM9DS1_gyrReady (LSM9DS1 *target)
 Check if the gyroscope has new data available. More...
 
void LSM9DS1_getGyr (LSM9DS1 *target, int16_t *data)
 Get the latest gyroscope readings. More...
 
uint8_t LSM9DS1_accReady (LSM9DS1 *target)
 Check if the accelerometer has new data available. More...
 
void LSM9DS1_getAcc (LSM9DS1 *target, int16_t *data)
 Get the latest accelerometer readings. More...
 
uint8_t LSM9DS1_tempReady (LSM9DS1 *target)
 Check if the temperature module has new data available. More...
 
float LSM9DS1_getTemp (LSM9DS1 *target)
 Get the latest accelerometer readings. More...
 
uint8_t LSM9DS1_gxWAI (LSM9DS1 *target)
 Read the value for the gyro/accel who am I register. More...
 
uint8_t LSM9DS1_mWAI (LSM9DS1 *target)
 Read the value for the magnetometer who am I register. More...
 
void LSM9DS1_setMagScale (LSM9DS1 *target, lsm9ds1_magScale scale)
 Set the scale of the magnetometer. More...
 
void LSM9DS1_setAccScale (LSM9DS1 *target, lsm9ds1_accScale scale)
 Set the scale of the accelerometer. More...
 
void LSM9DS1_setGyrScale (LSM9DS1 *target, lsm9ds1_gyrScale scale)
 Set the scale of the gyroscope. More...
 
uint8_t LSM9DS1_getMagScale (LSM9DS1 *target)
 Get the scale of the magnetometer. More...
 
uint8_t LSM9DS1_getAccScale (LSM9DS1 *target)
 Get the scale of the accelerometer. More...
 
uint16_t LSM9DS1_getGyrScale (LSM9DS1 *target)
 Get the scale of the gyroscope. More...
 
void LSM9DS1_writeByte (LSM9DS1 *target, uint8_t component, uint8_t address, uint8_t data)
 Write a single byte to the device's register. More...
 
uint16_t LSM9DS1_readByte (LSM9DS1 *target, uint8_t component, uint8_t address)
 Read a single byte from the device's register. More...
 

Detailed Description

Header file for STMicroelectronics LSM9DS1 9DOF IMU.

Definition in file lsm9ds1.h.