60 #define LSM9DS1_DEFAULT_MAG_SCALE LSM9DS1_MAG_8 61 #define LSM9DS1_DEFAULT_GYR_SCALE LSM9DS1_GYR_500 62 #define LSM9DS1_DEFAULT_ACC_SCALE LSM9DS1_ACC_4 63 #define LSM9DS1_DATA_RANGE 32767.0f 68 #define LSM9DS1_ACT_THS 0x04 69 #define LSM9DS1_ACT_DUR 0x05 70 #define LSM9DS1_INT_GEN_CFG_XL 0x06 71 #define LSM9DS1_INT_GEN_THS_X_XL 0x07 72 #define LSM9DS1_INT_GEN_THS_Y_XL 0x08 73 #define LSM9DS1_INT_GEN_THS_Z_XL 0x09 74 #define LSM9DS1_INT_GEN_DUR_XL 0x0A 75 #define LSM9DS1_REFERENCE_G 0x0B 76 #define LSM9DS1_INT1_CTRL 0x0C 77 #define LSM9DS1_INT2_CTRL 0x0D 78 #define LSM9DS1_WHO_AM_I_XG 0x0F 79 #define LSM9DS1_CTRL_REG1_G 0x10 80 #define LSM9DS1_CTRL_REG2_G 0x11 81 #define LSM9DS1_CTRL_REG3_G 0x12 82 #define LSM9DS1_ORIENT_CFG_G 0x13 83 #define LSM9DS1_INT_GEN_SRC_G 0x14 84 #define LSM9DS1_OUT_TEMP_L 0x15 85 #define LSM9DS1_OUT_TEMP_H 0x16 86 #define LSM9DS1_STATUS_REG_0 0x17 87 #define LSM9DS1_OUT_X_L_G 0x18 88 #define LSM9DS1_OUT_X_H_G 0x19 89 #define LSM9DS1_OUT_Y_L_G 0x1A 90 #define LSM9DS1_OUT_Y_H_G 0x1B 91 #define LSM9DS1_OUT_Z_L_G 0x1C 92 #define LSM9DS1_OUT_Z_H_G 0x1D 93 #define LSM9DS1_CTRL_REG4 0x1E 94 #define LSM9DS1_CTRL_REG5_XL 0x1F 95 #define LSM9DS1_CTRL_REG6_XL 0x20 96 #define LSM9DS1_CTRL_REG7_XL 0x21 97 #define LSM9DS1_CTRL_REG8 0x22 98 #define LSM9DS1_CTRL_REG9 0x23 99 #define LSM9DS1_CTRL_REG10 0x24 100 #define LSM9DS1_INT_GEN_SRC_XL 0x26 101 #define LSM9DS1_STATUS_REG_1 0x27 102 #define LSM9DS1_OUT_X_L_XL 0x28 103 #define LSM9DS1_OUT_X_H_XL 0x29 104 #define LSM9DS1_OUT_Y_L_XL 0x2A 105 #define LSM9DS1_OUT_Y_H_XL 0x2B 106 #define LSM9DS1_OUT_Z_L_XL 0x2C 107 #define LSM9DS1_OUT_Z_H_XL 0x2D 108 #define LSM9DS1_FIFO_CTRL 0x2E 109 #define LSM9DS1_FIFO_SRC 0x2F 110 #define LSM9DS1_INT_GEN_CFG_G 0x30 111 #define LSM9DS1_INT_GEN_THS_XH_G 0x31 112 #define LSM9DS1_INT_GEN_THS_XL_G 0x32 113 #define LSM9DS1_INT_GEN_THS_YH_G 0x33 114 #define LSM9DS1_INT_GEN_THS_YL_G 0x34 115 #define LSM9DS1_INT_GEN_THS_ZH_G 0x35 116 #define LSM9DS1_INT_GEN_THS_ZL_G 0x36 117 #define LSM9DS1_INT_GEN_DUR_G 0x37 120 #define LSM9DS1_OFFSET_X_REG_L_M 0x05 121 #define LSM9DS1_OFFSET_X_REG_H_M 0x06 122 #define LSM9DS1_OFFSET_Y_REG_L_M 0x07 123 #define LSM9DS1_OFFSET_Y_REG_H_M 0x08 124 #define LSM9DS1_OFFSET_Z_REG_L_M 0x09 125 #define LSM9DS1_OFFSET_Z_REG_H_M 0x0A 126 #define LSM9DS1_WHO_AM_I_M 0x0F 127 #define LSM9DS1_CTRL_REG1_M 0x20 128 #define LSM9DS1_CTRL_REG2_M 0x21 129 #define LSM9DS1_CTRL_REG3_M 0x22 130 #define LSM9DS1_CTRL_REG4_M 0x23 131 #define LSM9DS1_CTRL_REG5_M 0x24 132 #define LSM9DS1_STATUS_REG_M 0x27 133 #define LSM9DS1_OUT_X_L_M 0x28 134 #define LSM9DS1_OUT_X_H_M 0x29 135 #define LSM9DS1_OUT_Y_L_M 0x2A 136 #define LSM9DS1_OUT_Y_H_M 0x2B 137 #define LSM9DS1_OUT_Z_L_M 0x2C 138 #define LSM9DS1_OUT_Z_H_M 0x2D 139 #define LSM9DS1_INT_CFG_M 0x30 140 #define LSM9DS1_INT_SRC_M 0x31 141 #define LSM9DS1_INT_THS_L_M 0x32 142 #define LSM9DS1_INT_THS_H_M 0x33 207 uint32_t gx_pin, uint16_t m_port, uint32_t m_pin, uint8_t cs_pol);
uint16_t LSM9DS1_getGyrScale(LSM9DS1 *target)
Get the scale of the gyroscope.
void LSM9DS1_getMag(LSM9DS1 *target, int16_t *data)
Get the latest magnometer readings.
void LSM9DS1_setAccScale(LSM9DS1 *target, lsm9ds1_accScale scale)
Set the scale of the accelerometer.
uint32_t m_pin
The pin used for mag SPI chip select.
lsm9ds1_gyrScale
Available gyroscope ranges.
uint16_t LSM9DS1_readByte(LSM9DS1 *target, uint8_t component, uint8_t address)
Read a single byte from the device's register.
void LSM9DS1_writeByte(LSM9DS1 *target, uint8_t component, uint8_t address, uint8_t data)
Write a single byte to the device's register.
float LSM9DS1_getTemp(LSM9DS1 *target)
Get the latest accelerometer readings.
uint8_t LSM9DS1_gxWAI(LSM9DS1 *target)
Read the value for the gyro/accel who am I register.
+-2000 degrees / second range
uint16_t m_port
The port used for mag SPI chip select.
uint8_t port
The port the device is connected to.
Data structure containing variables specific to individual slave devices.
lsm9ds1_accScale
Available accelerometer ranges.
uint8_t LSM9DS1_getMagScale(LSM9DS1 *target)
Get the scale of the magnetometer.
uint8_t LSM9DS1_tempReady(LSM9DS1 *target)
Check if the temperature module has new data available.
lsm9ds1_magScale
Available magnetometer ranges.
uint8_t LSM9DS1_mWAI(LSM9DS1 *target)
Read the value for the magnetometer who am I register.
uint8_t LSM9DS1_gyrReady(LSM9DS1 *target)
Check if the gyroscope has new data available.
void LSM9DS1_setGyrScale(LSM9DS1 *target, lsm9ds1_gyrScale scale)
Set the scale of the gyroscope.
+-500 degrees / second range
uint8_t cs_pol
The polary of the SPI chip select line.
uint8_t LSM9DS1_getAccScale(LSM9DS1 *target)
Get the scale of the accelerometer.
+-245 degrees / second range
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.
void LSM9DS1_getAcc(LSM9DS1 *target, int16_t *data)
Get the latest accelerometer readings.
uint16_t gx_port
The port used for gyro/accel SPI chip select.
void LSM9DS1_getGyr(LSM9DS1 *target, int16_t *data)
Get the latest gyroscope readings.
uint8_t LSM9DS1_accReady(LSM9DS1 *target)
Check if the accelerometer has new data available.
uint32_t gx_pin
The pin used for gyro/accel SPI chip select.
uint8_t LSM9DS1_magReady(LSM9DS1 *target)
Check if the magnetometer has new data available.
void LSM9DS1_setMagScale(LSM9DS1 *target, lsm9ds1_magScale scale)
Set the scale of the magnetometer.