diff options
Diffstat (limited to 'main.cpp')
-rw-r--r-- | main.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
@@ -8,6 +8,7 @@ #include <usb/descriptor.h> #include "hmc5983.h" +#include "mpu6000.h" Pin usb_vbus = GPIOB[5]; Pin usb_dm = GPIOA[11]; @@ -58,6 +59,7 @@ class USB_TM : public USB_class_driver { USB_TM usb_tm(usb); HMC5983 magn(mag_cs, SPI2); +MPU6000 mpu(mpu_cs, SPI2); int main() { rcc_init(); @@ -96,19 +98,27 @@ int main() { flash_cs.on(); magn.init(); - float buf[3] = {0,0,0}; + mpu.init(); + float buf[9] = {0,0,0,0,0,0,0,0,0}; while(1) { usb.process(); uint8_t magn_status = magn.update(); + mpu.update(); buf[0] = magn.x; buf[1] = magn.y; buf[2] = magn.z; - + buf[3] = mpu.gyro[0]; + buf[4] = mpu.gyro[1]; + buf[5] = mpu.gyro[2]; + buf[6] = mpu.accel[0]; + buf[7] = mpu.accel[1]; + buf[8] = mpu.accel[2]; if(usb.ep_ready(1)) { usb.write(1, (uint32_t*)buf, sizeof(buf)); + //usb.write(1, (uint32_t*)mpu.gyro, sizeof(mpu.gyro)); //usb.write(1, (uint32_t*)&magn_status, sizeof(magn_status)); } } |