![]() |
Paparazzi UAS v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
|
Driver for the Invensense 456XY IMUs: More...
Go to the source code of this file.
Data Structures | |
struct | FIFODataHighRes |
struct | invensense3_456_spi_t |
struct | invensense3_456_t |
Macros | |
#define | INVENSENSE3_456_FIFO_BUFFER_LEN 22 |
#define | INVENSENSE3_456_BUFFER_SIZE INVENSENSE3_456_FIFO_BUFFER_LEN * sizeof(struct FIFODataHighRes) + 3 |
Enumerations | |
enum | invensense3_456_status_t { INVENSENSE3_456_IDLE , INVENSENSE3_456_CONFIG , INVENSENSE3_456_RUNNING } |
enum | invensense3_456_device_t { INVENSENSE3_456_UNKOWN , INVENSENSE3_456_ICM45686 } |
enum | invensense3_456_odr_t { INVENSENSE3_456_ODR_6_4KHZ = 0b0011 , INVENSENSE3_456_ODR_3_2KHZ = 0b0100 , INVENSENSE3_456_ODR_1_6KHZ = 0b0101 , INVENSENSE3_456_ODR_800HZ = 0b0110 , INVENSENSE3_456_ODR_400HZ = 0b0111 , INVENSENSE3_456_ODR_200HZ = 0b1000 , INVENSENSE3_456_ODR_100HZ = 0b1001 , INVENSENSE3_456_ODR_50HZ = 0b1010 , INVENSENSE3_456_ODR_25HZ = 0b1011 } |
Functions | |
void | invensense3_456_init (struct invensense3_456_t *inv) |
Initialize the invensense v3 sensor instance. | |
void | invensense3_456_periodic (struct invensense3_456_t *inv) |
Should be called periodically to request sensor readings. | |
void | invensense3_456_event (struct invensense3_456_t *inv) |
Should be called in the event thread. | |
Driver for the Invensense 456XY IMUs:
This driver is largely based on the original Invense v3 driver by Freek van Tienen, the Arupilot AP_InertialSensor_Invensensev3 with some inspiration from the px4 one as well. Split from the "main" invensensev3 driver as the WHO_AM_I register is different, and we operate this driver in high-resolution (20-bit) mode which is not used by any of the existing drivers. TL;DR: the drivers are quite different (even sensor ODR's), so we would be using if statements everywhere anyway. This seemed like the cleaner solution.
Definition in file invensense3_456.h.
struct FIFODataHighRes |
struct invensense3_456_spi_t |
Definition at line 59 of file invensense3_456.h.
Data Fields | ||
---|---|---|
struct spi_periph * | p | Peripheral device for communication. |
uint8_t | rx_buf[INVENSENSE3_456_BUFFER_SIZE] | Receive buffer. |
uint8_t | slave_idx | Slave index used for Slave Select. |
struct spi_transaction | trans | Transaction used during configuration and measurements. |
uint8_t | tx_buf[4] | Transmit buffer. |
struct invensense3_456_t |
Definition at line 99 of file invensense3_456.h.
Data Fields | ||
---|---|---|
uint8_t | abi_id | The ABI id used to broadcast the device measurements. |
uint8_t | config_idx | The current configuration index (used for setup/initial configuration) |
enum invensense3_456_device_t | device | The device type detected. |
enum invensense3_456_odr_t | imu_odr | Accelerometer / gyro Output Data Rate configuration. |
float | imu_samplerate | Sample rate in Hz from the imu_odr. |
uint8_t * | rx_buffer | |
uint16_t * | rx_length | |
int | sample_numbers | expected FIFO packet number, assuming reading at PERIODIC_FREQUENCY |
struct invensense3_456_spi_t | spi | SPI specific configuration (support SPI only for now) |
enum invensense3_456_status_t | status | Status of the invensense device. |
uint32_t | timer | Used to time operations during configuration (samples left during measuring) |
uint8_t * | tx_buffer |
#define INVENSENSE3_456_BUFFER_SIZE INVENSENSE3_456_FIFO_BUFFER_LEN * sizeof(struct FIFODataHighRes) + 3 |
Definition at line 45 of file invensense3_456.h.
#define INVENSENSE3_456_FIFO_BUFFER_LEN 22 |
Definition at line 44 of file invensense3_456.h.
Enumerator | |
---|---|
INVENSENSE3_456_UNKOWN | |
INVENSENSE3_456_ICM45686 |
Definition at line 75 of file invensense3_456.h.
Definition at line 82 of file invensense3_456.h.
Enumerator | |
---|---|
INVENSENSE3_456_IDLE | |
INVENSENSE3_456_CONFIG | |
INVENSENSE3_456_RUNNING |
Definition at line 69 of file invensense3_456.h.
void invensense3_456_event | ( | struct invensense3_456_t * | inv | ) |
Should be called in the event thread.
inv | The invensense v3 instance |
Definition at line 137 of file invensense3_456.c.
References foo, INV3_456_WHOAMI_ICM45686, INV3REG_456_FIFO_COUNTH, invensense3_456_config(), INVENSENSE3_456_CONFIG, INVENSENSE3_456_ICM45686, INVENSENSE3_456_IDLE, invensense3_456_parse_fifo_data(), invensense3_456_register_read(), INVENSENSE3_456_RUNNING, invensense3_456_set_scalings(), Min, n_samples, SPITransDone, SPITransFailed, and SPITransSuccess.
Referenced by imu_cube_event().
void invensense3_456_init | ( | struct invensense3_456_t * | inv | ) |
Initialize the invensense v3 sensor instance.
inv | The structure containing the configuration of the invensense v3 instance |
Definition at line 57 of file invensense3_456.c.
References foo, INVENSENSE3_456_IDLE, INVENSENSE3_456_UNKOWN, samples_from_odr(), SPICphaEdge2, SPICpolIdleHigh, SPIDiv16, SPIDss8bit, SPIMSBFirst, SPISelectUnselect, and SPITransDone.
Referenced by imu_cube_init().
void invensense3_456_periodic | ( | struct invensense3_456_t * | inv | ) |
Should be called periodically to request sensor readings.
inv | The invensense v3 instance |
Definition at line 95 of file invensense3_456.c.
References foo, INV3REG_456_FIFO_COUNTH, INV3REG_456_WHOAMI, invensense3_456_config(), INVENSENSE3_456_CONFIG, INVENSENSE3_456_IDLE, invensense3_456_register_read(), INVENSENSE3_456_RUNNING, Min, and SPITransDone.
Referenced by imu_cube_periodic().