
Ethernet State Machine
StateMachine.h@14:a05e12de308b, 2020-11-07 (annotated)
- Committer:
- thomasluca
- Date:
- Sat Nov 07 15:12:35 2020 +0000
- Revision:
- 14:a05e12de308b
- Parent:
- 13:368c6181b81e
Deleted Client class
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
thomasluca | 13:368c6181b81e | 1 | #ifndef STATEMACHINE_H |
thomasluca | 13:368c6181b81e | 2 | #define STATEMACHINE_H |
thomasluca | 13:368c6181b81e | 3 | #include "LM75B.h" |
thomasluca | 13:368c6181b81e | 4 | #include "C12832.h" |
thomasluca | 13:368c6181b81e | 5 | #include <vector> |
thomasluca | 13:368c6181b81e | 6 | #include <string> |
thomasluca | 13:368c6181b81e | 7 | #include "mbed.h" |
thomasluca | 13:368c6181b81e | 8 | |
thomasluca | 13:368c6181b81e | 9 | enum State {INIT,RECEIVE,TRANSMIT,CERROR}; |
thomasluca | 13:368c6181b81e | 10 | |
thomasluca | 13:368c6181b81e | 11 | class StateMachine |
thomasluca | 13:368c6181b81e | 12 | { |
thomasluca | 13:368c6181b81e | 13 | |
thomasluca | 13:368c6181b81e | 14 | private: |
thomasluca | 13:368c6181b81e | 15 | void actionInit(); |
thomasluca | 13:368c6181b81e | 16 | void actionReceive(); |
thomasluca | 13:368c6181b81e | 17 | void actionTransmit(); |
thomasluca | 13:368c6181b81e | 18 | |
thomasluca | 13:368c6181b81e | 19 | bool containsID(); |
thomasluca | 13:368c6181b81e | 20 | |
thomasluca | 13:368c6181b81e | 21 | private: |
thomasluca | 13:368c6181b81e | 22 | State currentState; |
thomasluca | 13:368c6181b81e | 23 | C12832* lcd; |
thomasluca | 13:368c6181b81e | 24 | LM75B* tempSensor; |
thomasluca | 13:368c6181b81e | 25 | AnalogIn* pot1; |
thomasluca | 13:368c6181b81e | 26 | |
thomasluca | 13:368c6181b81e | 27 | std::vector<char> srbuffer; |
thomasluca | 13:368c6181b81e | 28 | char ownID = 0x14; |
thomasluca | 13:368c6181b81e | 29 | |
thomasluca | 13:368c6181b81e | 30 | public: |
thomasluca | 13:368c6181b81e | 31 | StateMachine(); // Constructor |
thomasluca | 13:368c6181b81e | 32 | ~StateMachine(); // Destructor |
thomasluca | 13:368c6181b81e | 33 | void start(); |
thomasluca | 13:368c6181b81e | 34 | |
thomasluca | 13:368c6181b81e | 35 | }; |
thomasluca | 13:368c6181b81e | 36 | |
thomasluca | 13:368c6181b81e | 37 | |
thomasluca | 13:368c6181b81e | 38 | #endif |