33#include "generated/modules.h"
36#ifndef ASPIRIN_2_SPI_SLAVE_IDX
37#define ASPIRIN_2_SPI_SLAVE_IDX SPI_SLAVE2
41#ifndef ASPIRIN_2_SPI_DEV
42#define ASPIRIN_2_SPI_DEV spi2
47#if !defined ASPIRIN_2_LOWPASS_FILTER && !defined ASPIRIN_2_SMPLRT_DIV
48#if PERIODIC_FREQUENCY <= 120
52#define ASPIRIN_2_LOWPASS_FILTER MPU60X0_DLPF_42HZ
53#define ASPIRIN_2_SMPLRT_DIV 9
56#elif PERIODIC_FREQUENCY < 500
60#define ASPIRIN_2_LOWPASS_FILTER MPU60X0_DLPF_98HZ
61#define ASPIRIN_2_SMPLRT_DIV 1
68#define ASPIRIN_2_LOWPASS_FILTER MPU60X0_DLPF_256HZ
69#define ASPIRIN_2_SMPLRT_DIV 3
95#define HMC58XX_CRA ((HMC58XX_DO<<2)|(HMC58XX_MS))
96#define HMC58XX_CRB (HMC58XX_GN<<5)
99#ifndef ASPIRIN_2_MAG_STARTUP_DELAY
100#define ASPIRIN_2_MAG_STARTUP_DELAY 1.5
126#if !ASPIRIN_2_DISABLE_MAG
166#define Int16FromBuf(_buf,_idx) ((int16_t)((_buf[_idx]<<8) | _buf[_idx+1]))
174#if !ASPIRIN_2_DISABLE_MAG
186#ifdef LISA_S_UPSIDE_DOWN
195#if !ASPIRIN_2_DISABLE_MAG
201#if !ASPIRIN_2_DISABLE_MAG
210#ifdef LISA_M_OR_MX_21
219#if !ASPIRIN_2_DISABLE_MAG
225#ifdef LISA_M_LONGITUDINAL_X
234#if !ASPIRIN_2_DISABLE_MAG
240#if !ASPIRIN_2_DISABLE_MAG
251#if !ASPIRIN_2_DISABLE_MAG
260 mpu_set(mpu, _reg, _val);
Main include for ABI (AirBorneInterface).
uint32_t get_sys_time_usec(void)
Get the time in microseconds since startup.
#define RATES_COPY(_a, _b)
#define RATES_ASSIGN(_ra, _p, _q, _r)
#define VECT3_ASSIGN(_a, _x, _y, _z)
#define VECT3_COPY(_a, _b)
volatile uint8_t * input_buf
pointer to receive buffer for DMA
enum SPITransactionStatus status
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
SPI transaction structure.
Register defs for Honeywell HMC5843, HMC5883 and HMC5983 magnetometers.
#define HMC58XX_REG_DATXM
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 ASPIRIN_2_SPI_DEV
void imu_aspirin2_event(void)
#define ASPIRIN_2_SMPLRT_DIV
#define ASPIRIN_2_MAG_STARTUP_DELAY
delay in seconds before starting to configure HMC58xx mag slave
#define ASPIRIN_2_LOWPASS_FILTER
struct ImuAspirin2Spi imu_aspirin2
void mpu_wait_slave4_ready_cb(struct spi_transaction *t)
#define ASPIRIN_2_SPI_SLAVE_IDX
void imu_aspirin2_periodic(void)
void mpu_wait_slave4_ready(void)
void imu_aspirin2_init(void)
bool imu_aspirin2_configure_mag_slave(Mpu60x0ConfigSet mpu_set, void *mpu)
function to configure hmc5883 mag
#define Int16FromBuf(_buf, _idx)
static void mpu_set_and_wait(Mpu60x0ConfigSet mpu_set, void *mpu, uint8_t _reg, uint8_t _val)
Driver for the Aspirin v2.x IMU using SPI for the MPU6000.
#define ASPIRIN_2_GYRO_RANGE
#define ASPIRIN_2_ACCEL_RANGE
PRINT_CONFIG_MSG("USE_INS_NAV_INIT defaulting to TRUE")
const struct FloatVect3 MPU60X0_ACCEL_SENS_F[4]
const struct FloatRates MPU60X0_GYRO_SENS_F[4]
void(* Mpu60x0ConfigSet)(void *mpu, uint8_t _reg, uint8_t _val)
Configuration function prototype.
#define MPU60X0_I2C_SLV4_DONE
#define MPU60X0_REG_I2C_SLV0_ADDR
#define MPU60X0_REG_I2C_SLV4_REG
#define MPU60X0_REG_I2C_SLV4_CTRL
#define MPU60X0_REG_I2C_MST_STATUS
#define MPU60X0_REG_I2C_SLV0_REG
#define MPU60X0_REG_I2C_SLV0_CTRL
#define MPU60X0_REG_I2C_SLV4_ADDR
#define MPU60X0_REG_I2C_SLV4_DO
void mpu60x0_spi_event(struct Mpu60x0_Spi *mpu)
void mpu60x0_spi_init(struct Mpu60x0_Spi *mpu, struct spi_periph *spi_p, uint8_t slave_idx)
static void mpu60x0_spi_periodic(struct Mpu60x0_Spi *mpu)
convenience function: read or start configuration if not already initialized
PRINT_CONFIG_VAR(ONELOOP_ANDI_FILT_CUTOFF)
Architecture independent SPI (Serial Peripheral Interface) API.
Architecture independent timing functions.
static float get_sys_time_float(void)
Get the time in seconds since startup.
unsigned int uint32_t
Typedef defining 32 bit unsigned int type.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.