hobbyking_cheetah source code modified 2020/12/15
Dependencies: mbed-dev-f303 FastPWM3
Diff: PositionSensor/PositionSensor.cpp
- Revision:
- 45:26801179208e
- Parent:
- 38:67e4e1453a4b
- Child:
- 46:2d4b1dafcfe3
diff -r 8040fa2fcb0d -r 26801179208e PositionSensor/PositionSensor.cpp --- a/PositionSensor/PositionSensor.cpp Mon Jun 11 00:04:06 2018 +0000 +++ b/PositionSensor/PositionSensor.cpp Wed Jun 27 03:44:44 2018 +0000 @@ -25,10 +25,8 @@ } void PositionSensorAM5147::Sample(){ - GPIOA->ODR &= ~(1 << 15); raw = spi->write(readAngleCmd); raw &= 0x3FFF; //Extract last 14 bits - GPIOA->ODR |= (1 << 15); int off_1 = offset_lut[raw>>7]; int off_2 = offset_lut[((raw>>7)+1)%128]; int off_interp = off_1 + ((off_2 - off_1)*(raw - ((raw>>7)<<7))>>7); // Interpolate between lookup table entries