SmartWheels self-driving race car. Designed for NXP Cup. Uses FRDM-KL25Z, area-scan camera, and simple image processing to detect and navigate any NXP spec track.
Dependencies: TSI USBDevice mbed-dev
Fork of SmartWheels by
Hardwares/IMUManager.h
- Committer:
- hazheng
- Date:
- 2017-04-08
- Revision:
- 59:b709711bc566
- Child:
- 62:bc5caf59fe39
File content as of revision 59:b709711bc566:
#pragma once #ifndef IMU_MANAGER_H #define IMU_MANAGER_H #define ACCEL_MAG_SA0_0 //#define ACCEL_MAG_SA0_1 #define ACCEL_MAG_SA1_0 //#define ACCEL_MAG_SA1_1 #if defined(ACCEL_MAG_SA1_0) && defined(ACCEL_MAG_SA0_0) #define ACCEL_MAG_SA1 0 #define ACCEL_MAG_SA0 0 #define FXOS8700CQ_SLAVE_ADDR 0x1E #elif defined(ACCEL_MAG_SA1_0) && defined(ACCEL_MAG_SA0_1) #define ACCEL_MAG_SA1 0 #define ACCEL_MAG_SA0 1 #define FXOS8700CQ_SLAVE_ADDR 0x1D #elif defined(ACCEL_MAG_SA1_1) && defined(ACCEL_MAG_SA0_0) #define ACCEL_MAG_SA1 1 #define ACCEL_MAG_SA0 0 #define FXOS8700CQ_SLAVE_ADDR 0x1C #elif defined(ACCEL_MAG_SA1_1) && defined(ACCEL_MAG_SA0_1) #define ACCEL_MAG_SA1 1 #define ACCEL_MAG_SA0 1 #define FXOS8700CQ_SLAVE_ADDR 0x1F #else #error Must choose a SA0 and SA1 value for Accel and Mag #endif #define FXOS8700CQ_STATUS 0x00 #define FXOS8700CQ_WHOAMI 0x0D #define FXOS8700CQ_WHOAMI_VAL 0xC7 #define FXOS8700CQ_XYZ_DATA_CFG 0x0E #define FXOS8700CQ_CTRL_REG1 0x2A #define FXOS8700CQ_M_CTRL_REG1 0x5B #define FXOS8700CQ_M_CTRL_REG2 0x5C #define FXOS8700CQ_READ_LEN 13 // status plus 6 channels = 13 bytes #include <mbed.h> #ifdef __cplusplus extern "C" { #endif struct imu_vec3 { uint16_t x; uint16_t y; uint16_t z; }; uint8_t imu_manager_init(); void imu_manager_update(); const volatile struct imu_vec3* imu_manager_get_accl(); const volatile struct imu_vec3* imu_manager_get_magt(); #ifdef __cplusplus } #endif #endif //IMU_MANAGER_H