Energy harvesting mobile robot. Developed at Institute of Systems and Robotics — University of Coimbra.
Fork of ISR_Mini-explorer by
Encoder.h@1:8569ac717e68, 2018-02-20 (annotated)
- Committer:
- ISR
- Date:
- Tue Feb 20 13:37:47 2018 +0000
- Revision:
- 1:8569ac717e68
Encoders working inside thread.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ISR | 1:8569ac717e68 | 1 | #ifndef ENCODER_H |
ISR | 1:8569ac717e68 | 2 | #define ENCODER_H |
ISR | 1:8569ac717e68 | 3 | |
ISR | 1:8569ac717e68 | 4 | #include "mbed.h" |
ISR | 1:8569ac717e68 | 5 | |
ISR | 1:8569ac717e68 | 6 | /** Encoder class. |
ISR | 1:8569ac717e68 | 7 | * Manages one magnetic encoder AS5600. Reads its absolute value and performs |
ISR | 1:8569ac717e68 | 8 | * the conversion of the value to incremental valeu. |
ISR | 1:8569ac717e68 | 9 | */ |
ISR | 1:8569ac717e68 | 10 | class Encoder |
ISR | 1:8569ac717e68 | 11 | { |
ISR | 1:8569ac717e68 | 12 | public: |
ISR | 1:8569ac717e68 | 13 | Encoder(I2C* i2c_in, Mutex* mutex_in, char invert_in); |
ISR | 1:8569ac717e68 | 14 | long int readAbsolute(); |
ISR | 1:8569ac717e68 | 15 | long int incremental(); |
ISR | 1:8569ac717e68 | 16 | long int readIncrementalValue(); |
ISR | 1:8569ac717e68 | 17 | |
ISR | 1:8569ac717e68 | 18 | private: |
ISR | 1:8569ac717e68 | 19 | I2C* _i2c; |
ISR | 1:8569ac717e68 | 20 | Mutex* _mutex; |
ISR | 1:8569ac717e68 | 21 | short int prev_L; |
ISR | 1:8569ac717e68 | 22 | long int total_L; |
ISR | 1:8569ac717e68 | 23 | char _invert; |
ISR | 1:8569ac717e68 | 24 | }; |
ISR | 1:8569ac717e68 | 25 | |
ISR | 1:8569ac717e68 | 26 | #endif |