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:
- 3:14d241e29be3
- Child:
- 5:7994913a15fe
diff -r a79201e302d7 -r 14d241e29be3 FIZReader.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/FIZReader.h Thu Jan 28 15:13:05 2021 +0000 @@ -0,0 +1,30 @@ +#ifndef __FIZReader_H__ +#define __FIZReader_H__ +#include "BufferedSerial.h" + +class FIZReader { + +public: + FIZReader(const PinName Tx, const PinName Rx); + void requestCurrent(); + + /// true if the values have been updated since the last update. + bool getMostRecent(uint32_t *focus, uint16_t *iris, uint16_t *zoom); + +private: + + BufferedSerial _port; + + void OnRx(void); + void parsePacket(); + + uint8_t inputBuffer[10]; + int inputPtr; + + uint32_t _focus; + uint16_t _iris; + uint16_t _zoom; + bool newData; +}; + +#endif