98 #define Int16FromBuf(_buf,_idx) ((int16_t)((_buf[_idx]<<8) | _buf[_idx+1]))
107 if (bit_is_set(mpu->
rx_buf[1], 0)) {
121 #pragma GCC diagnostic push
122 #pragma GCC diagnostic ignored "-Wcast-qual"
124 #pragma GCC diagnostic pop
enum Mpu9250MstClk i2c_mst_clk
MPU I2C master clock speed.
enum SPIClockPolarity cpol
clock polarity control
Mpu9250I2cSlaveConfigure configure
enum SPIClockDiv cdiv
prescaler of main clock to use as SPI clock
volatile uint8_t tx_buf[2]
#define MPU9250_REG_INT_STATUS
uint16_t output_length
number of data words to write
enum Mpu9250ConfStatus init_status
init status
uint8_t nb_bytes
number of bytes to read starting with MPU9250_REG_INT_STATUS
#define MPU9250_BUFFER_LEN
volatile bool_t data_available
data ready flag
union Mpu9250_Spi::@47 data_accel
enum SPIBitOrder bitorder
MSB/LSB order.
volatile uint8_t * output_buf
pointer to transmit buffer for DMA
enum SPISlaveSelect select
slave selection behavior
bool_t mpu9250_configure_i2c_slaves(Mpu9250ConfigSet mpu_set, void *mpu)
Configure I2C slaves of the MPU.
void mpu9250_spi_event(struct Mpu9250_Spi *mpu)
union Mpu9250_Spi::@48 data_rates
struct Mpu9250I2cSlave slaves[5]
I2C slaves.
enum SPIClockPhase cpha
clock phase control
Driver for the MPU-9250 using SPI.
SPI peripheral structure.
enum Mpu9250SpiSlaveInitStatus slave_init_status
bool_t spi_submit(struct spi_periph *p, struct spi_transaction *t)
Submit a spi transaction.
void mpu9250_send_config(Mpu9250ConfigSet mpu_set, void *mpu, struct Mpu9250Config *config)
Configuration sequence called once before normal use.
void mpu9250_spi_init(struct Mpu9250_Spi *mpu, struct spi_periph *spi_p, uint8_t slave_idx)
#define MPU9250_REG_I2C_MST_CTRL
SPICallback after_cb
NULL or function called after the transaction.
void(* Mpu9250ConfigSet)(void *mpu, uint8_t _reg, uint8_t _val)
Configuration function prototype.
uint8_t data_ext[MPU9250_BUFFER_EXT_LEN]
void mpu9250_set_default_config(struct Mpu9250Config *c)
uint8_t nb_slaves
number of used I2C slaves
#define MPU9250_I2C_IF_DIS
struct Mpu9250Config config
uint16_t input_length
number of data words to read
struct spi_periph * spi_p
#define MPU9250_REG_I2C_MST_DELAY
bool_t initialized
config done flag
#define MPU9250_REG_USER_CTRL
#define MPU9250_I2C_MST_EN
static void mpu9250_spi_write_to_reg(void *mpu, uint8_t _reg, uint8_t _val)
void mpu9250_spi_read(struct Mpu9250_Spi *mpu)
slave is selected before transaction and unselected after
enum SPIDataSizeSelect dss
data transfer word size
uint8_t slave_idx
slave id: SPI_SLAVE0 to SPI_SLAVE4
volatile uint8_t * input_buf
pointer to receive buffer for DMA
SPICallback before_cb
NULL or function called before the transaction.
#define Int16FromBuf(_buf, _idx)
struct spi_transaction spi_trans
volatile uint8_t rx_buf[MPU9250_BUFFER_LEN]
uint8_t i2c_mst_delay
MPU I2C slaves delayed sample rate.
enum SPITransactionStatus status
void mpu9250_spi_start_configure(struct Mpu9250_Spi *mpu)