This is the MPU9250 Driver.
◆ MPU9250_ADDDEV
#define MPU9250_ADDDEV |
( |
|
id | ) |
|
Value:
HAL_NAME("MPU9250 " #id " Accelerator") \
.accelBasis = {0, 0, 0}, \
};\
HAL_NAME("MPU9250 " #id " Gyro") \
.gyroBasis = {0, 0, 0}, \
};\
HAL_NAME("MPU9250 " #id) \
.slave = NULL, \
.accel = &mpu9250_accel_##id, \
.gyro = &mpu9250_gyro_##id, \
.bank = 0, \
}; \
ACCEL_ADDDEV(
mpu9250, mpu9250_accel_##
id); \
GYRO_ADDDEV(
mpu9250, mpu9250_gyro_##
id); \
The Number of MPU9250 is Board spezific, the User Code must Call this Macro to define a new MPU9250 dev
- Warning
- do not use the created Variable directly! Use the init function!
- Parameters
-
◆ MPU9250_ID
◆ MPU_GRAVITY
#define MPU_GRAVITY 16384 |
◆ mpu9250_deinit()
int32_t mpu9250_deinit |
( |
struct mpu9250 * |
mpu | ) |
|
Deinit MPU9250 Instance
- Parameters
-
- Returns
- -1 on error 0 on ok
◆ mpu9250_getAccel()
Get actual Accelerator Value
- Parameters
-
mpu | MPU9250 Instance |
vec | Value |
waittime | max waittime in mutex or isr lock see xSemaphoreTake() |
- Returns
- -1 on error 0 on ok
◆ mpu9250_getGyro()
Get actual Gyroscope Value
- Parameters
-
mpu | MPU9250 Instance |
vec | Value |
waittime | max waittime in mutex or isr lock see xSemaphoreTake() |
- Returns
- -1 on error 0 on ok
◆ mpu9250_init()
struct mpu9250* mpu9250_init |
( |
uint32_t |
index, |
|
|
struct spi * |
spi, |
|
|
uint8_t |
cs, |
|
|
uint16_t |
gpio, |
|
|
TickType_t |
waittime |
|
) |
| |
MPU9250 init
- Parameters
-
index | Driver Index |
waittime | max waittime in mutex or isr lock see xSemaphoreTake() |
spi | SPI Device |
cs | CS Number or SPI_OPT_CS_DIS |
gpio | GPIO Pin Number or SPI_OPT_GPIO_DIS |
- Returns
- MPU9250 Instance or NULL on error
◆ mpu9250_reset()
int32_t mpu9250_reset |
( |
struct mpu9250 * |
mpu, |
|
|
TickType_t |
waittime |
|
) |
| |
Reset MPU9250
- Parameters
-
mpu | MPU9250 Instance |
waittime | max waittime in mutex or isr lock see xSemaphoreTake() |
- Returns
- -1 on error 0 on ok