Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
test/test.cpp@23:3626c7d73505, 2019-12-19 (annotated)
- Committer:
- Arithemetica
- Date:
- Thu Dec 19 14:35:25 2019 +0000
- Revision:
- 23:3626c7d73505
- Parent:
- 22:713817fa6687
- Child:
- 24:275e886bd61c
add receive both msg entry to ImuConfigExti enum, functionality is verified
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| Arithemetica | 21:9430046ebd9d | 1 | #include "imu_driver.hpp" |
| Arithemetica | 21:9430046ebd9d | 2 | |
| Arithemetica | 22:713817fa6687 | 3 | #if defined(COMPILE_TEST) |
| Arithemetica | 22:713817fa6687 | 4 | |
| Arithemetica | 23:3626c7d73505 | 5 | SPI spi2(PB_15, PB_14, PB_13); //1Mbps default, MOSI MISO SCLK, for IMU |
| Arithemetica | 21:9430046ebd9d | 6 | Serial pc(USBTX, USBRX, 115200); // print debug message |
| Arithemetica | 21:9430046ebd9d | 7 | |
| Arithemetica | 21:9430046ebd9d | 8 | inline void test_exti_rcv_normal_msg() |
| Arithemetica | 21:9430046ebd9d | 9 | { |
| Arithemetica | 21:9430046ebd9d | 10 | ImuDriver<spi2, PC_4, PB_2, PB_1> imu(ImuExtiRcvNormalMsg); //SPI instance, reset, data ready, slave select |
| Arithemetica | 21:9430046ebd9d | 11 | |
| Arithemetica | 21:9430046ebd9d | 12 | while(true) { |
| Arithemetica | 21:9430046ebd9d | 13 | wait_ms(1); |
| Arithemetica | 21:9430046ebd9d | 14 | pc.printf("gyro: % .3f, % .3f, % .3f, accel: % .3f, % .3f, % .3f\n\r", |
| Arithemetica | 21:9430046ebd9d | 15 | imu.imuProcessedData.rate[0], imu.imuProcessedData.rate[1], imu.imuProcessedData.rate[2], |
| Arithemetica | 21:9430046ebd9d | 16 | imu.imuProcessedData.accel[0], imu.imuProcessedData.accel[1], imu.imuProcessedData.accel[2]); |
| Arithemetica | 21:9430046ebd9d | 17 | } |
| Arithemetica | 21:9430046ebd9d | 18 | } |
| Arithemetica | 21:9430046ebd9d | 19 | |
| Arithemetica | 21:9430046ebd9d | 20 | inline void test_exti_rcv_ahrs_msg() |
| Arithemetica | 21:9430046ebd9d | 21 | { |
| Arithemetica | 21:9430046ebd9d | 22 | ImuDriver<spi2, PC_4, PB_2, PB_1> imu(ImuExtiRcvAhrsMsg); //SPI instance, reset, data ready, slave select |
| Arithemetica | 21:9430046ebd9d | 23 | |
| Arithemetica | 21:9430046ebd9d | 24 | while(true) { |
| Arithemetica | 21:9430046ebd9d | 25 | wait_ms(1); |
| Arithemetica | 21:9430046ebd9d | 26 | pc.printf("PRY: % .3f, % .3f, % .3f\n\r", imu.ahrsProcessedData.attitude[0], imu.ahrsProcessedData.attitude[1], imu.ahrsProcessedData.attitude[2]); |
| Arithemetica | 21:9430046ebd9d | 27 | } |
| Arithemetica | 21:9430046ebd9d | 28 | } |
| Arithemetica | 21:9430046ebd9d | 29 | |
| Arithemetica | 21:9430046ebd9d | 30 | inline void test_exti_rcv_both_msg() |
| Arithemetica | 21:9430046ebd9d | 31 | { |
| Arithemetica | 21:9430046ebd9d | 32 | ImuDriver<spi2, PC_4, PB_2, PB_1> imu(ImuExtiRcvAhrsMsg | ImuExtiRcvNormalMsg); //SPI instance, reset, data ready, slave select |
| Arithemetica | 21:9430046ebd9d | 33 | |
| Arithemetica | 21:9430046ebd9d | 34 | while(true) { |
| Arithemetica | 21:9430046ebd9d | 35 | wait_ms(1); |
| Arithemetica | 21:9430046ebd9d | 36 | pc.printf("PRY: % .3f, % .3f, % .3f\n\r", imu.ahrsProcessedData.attitude[0], imu.ahrsProcessedData.attitude[1], imu.ahrsProcessedData.attitude[2]); |
| Arithemetica | 21:9430046ebd9d | 37 | pc.printf("gyro: % .3f, % .3f, % .3f, accel: % .3f, % .3f, % .3f\n\r", |
| Arithemetica | 21:9430046ebd9d | 38 | imu.imuProcessedData.rate[0], imu.imuProcessedData.rate[1], imu.imuProcessedData.rate[2], |
| Arithemetica | 21:9430046ebd9d | 39 | imu.imuProcessedData.accel[0], imu.imuProcessedData.accel[1], imu.imuProcessedData.accel[2]); |
| Arithemetica | 21:9430046ebd9d | 40 | } |
| Arithemetica | 22:713817fa6687 | 41 | } |
| Arithemetica | 22:713817fa6687 | 42 | |
| Arithemetica | 22:713817fa6687 | 43 | #endif // COMPILE_TEST |