41static int16_t gs_accel_raw[128][3];
42static float gs_accel_g[128][3];
43static int16_t gs_gyro_raw[128][3];
44static float gs_gyro_dps[128][3];
45static int32_t gs_quat[128][4];
46static float gs_pitch[128];
47static float gs_roll[128];
48static float gs_yaw[128];
49static volatile uint8_t gs_flag;
75static void a_receive_callback(uint8_t type)
121static void a_dmp_tap_callback(uint8_t count, uint8_t direction)
181static void a_dmp_orient_callback(uint8_t orientation)
244 int32_t gyro_offset_raw[3];
245 int32_t accel_offset_raw[3];
246 int32_t gyro_offset[3];
247 int32_t accel_offset[3];
250 int8_t gyro_orientation[9] = {1, 0, 0,
1437 gyro_offset, accel_offset);
1492 for (i = 0; i < 1000; i++)
1499 gs_accel_raw, gs_accel_g,
1500 gs_gyro_raw, gs_gyro_dps,
1502 gs_pitch, gs_roll, gs_yaw,
1513 if ((gs_flag & 0x7) == 0x7)
driver mpu9250 dmp tap orient motion test header file
uint8_t mpu9250_set_accelerometer_low_pass_filter(mpu9250_handle_t *handle, mpu9250_accelerometer_low_pass_filter_t filter)
set the accelerometer low pass filter
uint8_t mpu9250_set_wake_on_motion(mpu9250_handle_t *handle, mpu9250_bool_t enable)
enable or disable wake on motion
uint8_t mpu9250_set_accel_compare_with_previous_sample(mpu9250_handle_t *handle, mpu9250_bool_t enable)
enable or disable accel compare with previous sample
uint8_t mpu9250_set_fifo_mode(mpu9250_handle_t *handle, mpu9250_fifo_mode mode)
set the fifo mode
uint8_t mpu9250_self_test(mpu9250_handle_t *handle, int32_t gyro_offset_raw[3], int32_t accel_offset_raw[3])
run the self test
uint8_t mpu9250_set_addr_pin(mpu9250_handle_t *handle, mpu9250_address_t addr_pin)
set the chip address pin
uint8_t mpu9250_set_ptat(mpu9250_handle_t *handle, mpu9250_bool_t enable)
enable or disable the temperature sensor
uint8_t mpu9250_set_fifo_enable(mpu9250_handle_t *handle, mpu9250_fifo_t fifo, mpu9250_bool_t enable)
enable or disable the fifo function
uint8_t mpu9250_set_standby_mode(mpu9250_handle_t *handle, mpu9250_source_t source, mpu9250_bool_t enable)
set source into standby mode
uint8_t mpu9250_set_cycle_wake_up(mpu9250_handle_t *handle, mpu9250_bool_t enable)
enable or disable the cycle wake up mode
uint8_t mpu9250_set_interrupt_latch(mpu9250_handle_t *handle, mpu9250_bool_t enable)
enable or disable the interrupt latch
uint8_t mpu9250_set_extern_sync(mpu9250_handle_t *handle, mpu9250_extern_sync_t sync)
set the extern sync type
uint8_t mpu9250_set_gyro_standby(mpu9250_handle_t *handle, mpu9250_bool_t enable)
enable or disable the gyro standby
mpu9250_address_t
mpu9250 address enumeration definition
uint8_t mpu9250_set_fsync_interrupt(mpu9250_handle_t *handle, mpu9250_bool_t enable)
enable or disable the fsync interrupt
uint8_t mpu9250_set_iic_bypass(mpu9250_handle_t *handle, mpu9250_bool_t enable)
enable or disable the iic bypass
uint8_t mpu9250_info(mpu9250_info_t *info)
get the chip's information
uint8_t mpu9250_set_accelerometer_test(mpu9250_handle_t *handle, mpu9250_axis_t axis, mpu9250_bool_t enable)
set the accelerometer test
uint8_t mpu9250_set_interrupt_level(mpu9250_handle_t *handle, mpu9250_pin_level_t level)
set the interrupt level
uint8_t mpu9250_set_interrupt_read_clear(mpu9250_handle_t *handle, mpu9250_bool_t enable)
enable or disable the interrupt reading clear
uint8_t mpu9250_set_interface(mpu9250_handle_t *handle, mpu9250_interface_t interface)
set the chip interface
uint8_t mpu9250_irq_handler(mpu9250_handle_t *handle)
irq handler
struct mpu9250_info_s mpu9250_info_t
mpu9250 information structure definition
mpu9250_interface_t
mpu9250 interface enumeration definition
mpu9250_bool_t
mpu9250 bool enumeration definition
uint8_t mpu9250_set_interrupt(mpu9250_handle_t *handle, mpu9250_interrupt_t type, mpu9250_bool_t enable)
enable or disable the interrupt
uint8_t mpu9250_set_motion_threshold(mpu9250_handle_t *handle, uint8_t threshold)
set the motion_threshold
uint8_t mpu9250_set_fsync_interrupt_level(mpu9250_handle_t *handle, mpu9250_pin_level_t level)
set the fsync interrupt level
uint8_t mpu9250_set_gyroscope_choice(mpu9250_handle_t *handle, uint8_t choice)
set the gyroscope choice
uint8_t mpu9250_deinit(mpu9250_handle_t *handle)
close the chip
struct mpu9250_handle_s mpu9250_handle_t
mpu9250 handle structure definition
uint8_t mpu9250_set_fifo_1024kb(mpu9250_handle_t *handle)
set fifo 1024kb
uint8_t mpu9250_motion_threshold_convert_to_register(mpu9250_handle_t *handle, float mg, uint8_t *reg)
convert the motion threshold to the register raw data
uint8_t mpu9250_set_low_pass_filter(mpu9250_handle_t *handle, mpu9250_low_pass_filter_t filter)
set the low pass filter
uint8_t mpu9250_set_gyroscope_test(mpu9250_handle_t *handle, mpu9250_axis_t axis, mpu9250_bool_t enable)
set the gyroscope test
uint8_t mpu9250_set_clock_source(mpu9250_handle_t *handle, mpu9250_clock_source_t clock_source)
set the chip clock source
uint8_t mpu9250_set_low_power_accel_output_rate(mpu9250_handle_t *handle, mpu9250_low_power_accel_output_rate_t rate)
set the low power accel output rate
uint8_t mpu9250_set_disable_iic_slave(mpu9250_handle_t *handle, mpu9250_bool_t enable)
enable or disable the iic slave mode
uint8_t mpu9250_set_sample_rate_divider(mpu9250_handle_t *handle, uint8_t d)
set the sample rate divider
uint8_t mpu9250_set_fifo(mpu9250_handle_t *handle, mpu9250_bool_t enable)
enable or disable fifo
uint8_t mpu9250_init(mpu9250_handle_t *handle)
initialize the chip
uint8_t mpu9250_set_accelerometer_choice(mpu9250_handle_t *handle, uint8_t choice)
set the accelerometer choice
uint8_t mpu9250_set_gyroscope_range(mpu9250_handle_t *handle, mpu9250_gyroscope_range_t range)
set the gyroscope range
uint8_t mpu9250_set_interrupt_pin_type(mpu9250_handle_t *handle, mpu9250_pin_type_t type)
set the interrupt pin type
uint8_t mpu9250_set_iic_master(mpu9250_handle_t *handle, mpu9250_bool_t enable)
enable or disable the iic master mode
uint8_t mpu9250_set_accelerometer_range(mpu9250_handle_t *handle, mpu9250_accelerometer_range_t range)
set the accelerometer range
uint8_t mpu9250_set_sleep(mpu9250_handle_t *handle, mpu9250_bool_t enable)
enable or disable the sleep mode
uint8_t mpu9250_force_fifo_reset(mpu9250_handle_t *handle)
force reset the fifo
@ MPU9250_ACCELEROMETER_RANGE_2G
@ MPU9250_PIN_TYPE_PUSH_PULL
@ MPU9250_GYROSCOPE_RANGE_2000DPS
@ MPU9250_INTERRUPT_MOTION
@ MPU9250_INTERRUPT_DATA_READY
@ MPU9250_INTERRUPT_FSYNC_INT
@ MPU9250_INTERRUPT_FIFO_OVERFLOW
@ MPU9250_EXTERN_SYNC_INPUT_DISABLED
@ MPU9250_LOW_PASS_FILTER_3
@ MPU9250_FIFO_MODE_NORMAL
@ MPU9250_LOW_POWER_ACCEL_OUTPUT_RATE_62P50
@ MPU9250_ACCELEROMETER_LOW_PASS_FILTER_3
@ MPU9250_CLOCK_SOURCE_PLL
uint8_t mpu9250_dmp_set_accel_bias(mpu9250_handle_t *handle, int32_t bias[3])
dmp set the accel bias
uint8_t mpu9250_dmp_set_tap_callback(mpu9250_handle_t *handle, void(*callback)(uint8_t count, uint8_t direction))
dmp set the tap callback
uint8_t mpu9250_dmp_get_fifo_rate(mpu9250_handle_t *handle, uint16_t *rate)
dmp get the fifo rate
uint8_t mpu9250_dmp_set_gyro_bias(mpu9250_handle_t *handle, int32_t bias[3])
dmp set the gyro bias
uint8_t mpu9250_dmp_set_shake_reject_timeout(mpu9250_handle_t *handle, uint16_t ms)
dmp set the shake reject timeout
uint8_t mpu9250_dmp_get_pedometer_walk_time(mpu9250_handle_t *handle, uint32_t *ms)
dmp get the pedometer walk time
uint8_t mpu9250_dmp_get_tap_time_multi(mpu9250_handle_t *handle, uint16_t *ms)
dmp get max time between taps to register as a multi tap
uint8_t mpu9250_dmp_set_6x_quaternion(mpu9250_handle_t *handle, mpu9250_bool_t enable)
dmp enable or disable generate 6 axis quaternions from dmp
uint8_t mpu9250_dmp_set_orientation(mpu9250_handle_t *handle, int8_t mat[9])
dmp set the orientation
uint8_t mpu9250_dmp_set_fifo_rate(mpu9250_handle_t *handle, uint16_t rate)
dmp set the fifo rate
uint8_t mpu9250_dmp_load_firmware(mpu9250_handle_t *handle)
load the dmp firmware
uint8_t mpu9250_dmp_set_3x_quaternion(mpu9250_handle_t *handle, mpu9250_bool_t enable)
dmp enable or disable generate 3 axis quaternions from dmp
uint8_t mpu9250_dmp_set_tap_axes(mpu9250_handle_t *handle, mpu9250_axis_t axis, mpu9250_bool_t enable)
dmp enable or disable the tap axes
uint8_t mpu9250_dmp_get_tap_axes(mpu9250_handle_t *handle, mpu9250_axis_t axis, mpu9250_bool_t *enable)
dmp get the tap axes status
uint8_t mpu9250_dmp_set_enable(mpu9250_handle_t *handle, mpu9250_bool_t enable)
enable or disable the dmp
uint8_t mpu9250_dmp_set_feature(mpu9250_handle_t *handle, uint16_t mask)
dmp enable or disable the dmp feature
uint8_t mpu9250_dmp_set_shake_reject_thresh(mpu9250_handle_t *handle, uint16_t dps)
dmp set the shake reject thresh
uint8_t mpu9250_dmp_set_orient_callback(mpu9250_handle_t *handle, void(*callback)(uint8_t orientation))
dmp set the orient callback
uint8_t mpu9250_dmp_set_interrupt_mode(mpu9250_handle_t *handle, mpu9250_dmp_interrupt_mode_t mode)
dmp set the interrupt mode
uint8_t mpu9250_dmp_get_shake_reject_time(mpu9250_handle_t *handle, uint16_t *ms)
dmp get the shake reject time
uint8_t mpu9250_dmp_get_pedometer_step_count(mpu9250_handle_t *handle, uint32_t *count)
dmp get the pedometer step count
uint8_t mpu9250_dmp_set_pedometer_step_count(mpu9250_handle_t *handle, uint32_t count)
dmp set the pedometer step count
uint8_t mpu9250_dmp_get_tap_thresh(mpu9250_handle_t *handle, mpu9250_axis_t axis, uint16_t *mg_ms)
dmp get the tap thresh
uint8_t mpu9250_dmp_set_shake_reject_time(mpu9250_handle_t *handle, uint16_t ms)
dmp set the shake reject time
uint8_t mpu9250_dmp_get_min_tap_count(mpu9250_handle_t *handle, uint8_t *cnt)
dmp get the min tap count
uint8_t mpu9250_dmp_get_tap_time(mpu9250_handle_t *handle, uint16_t *ms)
dmp get the tap time
uint8_t mpu9250_dmp_set_gyro_calibrate(mpu9250_handle_t *handle, mpu9250_bool_t enable)
dmp enable or disable gyro calibrate
uint8_t mpu9250_dmp_get_shake_reject_timeout(mpu9250_handle_t *handle, uint16_t *ms)
dmp get the shake reject timeout
uint8_t mpu9250_dmp_gyro_accel_raw_offset_convert(mpu9250_handle_t *handle, int32_t gyro_offset_raw[3], int32_t accel_offset_raw[3], int32_t gyro_offset[3], int32_t accel_offset[3])
dmp gyro accel raw offset convert
uint8_t mpu9250_dmp_set_tap_time(mpu9250_handle_t *handle, uint16_t ms)
dmp set the tap time
uint8_t mpu9250_dmp_set_tap_thresh(mpu9250_handle_t *handle, mpu9250_axis_t axis, uint16_t mg_ms)
dmp set the tap thresh
uint8_t mpu9250_dmp_set_min_tap_count(mpu9250_handle_t *handle, uint8_t cnt)
dmp set the min tap count
uint8_t mpu9250_dmp_set_pedometer_walk_time(mpu9250_handle_t *handle, uint32_t ms)
dmp set the pedometer walk time
uint8_t mpu9250_dmp_read(mpu9250_handle_t *handle, int16_t(*accel_raw)[3], float(*accel_g)[3], int16_t(*gyro_raw)[3], float(*gyro_dps)[3], int32_t(*quat)[4], float *pitch, float *roll, float *yaw, uint16_t *l)
dmp read the data
uint8_t mpu9250_dmp_set_tap_time_multi(mpu9250_handle_t *handle, uint16_t ms)
dmp set max time between taps to register as a multi tap
uint8_t mpu9250_dmp_get_shake_reject_thresh(mpu9250_handle_t *handle, uint16_t *dps)
dmp get the shake reject thresh
@ MPU9250_DMP_FEATURE_6X_QUAT
@ MPU9250_DMP_FEATURE_GYRO_CAL
@ MPU9250_DMP_FEATURE_PEDOMETER
@ MPU9250_DMP_FEATURE_SEND_CAL_GYRO
@ MPU9250_DMP_FEATURE_SEND_RAW_ACCEL
@ MPU9250_DMP_FEATURE_TAP
@ MPU9250_DMP_FEATURE_ORIENT
@ MPU9250_DMP_ORIENT_REVERSE_PORTRAIT
@ MPU9250_DMP_ORIENT_REVERSE_LANDSCAPE
@ MPU9250_DMP_ORIENT_PORTRAIT
@ MPU9250_DMP_ORIENT_LANDSCAPE
@ MPU9250_DMP_INTERRUPT_MODE_CONTINUOUS
@ MPU9250_DMP_INTERRUPT_MODE_GESTURE
void mpu9250_interface_debug_print(const char *const fmt,...)
interface print format data
uint8_t mpu9250_interface_spi_write(uint8_t reg, uint8_t *buf, uint16_t len)
interface spi bus write
uint8_t mpu9250_interface_iic_deinit(void)
interface iic bus deinit
uint8_t mpu9250_interface_iic_write(uint8_t addr, uint8_t reg, uint8_t *buf, uint16_t len)
interface iic bus write
uint8_t mpu9250_interface_iic_read(uint8_t addr, uint8_t reg, uint8_t *buf, uint16_t len)
interface iic bus read
uint8_t mpu9250_interface_iic_init(void)
interface iic bus init
uint8_t mpu9250_interface_spi_read(uint8_t reg, uint8_t *buf, uint16_t len)
interface spi bus read
uint8_t mpu9250_interface_spi_init(void)
interface spi bus init
void mpu9250_interface_delay_ms(uint32_t ms)
interface delay ms
uint8_t mpu9250_interface_spi_deinit(void)
interface spi bus deinit
#define DRIVER_MPU9250_LINK_INIT(HANDLE, STRUCTURE)
initialize mpu9250_handle_t structure
#define DRIVER_MPU9250_LINK_RECEIVE_CALLBACK(HANDLE, FUC)
link receive_callback function
#define DRIVER_MPU9250_LINK_IIC_DEINIT(HANDLE, FUC)
link iic_deinit function
#define DRIVER_MPU9250_LINK_SPI_INIT(HANDLE, FUC)
link spi_init function
#define DRIVER_MPU9250_LINK_SPI_READ(HANDLE, FUC)
link spi_read function
#define DRIVER_MPU9250_LINK_IIC_READ(HANDLE, FUC)
link iic_read function
#define DRIVER_MPU9250_LINK_IIC_WRITE(HANDLE, FUC)
link iic_write function
#define DRIVER_MPU9250_LINK_SPI_DEINIT(HANDLE, FUC)
link spi_deinit function
#define DRIVER_MPU9250_LINK_IIC_INIT(HANDLE, FUC)
link iic_init function
#define DRIVER_MPU9250_LINK_DEBUG_PRINT(HANDLE, FUC)
link debug_print function
#define DRIVER_MPU9250_LINK_DELAY_MS(HANDLE, FUC)
link delay_ms function
#define DRIVER_MPU9250_LINK_SPI_WRITE(HANDLE, FUC)
link spi_write function
uint8_t mpu9250_dmp_tap_orient_motion_test_irq_handler(void)
dmp tap orient motion test irq
uint8_t mpu9250_dmp_tap_orient_motion_test(mpu9250_interface_t interface, mpu9250_address_t addr)
dmp test
float supply_voltage_max_v
char manufacturer_name[32]
float supply_voltage_min_v