I messed up the merge, so pushing it over to another repo so I don't lose it. Will tidy up and remove later
Dependencies: BufferedSerial FatFileSystemCpp mbed
FIZ_readers/FIZReader.cpp@71:7305a35cee58, 2022-02-08 (annotated)
- Committer:
- JamieB
- Date:
- Tue Feb 08 09:17:48 2022 +0000
- Revision:
- 71:7305a35cee58
- Parent:
- 17:5ce3fe98e76d
- Child:
- 80:0b7f1b85b626
Updated Fuji Lens Parsing to L10 v1.90 of Protocol, added (but commented out) ability to read static lens parameters (needs updating to non-blocking serial read)
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
AndyA | 3:14d241e29be3 | 1 | #include "FIZReader.h" |
AndyA | 6:61274e214f46 | 2 | #include "LTCApp.h" |
JamieB | 71:7305a35cee58 | 3 | #include "mbed.h" |
AndyA | 3:14d241e29be3 | 4 | FIZReader::FIZReader(const PinName Tx, const PinName Rx) : _port(Tx,Rx) |
AndyA | 3:14d241e29be3 | 5 | { |
AndyA | 3:14d241e29be3 | 6 | _focus = 0; |
AndyA | 3:14d241e29be3 | 7 | _iris = 0; |
AndyA | 3:14d241e29be3 | 8 | _zoom = 0; |
AndyA | 3:14d241e29be3 | 9 | newData = false; |
AndyA | 3:14d241e29be3 | 10 | } |
AndyA | 3:14d241e29be3 | 11 | |
AndyA | 3:14d241e29be3 | 12 | bool FIZReader::getMostRecent(uint32_t *focus, uint16_t *iris, uint16_t *zoom) |
AndyA | 3:14d241e29be3 | 13 | { |
AndyA | 3:14d241e29be3 | 14 | *focus = _focus; |
AndyA | 17:5ce3fe98e76d | 15 | *iris = _iris; |
AndyA | 3:14d241e29be3 | 16 | *zoom = _zoom; |
AndyA | 3:14d241e29be3 | 17 | bool wasNew = newData; |
AndyA | 3:14d241e29be3 | 18 | newData = false; |
AndyA | 3:14d241e29be3 | 19 | return wasNew; |
AndyA | 3:14d241e29be3 | 20 | } |
AndyA | 3:14d241e29be3 | 21 | |
AndyA | 16:a8d3a0dbe4bf | 22 | int FIZReader::hexValue(char ascii) { |
AndyA | 16:a8d3a0dbe4bf | 23 | if (((ascii-'0') >= 0) && ((ascii-'0') <= 9)) |
AndyA | 16:a8d3a0dbe4bf | 24 | return ascii-'0'; |
AndyA | 16:a8d3a0dbe4bf | 25 | if (((ascii-'A') >= 0) && ((ascii-'A') <= 5)) |
AndyA | 16:a8d3a0dbe4bf | 26 | return ascii-'A'+10; |
AndyA | 16:a8d3a0dbe4bf | 27 | if (((ascii-'a') >= 0) && ((ascii-'a') <= 5)) |
AndyA | 16:a8d3a0dbe4bf | 28 | return ascii-'a'+10; |
AndyA | 16:a8d3a0dbe4bf | 29 | return 0; |
AndyA | 16:a8d3a0dbe4bf | 30 | } |