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.
Dependencies: mbed
Fork of Chemical_Sensor_DMA by
AngleEncoder.h@2:3771b3195c7b, 2015-10-29 (annotated)
- Committer:
- baxterja
- Date:
- Thu Oct 29 17:15:20 2015 +0000
- Revision:
- 2:3771b3195c7b
Accessible Sample folder
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
baxterja | 2:3771b3195c7b | 1 | #ifndef ANGLE_ENCODER_H |
baxterja | 2:3771b3195c7b | 2 | #define ANGLE_ENCODER_H |
baxterja | 2:3771b3195c7b | 3 | |
baxterja | 2:3771b3195c7b | 4 | #include "mbed.h" |
baxterja | 2:3771b3195c7b | 5 | |
baxterja | 2:3771b3195c7b | 6 | #define SPI_DELAY 4 // must be 4 or greater, otherwise the angle encoder can't keep up with the communication |
baxterja | 2:3771b3195c7b | 7 | |
baxterja | 2:3771b3195c7b | 8 | class AngleEncoder { |
baxterja | 2:3771b3195c7b | 9 | public: |
baxterja | 2:3771b3195c7b | 10 | AngleEncoder(PinName mosi, PinName miso, PinName sclk, PinName cs, int bits, int mode, int hz); |
baxterja | 2:3771b3195c7b | 11 | int nop(); |
baxterja | 2:3771b3195c7b | 12 | int absolute_angle(); |
baxterja | 2:3771b3195c7b | 13 | bool set_zero(); |
baxterja | 2:3771b3195c7b | 14 | bool set_zero(int*); |
baxterja | 2:3771b3195c7b | 15 | |
baxterja | 2:3771b3195c7b | 16 | private: |
baxterja | 2:3771b3195c7b | 17 | SPI _spi; |
baxterja | 2:3771b3195c7b | 18 | DigitalOut _cs; |
baxterja | 2:3771b3195c7b | 19 | }; |
baxterja | 2:3771b3195c7b | 20 | |
baxterja | 2:3771b3195c7b | 21 | #endif |