https://github.com/desertkun/mpu9250
MPU9250 (GY-91) driver for STM32 with HAL using SPI
https://github.com/desertkun/mpu9250
gy-91 hal mpu9250 spi stm32
Last synced: about 1 month ago
JSON representation
MPU9250 (GY-91) driver for STM32 with HAL using SPI
- Host: GitHub
- URL: https://github.com/desertkun/mpu9250
- Owner: desertkun
- License: wtfpl
- Created: 2019-02-28T22:30:14.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2022-02-03T12:04:08.000Z (about 3 years ago)
- Last Synced: 2025-03-18T02:44:23.186Z (about 1 month ago)
- Topics: gy-91, hal, mpu9250, spi, stm32
- Language: C
- Size: 5.86 KB
- Stars: 87
- Watchers: 3
- Forks: 22
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# MPU9250
MPU9250 (GY-91) driver for STM32 with HAL using SPI (spi1 by default).## Setup
Define `GY_CS` pin in STM32CubeMX that will be used as Chip Select for the device, or pick the one you need in the `MPU9250_Config.h`.## How To Use
Use `MPU9250_Init()` to initialize the device.Then use this to retireve the raw data:
```c
int16_t AccData[3], GyroData[3], MagData[3];
MPU9250_GetData(AccData, GyroData, MagData);printf("%08d;%08d;%08d;%08d;%08d;%08d;%08d;%08d;%08d\n",
(int16_t)AccData[0], (int16_t)AccData[1], (int16_t)AccData[2],
(int16_t)GyroData[0], (int16_t)GyroData[1], (int16_t)GyroData[2],
(int16_t)MagData[0], (int16_t)MagData[1], (int16_t)MagData[2]);
```