![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Fork to see if I can get working
Dependencies: BufferedSerial OneWire WinbondSPIFlash libxDot-dev-mbed5-deprecated
Fork of xDotBridge_update_test20180823 by
xDotBridge/inc/UserInterface.h@62:9751a8504c82, 2017-03-14 (annotated)
- Committer:
- Matt Briggs
- Date:
- Tue Mar 14 08:32:55 2017 -0600
- Revision:
- 62:9751a8504c82
- Child:
- 64:46c8819c07cc
First cut at pair code
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Matt Briggs | 62:9751a8504c82 | 1 | /* |
Matt Briggs | 62:9751a8504c82 | 2 | * UserInterface.h |
Matt Briggs | 62:9751a8504c82 | 3 | * |
Matt Briggs | 62:9751a8504c82 | 4 | * Created on: Feb 28, 2017 |
Matt Briggs | 62:9751a8504c82 | 5 | * Author: mbriggs |
Matt Briggs | 62:9751a8504c82 | 6 | */ |
Matt Briggs | 62:9751a8504c82 | 7 | |
Matt Briggs | 62:9751a8504c82 | 8 | #ifndef XDOTBRIDGE_INC_USERINTERFACE_H_ |
Matt Briggs | 62:9751a8504c82 | 9 | #define XDOTBRIDGE_INC_USERINTERFACE_H_ |
Matt Briggs | 62:9751a8504c82 | 10 | |
Matt Briggs | 62:9751a8504c82 | 11 | #include <stdint.h> |
Matt Briggs | 62:9751a8504c82 | 12 | #include "BaseboardIO.h" |
Matt Briggs | 62:9751a8504c82 | 13 | |
Matt Briggs | 62:9751a8504c82 | 14 | const float RX_PAIR_WAIT_TIME = 30.0; |
Matt Briggs | 62:9751a8504c82 | 15 | const float TX_ACCEPT_WAIT_TIME = 10.0; |
Matt Briggs | 62:9751a8504c82 | 16 | |
Matt Briggs | 62:9751a8504c82 | 17 | enum PairBtnState { |
Matt Briggs | 62:9751a8504c82 | 18 | pairBtnShortPress, |
Matt Briggs | 62:9751a8504c82 | 19 | pairBtnMediumPress, |
Matt Briggs | 62:9751a8504c82 | 20 | pairBtnLongPress |
Matt Briggs | 62:9751a8504c82 | 21 | }; |
Matt Briggs | 62:9751a8504c82 | 22 | |
Matt Briggs | 62:9751a8504c82 | 23 | class PairBtnInterp { |
Matt Briggs | 62:9751a8504c82 | 24 | public: |
Matt Briggs | 62:9751a8504c82 | 25 | // Start time < press time < stop time (all time in ms) |
Matt Briggs | 62:9751a8504c82 | 26 | static const uint16_t ShortPressStartTime = 0; |
Matt Briggs | 62:9751a8504c82 | 27 | static const uint16_t ShortPressStopTime = 4000; |
Matt Briggs | 62:9751a8504c82 | 28 | static const uint16_t MediumPressStartTime = 4000; |
Matt Briggs | 62:9751a8504c82 | 29 | static const uint16_t MediumPressStopTime = 9000; |
Matt Briggs | 62:9751a8504c82 | 30 | // Anything longer is a LongPress |
Matt Briggs | 62:9751a8504c82 | 31 | |
Matt Briggs | 62:9751a8504c82 | 32 | static PairBtnState read(BaseboardIO *bbio); |
Matt Briggs | 62:9751a8504c82 | 33 | }; |
Matt Briggs | 62:9751a8504c82 | 34 | |
Matt Briggs | 62:9751a8504c82 | 35 | class HoldTimeSetting { |
Matt Briggs | 62:9751a8504c82 | 36 | public: |
Matt Briggs | 62:9751a8504c82 | 37 | static uint32_t rotVal2Msec(uint8_t in); |
Matt Briggs | 62:9751a8504c82 | 38 | static float rotVal2Sec(uint8_t in) {return rotVal2Msec(in)/1000.0;} |
Matt Briggs | 62:9751a8504c82 | 39 | }; |
Matt Briggs | 62:9751a8504c82 | 40 | |
Matt Briggs | 62:9751a8504c82 | 41 | #endif /* XDOTBRIDGE_INC_USERINTERFACE_H_ */ |