|
MPU6500 Bare-Metal Driver
Public API reference for the MPU6500 driver
|
Blocking API functions. More...

Functions | |
| int8_t | MPU6500_Init (MPU6500_Config *config) |
| Initialize the MPU6500 sensor. | |
| int8_t | MPU6500_SetAccelRange (MPU6500_Config *config, Accel_Range range) |
| Set the accelerometer full-scale range. | |
| int8_t | MPU6500_SetRotationRange (MPU6500_Config *config, Gyro_Range range) |
| Set the gyroscope full-scale range. | |
| int8_t | MPU6500_Read_Gyro_Data (MPU6500_Config *config, MPU6500_Gyro_Data *Gyro_Data) |
| Read and process gyroscope data in a single blocking call. | |
| int8_t | MPU6500_Read_Accel_Data (MPU6500_Config *config, MPU6500_Accel_Data *Accel_Data) |
| Read and process accelerometer data in a single blocking call. | |
| int8_t | MPU6500_Gyro_Calibration (MPU6500_Config *config, int8_t return_offset[3]) |
| Calibrate gyroscope zero-rate offsets. | |
Blocking API functions.
| int8_t MPU6500_Gyro_Calibration | ( | MPU6500_Config * | config, |
| int8_t | return_offset[3] | ||
| ) |
Calibrate gyroscope zero-rate offsets.
Collects 512 samples while the device is stationary and averages them to compute per-axis offsets. Stores the result in the internal driver config. Uses the split-phase DMA functions with delay_ms() between each sample.
| config | Driver configuration. |
| return_offset | Optional output array [X,Y,Z] for the offsets. Can be NULL. |
References MPU6500_Config::delay_ms, MPU6500_Config::Gyro_Offset_Calibration, MPU6500_Process_Gyro_DMA(), and MPU6500_Read_Gyro_DMA().
| int8_t MPU6500_Init | ( | MPU6500_Config * | config | ) |
Initialize the MPU6500 sensor.
Reads WHO_AM_I, clears the SLEEP bit, and verifies the device is awake. Uses delay_ms() between I2C operations for non-blocking compatibility.
| config | Pointer to a fully populated MPU6500_Config. |
References MPU6500_Config::delay_ms, MPU6500_I2C_ADDR, MPU6500_SLEEP_WAKE_MASK, MPU6500_Config::read, and MPU6500_Config::write.
| int8_t MPU6500_Read_Accel_Data | ( | MPU6500_Config * | config, |
| MPU6500_Accel_Data * | Accel_Data | ||
| ) |
Read and process accelerometer data in a single blocking call.
Reads 6 raw bytes and applies sensitivity scaling.
| config | Driver configuration. |
| Accel_Data | Output struct for processed accel values (g). |
References MPU6500_Config::Accel_Setting, MPU6500_I2C_ADDR, MPU6500_REG_ACCEL_MEASURE, and MPU6500_Config::read.
| int8_t MPU6500_Read_Gyro_Data | ( | MPU6500_Config * | config, |
| MPU6500_Gyro_Data * | Gyro_Data | ||
| ) |
Read and process gyroscope data in a single blocking call.
Reads 6 raw bytes, applies sensitivity scaling and calibration offsets.
| config | Driver configuration. |
| Gyro_Data | Output struct for processed gyro values (dps). |
References MPU6500_Config::Gyro_Offset_Calibration, MPU6500_Config::Gyro_Setting, MPU6500_I2C_ADDR, MPU6500_REG_GYRO_MEASURE, and MPU6500_Config::read.
| int8_t MPU6500_SetAccelRange | ( | MPU6500_Config * | config, |
| Accel_Range | range | ||
| ) |
Set the accelerometer full-scale range.
| config | Driver configuration. |
| range | Desired range (2G, 4G, 8G, or 16G). |
References MPU6500_Config::Accel_Setting, MPU6500_Config::delay_ms, MPU6500_I2C_ADDR, MPU6500_Config::read, and MPU6500_Config::write.
| int8_t MPU6500_SetRotationRange | ( | MPU6500_Config * | config, |
| Gyro_Range | range | ||
| ) |
Set the gyroscope full-scale range.
| config | Driver configuration. |
| range | Desired range (250, 500, 1000, or 2000 dps). |
References MPU6500_Config::delay_ms, MPU6500_Config::Gyro_Setting, MPU6500_I2C_ADDR, MPU6500_Config::read, and MPU6500_Config::write.