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
Diff: FIZReader.h
- Revision:
- 5:7994913a15fe
- Parent:
- 3:14d241e29be3
- Child:
- 6:61274e214f46
diff -r 6cd904bff1bd -r 7994913a15fe FIZReader.h --- a/FIZReader.h Fri Jan 29 14:50:21 2021 +0000 +++ b/FIZReader.h Mon Feb 01 17:29:57 2021 +0000 @@ -2,6 +2,8 @@ #define __FIZReader_H__ #include "BufferedSerial.h" +#define InBufferSize 32 + class FIZReader { public: @@ -18,13 +20,24 @@ void OnRx(void); void parsePacket(); - uint8_t inputBuffer[10]; + uint8_t inputBuffer[InBufferSize]; int inputPtr; uint32_t _focus; uint16_t _iris; uint16_t _zoom; bool newData; + + inline int hexValue(char ascii) { + if (((ascii-'0') >= 0) && ((ascii-'0') <= 9)) + return ascii-'0'; + if (((ascii-'A') >= 0) && ((ascii-'A') <= 5)) + return ascii-'A'+10; + if (((ascii-'a') >= 0) && ((ascii-'a') <= 5)) + return ascii-'a'+10; + return 0; + } + }; #endif