36#include "mcu_periph/gpio_arch.h"
71 inv->spi.trans.slave_idx =
inv->spi.slave_idx;
72 inv->spi.trans.output_length = 0;
73 inv->spi.trans.input_length = 0;
74 inv->spi.trans.before_cb =
NULL;
76 inv->spi.trans.input_buf =
inv->spi.rx_buf;
77 inv->spi.trans.output_buf =
inv->spi.tx_buf;
80 inv->rx_buffer =
inv->spi.rx_buf;
81 inv->tx_buffer =
inv->spi.tx_buf;
82 inv->rx_length = &
inv->spi.trans.input_length;
145 switch(
inv->status) {
187 if(*
inv->rx_length > 3) {
207 switch(
inv->status) {
259 if ((d->
header & 0xFC) != 0x78) {
298 switch (
inv->imu_odr) {
300 inv->imu_samplerate = 6400;
303 inv->imu_samplerate = 3200;
306 inv->imu_samplerate = 1600;
309 inv->imu_samplerate = 800;
312 inv->imu_samplerate = 400;
315 inv->imu_samplerate = 200;
318 inv->imu_samplerate = 100;
321 inv->imu_samplerate = 50;
324 inv->imu_samplerate = 25;
328 inv->imu_samplerate = 0;
351 inv->tx_buffer[0] = reg;
352 inv->tx_buffer[1] = value;
355 inv->spi.trans.output_length = 2;
356 inv->spi.trans.input_length = 0;
380 inv->spi.trans.output_length = 4;
381 inv->spi.trans.input_length = 0;
399 inv->spi.trans.output_length = 2;
400 inv->spi.trans.input_length = 1 + size;
401 inv->tx_buffer[1] = 0;
416 switch(
inv->config_idx) {
Main include for ABI (AirBorneInterface).
uint32_t get_sys_time_usec(void)
Get the time in microseconds since startup.
#define ACCEL_BFP_OF_REAL(_af)
#define RATE_BFP_OF_REAL(_af)
bool spi_submit(struct spi_periph *p, struct spi_transaction *t)
Submit SPI transaction.
@ SPICpolIdleHigh
CPOL = 1.
@ SPISelectUnselect
slave is selected before transaction and unselected after
void imu_set_defaults_gyro(uint8_t abi_id, const struct Int32RMat *imu_to_sensor, const struct Int32Rates *neutral, const struct FloatRates *scale_f)
Set the defaults for a gyro sensor WARNING: Should be called before sensor is publishing messages to ...
void imu_set_defaults_accel(uint8_t abi_id, const struct Int32RMat *imu_to_sensor, const struct Int32Vect3 *neutral, const struct FloatVect3 *scale_f)
Set the defaults for a accel sensor WARNING: Should be called before sensor is publishing messages to...
Inertial Measurement Unit interface.
#define GYRO_FS_SEL_SHIFT
#define ACCEL_FS_SEL_SHIFT
void invensense3_456_init(struct invensense3_456_t *inv)
Initialize the invensense v3 sensor instance.
static int samples_from_odr(int odr)
static bool invensense3_456_register_read(struct invensense3_456_t *inv, uint8_t reg, uint16_t size)
Read a register based on a combined bank/regsiter value.
static bool invensense3_456_register_write(struct invensense3_456_t *inv, uint8_t reg, uint8_t value)
Write a register.
static void invensense3_456_parse_fifo_data(struct invensense3_456_t *inv, uint8_t *data, uint16_t samples)
Parse the FIFO buffer data.
static bool invensense3_register_write_bank(struct invensense3_456_t *inv, uint16_t bank_addr, uint16_t reg, uint8_t val)
Write to a register in a specific bank.
static bool invensense3_456_config(struct invensense3_456_t *inv)
Configure the Invensense 3 device register by register.
void invensense3_456_event(struct invensense3_456_t *inv)
Should be called in the event thread.
static int32_t reassemble_uint20(uint8_t msb, uint8_t bits, uint8_t lsb)
static void invensense3_456_set_scalings(struct invensense3_456_t *inv)
This sets the correct scalings.
void invensense3_456_periodic(struct invensense3_456_t *inv)
Should be called periodically to request sensor readings.
Driver for the Invensense 456XY IMUs:
@ INVENSENSE3_456_RUNNING
@ INVENSENSE3_456_ICM45686
#define INVENSENSE3_456_FIFO_BUFFER_LEN
@ INVENSENSE3_456_ODR_100HZ
@ INVENSENSE3_456_ODR_6_4KHZ
@ INVENSENSE3_456_ODR_50HZ
@ INVENSENSE3_456_ODR_800HZ
@ INVENSENSE3_456_ODR_25HZ
@ INVENSENSE3_456_ODR_3_2KHZ
@ INVENSENSE3_456_ODR_1_6KHZ
@ INVENSENSE3_456_ODR_400HZ
@ INVENSENSE3_456_ODR_200HZ
Register and address definitions for the Invensense V3 ICM456xy sensors from ardupilot.
#define INV3REG_456_REG_MISC2
#define INV3REG_456_WHOAMI
#define INV3REG_456_IREG_ADDRH
#define INV3BANK_456_IPREG_TOP1_ADDR
#define INV_456_BASE_FIFO3_CONFIG_VALUE
#define INV3REG_456_GYRO_CONFIG0
#define INV3REG_456_FIFO_CONFIG0
#define INV3BANK_456_IPREG_SYS2_ADDR
#define INV3REG_456_PWR_MGMT0
#define INV_456_FIFO_IF_EN
#define INV3_456_WHOAMI_ICM45686
#define INV3REG_456_FIFO_COUNTH
#define INV3BANK_456_IPREG_SYS1_ADDR
#define INV3_456_READ_FLAG
#define INV3REG_456_FIFO_CONFIG3
#define INV3REG_456_ACCEL_CONFIG0
Paparazzi floating point algebra.
Paparazzi fixed point algebra.
Paparazzi atmospheric pressure conversion utilities.
Periodic telemetry system header (includes downlink utility and generated code).
unsigned short uint16_t
Typedef defining 16 bit unsigned short type.
int int32_t
Typedef defining 32 bit int type.
unsigned int uint32_t
Typedef defining 32 bit unsigned int type.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.