107 #define Int16FromBuf(_buf,_idx) ((int16_t)((_buf[_idx]<<8) | _buf[_idx+1]))
116 if (bit_is_set(mpu->
rx_buf[1], 0)) {
130 #pragma GCC diagnostic push
131 #pragma GCC diagnostic ignored "-Wcast-qual"
133 #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
bool spi_submit(struct spi_periph *p, struct spi_transaction *t)
Submit SPI transaction.
enum SPIBitOrder bitorder
MSB/LSB order.
bool mpu9250_configure_i2c_slaves(Mpu9250ConfigSet mpu_set, void *mpu)
configure the registered I2C slaves
volatile uint8_t * output_buf
pointer to transmit buffer for DMA
enum SPISlaveSelect select
slave selection behavior
void mpu9250_spi_event(struct Mpu9250_Spi *mpu)
enum SPIClockPhase cpha
clock phase control
Driver for the MPU-9250 using SPI.
SPI peripheral structure.
enum Mpu9250SpiSlaveInitStatus slave_init_status
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
#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)
struct Mpu9250I2cSlave slaves[MPU9250_I2C_NB_SLAVES]
I2C slaves.
void mpu9250_spi_read(struct Mpu9250_Spi *mpu)
slave is selected before transaction and unselected after
volatile bool data_available
data ready flag
uint8_t nb_slave_init
number of already configured/initialized slaves
enum SPIDataSizeSelect dss
data transfer word size
#define MPU9250_I2C_NB_SLAVES
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.
union Mpu9250_Spi::@335 data_accel
#define MPU9250_REG_WHO_AM_I
bool initialized
config done flag
#define Int16FromBuf(_buf, _idx)
struct spi_transaction spi_trans
#define MPU9250_WHOAMI_REPLY
volatile uint8_t rx_buf[MPU9250_BUFFER_LEN]
union Mpu9250_Spi::@336 data_rates
uint8_t i2c_mst_delay
MPU I2C slaves delayed sample rate.
enum SPITransactionStatus status
void mpu9250_spi_start_configure(struct Mpu9250_Spi *mpu)