MPU6500 Bare-Metal Driver
Public API reference for the MPU6500 driver
Loading...
Searching...
No Matches
Non-Blocking Driver

Split-phase DMA/interrupt-friendly API functions. More...

Collaboration diagram for Non-Blocking Driver:

Functions

int8_t MPU6500_Read_Gyro_DMA (MPU6500_Config *config, uint8_t raw_buf[6])
 Start a gyroscope I2C read into a caller-owned buffer.
 
int8_t MPU6500_Read_Accel_DMA (MPU6500_Config *config, uint8_t raw_buf[6])
 Start an accelerometer I2C read into a caller-owned buffer.
 
void MPU6500_Process_Gyro_DMA (MPU6500_Config *config, const uint8_t raw_buf[6], MPU6500_Gyro_Data *data)
 Process a completed gyroscope raw buffer into scaled output.
 
void MPU6500_Process_Accel_DMA (MPU6500_Config *config, const uint8_t raw_buf[6], MPU6500_Accel_Data *data)
 Process a completed accelerometer raw buffer into scaled output.
 

Detailed Description

Split-phase DMA/interrupt-friendly API functions.

Function Documentation

◆ MPU6500_Process_Accel_DMA()

void MPU6500_Process_Accel_DMA ( MPU6500_Config config,
const uint8_t  raw_buf[6],
MPU6500_Accel_Data data 
)

Process a completed accelerometer raw buffer into scaled output.

Pure computation — no I/O. Combines raw bytes and applies sensitivity scaling. Call only after the I2C transfer has completed.

Parameters
raw_buf6-byte buffer containing completed accel register data.
dataOutput struct for processed accel values (g).

References MPU6500_Config::Accel_Setting.

◆ MPU6500_Process_Gyro_DMA()

void MPU6500_Process_Gyro_DMA ( MPU6500_Config config,
const uint8_t  raw_buf[6],
MPU6500_Gyro_Data data 
)

Process a completed gyroscope raw buffer into scaled output.

Pure computation — no I/O. Combines raw bytes, applies sensitivity scaling and calibration offsets. Call only after the I2C transfer has completed.

Parameters
raw_buf6-byte buffer containing completed gyro register data.
dataOutput struct for processed gyro values (dps).

References MPU6500_Config::Gyro_Offset_Calibration, and MPU6500_Config::Gyro_Setting.

Referenced by MPU6500_Gyro_Calibration().

◆ MPU6500_Read_Accel_DMA()

int8_t MPU6500_Read_Accel_DMA ( MPU6500_Config config,
uint8_t  raw_buf[6] 
)

Start an accelerometer I2C read into a caller-owned buffer.

Initiates a 6-byte read from the accel data registers. For non-blocking implementations, this returns immediately; the caller must wait for I/O completion before calling MPU6500_Process_Accel_DMA().

Note
Caller must ensure raw_buf remains valid until the transfer completes.
Parameters
configDriver configuration.
raw_bufCaller-owned 6-byte buffer (must not be a local/stack variable if using non-blocking I/O).
Returns
0 on success, -1 on failure.

References MPU6500_I2C_ADDR, MPU6500_REG_ACCEL_MEASURE, and MPU6500_Config::read.

◆ MPU6500_Read_Gyro_DMA()

int8_t MPU6500_Read_Gyro_DMA ( MPU6500_Config config,
uint8_t  raw_buf[6] 
)

Start a gyroscope I2C read into a caller-owned buffer.

Initiates a 6-byte read from the gyro data registers. For non-blocking implementations, this returns immediately; the caller must wait for I/O completion before calling MPU6500_Process_Gyro_DMA().

Note
Caller must ensure raw_buf remains valid until the transfer completes.
Parameters
configDriver configuration.
raw_bufCaller-owned 6-byte buffer (must not be a local/stack variable if using non-blocking I/O).
Returns
0 on success, -1 on failure.

References MPU6500_I2C_ADDR, MPU6500_REG_GYRO_MEASURE, and MPU6500_Config::read.

Referenced by MPU6500_Gyro_Calibration().