Fork to see if I can get working

Dependencies:   BufferedSerial OneWire WinbondSPIFlash libxDot-dev-mbed5-deprecated

Fork of xDotBridge_update_test20180823 by Matt Briggs

Committer:
Matt Briggs
Date:
Tue May 16 15:15:58 2017 -0600
Revision:
76:d1b20a259d8f
Parent:
75:600cb3a9f126
Child:
77:176e3eb8f712
Quick commit before lib add.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Matt Briggs 75:600cb3a9f126 1 /*
Matt Briggs 75:600cb3a9f126 2 * SerialTermMgr.h
Matt Briggs 75:600cb3a9f126 3 *
Matt Briggs 75:600cb3a9f126 4 * Created on: May 8, 2017
Matt Briggs 75:600cb3a9f126 5 * Author: mbriggs
Matt Briggs 75:600cb3a9f126 6 */
Matt Briggs 75:600cb3a9f126 7
Matt Briggs 75:600cb3a9f126 8 #ifndef XDOTBRIDGE_INC_SERIALTERMMGR_H_
Matt Briggs 75:600cb3a9f126 9 #define XDOTBRIDGE_INC_SERIALTERMMGR_H_
Matt Briggs 75:600cb3a9f126 10
Matt Briggs 75:600cb3a9f126 11 #include "mbed.h"
Matt Briggs 75:600cb3a9f126 12 #include "BaseboardIO.h"
Matt Briggs 75:600cb3a9f126 13
Matt Briggs 76:d1b20a259d8f 14 const uint32_t TERM_BAUD = 115200;
Matt Briggs 75:600cb3a9f126 15 const uint8_t TERM_TIMEOUT = 30; // In seconds
Matt Briggs 75:600cb3a9f126 16
Matt Briggs 76:d1b20a259d8f 17 const float XMODEM_TIMEOUT = 10.0;
Matt Briggs 76:d1b20a259d8f 18 const uint8_t FLASH_BIN_OFFSET = 0x20; // Skip first 32 bytes
Matt Briggs 76:d1b20a259d8f 19
Matt Briggs 75:600cb3a9f126 20 enum ScreenId {
Matt Briggs 75:600cb3a9f126 21 mainScreenId,
Matt Briggs 75:600cb3a9f126 22 genInfoScreenId,
Matt Briggs 75:600cb3a9f126 23 settingsScreenId,
Matt Briggs 75:600cb3a9f126 24 statsScreenId,
Matt Briggs 75:600cb3a9f126 25 errorLogScreenId,
Matt Briggs 75:600cb3a9f126 26 liveLogScreenId,
Matt Briggs 75:600cb3a9f126 27 enterSerialBridgeScreenId,
Matt Briggs 75:600cb3a9f126 28 enterProgModeScreenId
Matt Briggs 75:600cb3a9f126 29 };
Matt Briggs 75:600cb3a9f126 30
Matt Briggs 75:600cb3a9f126 31
Matt Briggs 75:600cb3a9f126 32 class SerialTermMgr
Matt Briggs 75:600cb3a9f126 33 {
Matt Briggs 75:600cb3a9f126 34 private:
Matt Briggs 75:600cb3a9f126 35 ScreenId mCurrScreen; // Current selection
Matt Briggs 75:600cb3a9f126 36 float mFwVersion;
Matt Briggs 75:600cb3a9f126 37 BaseboardIO *mBbio; // Handle for reading states
Matt Briggs 75:600cb3a9f126 38 Serial *mPc;
Matt Briggs 75:600cb3a9f126 39
Matt Briggs 75:600cb3a9f126 40 bool inputMainPage(char in);
Matt Briggs 75:600cb3a9f126 41 void printMainScreen();
Matt Briggs 75:600cb3a9f126 42 void inputGenInfo (char in);
Matt Briggs 75:600cb3a9f126 43 void printGenInfo();
Matt Briggs 76:d1b20a259d8f 44 void inputEnterProgMode (char in);
Matt Briggs 76:d1b20a259d8f 45 void printEnterProgMode();
Matt Briggs 76:d1b20a259d8f 46 bool xmodem2Flash();
Matt Briggs 75:600cb3a9f126 47 public:
Matt Briggs 75:600cb3a9f126 48 SerialTermMgr(BaseboardIO *bbio, float fwVersion);
Matt Briggs 75:600cb3a9f126 49 void regSerial (Serial *pc) {
Matt Briggs 75:600cb3a9f126 50 mPc = pc;
Matt Briggs 75:600cb3a9f126 51 }
Matt Briggs 75:600cb3a9f126 52 ScreenId getCurrentScreenId() {
Matt Briggs 75:600cb3a9f126 53 return mCurrScreen;
Matt Briggs 75:600cb3a9f126 54 }
Matt Briggs 75:600cb3a9f126 55 void printScreen();
Matt Briggs 75:600cb3a9f126 56 bool input();
Matt Briggs 75:600cb3a9f126 57 };
Matt Briggs 75:600cb3a9f126 58
Matt Briggs 75:600cb3a9f126 59 #endif /* XDOTBRIDGE_INC_SERIALTERMMGR_H_ */