EFR32 Mighty Gecko 1 Software Documentation  efr32mg1-doc-5.1.2
icm20648.c File Reference

Detailed Description

Driver for the Invensense ICM20648 6-axis motion sensor.

Version
5.1.1

License

Copyright 2016 Silicon Laboratories, Inc. http://www.silabs.com

This file is licensed under the Silicon Labs License Agreement. See the file "Silabs_License_Agreement.txt" for details. Before using this software for any purpose, you must agree to the terms of that agreement.

Definition in file icm20648.c.

#include <stdint.h>
#include <stdio.h>
#include "em_usart.h"
#include "em_gpio.h"
#include "em_cmu.h"
#include "thunderboard/util.h"
#include "thunderboard/board.h"
#include "thunderboard/icm20648.h"

Go to the source code of this file.

Functions

uint32_t ICM20648_accelBandwidthSet (uint8_t accelBw)
 Sets the bandwidth of the accelerometer. More...
 
uint32_t ICM20648_accelDataRead (float *accel)
 Reads the raw acceleration value and converts to g value based on the actual resolution. More...
 
uint32_t ICM20648_accelFullscaleSet (uint8_t accelFs)
 Sets the full scale value of the accelerometer. More...
 
uint32_t ICM20648_accelGyroCalibrate (float *accelBiasScaled, float *gyroBiasScaled)
 Accelerometer and gyroscope calibration function. Reads the gyroscope and accelerometer values while the device is at rest and in level. The resulting values are loaded to the accel and gyro bias registers to cancel the static offset error. More...
 
uint32_t ICM20648_accelResolutionGet (float *accelRes)
 Gets the actual resolution of the accelerometer. More...
 
float ICM20648_accelSampleRateSet (float sampleRate)
 Sets the sample rate of the gyroscope. More...
 
void ICM20648_bankSelect (uint8_t bank)
 Select the desired register bank. More...
 
uint32_t ICM20648_cycleModeEnable (bool enable)
 Enables or disables the cycle mode operation of the accel and gyro. More...
 
uint32_t ICM20648_deInit (void)
 De-initializes the ICM20648 sensor by disconnecting the supply and SPI lines. More...
 
uint32_t ICM20648_getDeviceID (uint8_t *devID)
 Reads the device ID of the ICM20648. More...
 
uint32_t ICM20648_gyroBandwidthSet (uint8_t gyroBw)
 Sets the bandwidth of the gyroscope. More...
 
uint32_t ICM20648_gyroCalibrate (float *gyroBiasScaled)
 Gyroscope calibration function. Reads the gyroscope values while the device is at rest and in level. The resulting values are loaded to the gyro bias registers to cancel the static offset error. More...
 
uint32_t ICM20648_gyroDataRead (float *gyro)
 Reads the raw gyroscope value and converts to deg/sec value based on the actual resolution. More...
 
uint32_t ICM20648_gyroFullscaleSet (uint8_t gyroFs)
 Sets the full scale value of the gyroscope. More...
 
uint32_t ICM20648_gyroResolutionGet (float *gyroRes)
 Gets the actual resolution of the gyroscope. More...
 
float ICM20648_gyroSampleRateSet (float sampleRate)
 Sets the sample rate of the accelerometer. More...
 
uint32_t ICM20648_init (void)
 Initializes the ICM20648 sensor. Enables the power supply and SPI lines, sets up the host SPI controller, configures the chip control interface, clock generator and interrupt line. More...
 
uint32_t ICM20648_interruptEnable (bool dataReadyEnable, bool womEnable)
 Enables or disables the interrupts in the ICM20648 chip. More...
 
uint32_t ICM20648_interruptStatusRead (uint32_t *intStatus)
 Reads the interrupt status registers of the ICM20648 chip. More...
 
bool ICM20648_isDataReady (void)
 Checks if new data is available for read. More...
 
uint32_t ICM20648_lowPowerModeEnter (bool enAccel, bool enGyro, bool enTemp)
 Enables or disables the sensors in low power mode in the ICM20648 chip. More...
 
void ICM20648_registerRead (uint16_t addr, int numBytes, uint8_t *data)
 Reads register from the ICM20648 device. More...
 
void ICM20648_registerWrite (uint16_t addr, uint8_t data)
 Writes a register in the ICM20648 device. More...
 
uint32_t ICM20648_reset (void)
 Performs soft reset on the ICM20648 chip. More...
 
uint32_t ICM20648_sampleRateSet (float sampleRate)
 Sets the sample rate both of the accelerometer and the gyroscope. More...
 
uint32_t ICM20648_sensorEnable (bool accel, bool gyro, bool temp)
 Enables or disables the sensors in the ICM20648 chip. More...
 
uint32_t ICM20648_sleepModeEnable (bool enable)
 Enables or disables the sleep mode of the device. More...
 
uint32_t ICM20648_spiInit (void)
 Initializes the SPI bus in order to communicate with the ICM20648. More...
 
uint32_t ICM20648_temperatureRead (float *temperature)
 Reads the temperature sensor raw value and converts to Celsius. More...
 
uint32_t ICM20648_wakeOnMotionITEnable (bool enable, uint8_t womThreshold, float sampleRate)
 Sets up and enables the Wake-up On Motion feature. More...