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.
Fork of ISR_Mini-explorer by
Encoder.h@4:560d24c0e5f8, 2018-04-19 (annotated)
- Committer:
- fabiofaria
- Date:
- Thu Apr 19 15:35:29 2018 +0000
- Revision:
- 4:560d24c0e5f8
- Parent:
- 1:8569ac717e68
Initial commit.
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 |
