Jacky Tseng
/
imu_driver
handle master side communication of openIMU300ZI module
Diff: imu_driver.hpp
- Revision:
- 5:e71931fcae33
- Parent:
- 4:a2becd590d99
- Child:
- 7:224ffdacb240
--- a/imu_driver.hpp Sun Nov 17 06:41:20 2019 +0000 +++ b/imu_driver.hpp Sun Nov 17 07:06:47 2019 +0000 @@ -50,11 +50,11 @@ * - CPHA: 2 Edge (1) * - Frequency: 1.40625 MHz (Baudrate prescaler 32 for NUCLEO-F446RE under 180MHz) * - Endian: MSB first (Mbed only support MSB AFAIK) - * + * * According to [openIMU300ZI SPI framework](https://openimu.readthedocs.io/en/latest/software/SPImessaging.html): - * + * * - Data transferred in 16-bit word-length and MSB-first - * - fCLK <= 2.0 MHz + * - fCLK ≤ 2.0 MHz * - CPOL = 1 (clock polarity) and CPHA = 1 (clock phase) * * @tparam spi SPI comm instance, ImuDriver currently support only SPI framework @@ -63,7 +63,7 @@ * (@todo Attach to interrupt in the future, and make user able to choose) * @tparam ss Slave select pin name, this is used as slave select, pull low to initiate * communication process. - * + * * Example of using ImuDriver: * * @code @@ -74,7 +74,7 @@ * * int main() * { - * // SPI instance, reset, data ready, slave select + * // SPI instance, reset, data ready, slave select * ImuDriver<spi3, PA_10, PA_8, PA_9> imu; * * while(true) @@ -85,7 +85,7 @@ * } * } * } - * + * * @endcode */ template <SPI& Spi, PinName rst, PinName drdy, PinName ss> @@ -100,7 +100,7 @@ DigitalOut m_rst, m_ss; DigitalIn m_drdy; InterruptIn m_drdyExti; - + float m_gyroScaler[3]; float m_accelScaler[3]; float m_ahrsScaler[3]; @@ -152,7 +152,7 @@ ahrsProcessedData.attitude[i] = ahrsRawData.attitude[i] / m_ahrsScaler[i]; } } - + void m_receiveAhrsCallback() { receiveAhrsMsg(); @@ -182,7 +182,8 @@ } /** - * @brief This function handles the receiving of burst message function + * @brief This function handles the receiving of burst message function, burst message + * contains accelerometer, gyroscope, status and temperature data * * @param t_extended bool to indicate the message type is extended or not, default false * @@ -244,7 +245,8 @@ } /** - * @brief This function handles the receiving of AHRS burst message function + * @brief This function handles the receiving of AHRS burst message function, AHRS + * burst message contains the attitude in euler angle. * * @return ImuDriverStatus to indicate the result of the receive operation *