![](/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/src/BaseboardIO.cpp@41:9ef4c4d77711, 2017-01-30 (annotated)
- Committer:
- Matt Briggs
- Date:
- Mon Jan 30 17:25:08 2017 -0700
- Revision:
- 41:9ef4c4d77711
- Parent:
- 40:2ec4be320961
- Child:
- 44:ece6330e9b57
Fisrt cut at implementing protocol refactor
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Matt Briggs | 40:2ec4be320961 | 1 | /* |
Matt Briggs | 40:2ec4be320961 | 2 | * baseboardIO.cpp |
Matt Briggs | 40:2ec4be320961 | 3 | * |
Matt Briggs | 40:2ec4be320961 | 4 | * Created on: Jan 25, 2017 |
Matt Briggs | 40:2ec4be320961 | 5 | * Author: mbriggs |
Matt Briggs | 40:2ec4be320961 | 6 | */ |
Matt Briggs | 40:2ec4be320961 | 7 | |
Matt Briggs | 40:2ec4be320961 | 8 | #include "BaseboardIO.h" |
Matt Briggs | 41:9ef4c4d77711 | 9 | #include "MTSLog.h" |
Matt Briggs | 40:2ec4be320961 | 10 | |
Matt Briggs | 40:2ec4be320961 | 11 | BaseboardIO::BaseboardIO() |
Matt Briggs | 40:2ec4be320961 | 12 | { |
Matt Briggs | 40:2ec4be320961 | 13 | mCCInIntCallback = NULL; |
Matt Briggs | 40:2ec4be320961 | 14 | mTamperIntCallback = NULL; |
Matt Briggs | 40:2ec4be320961 | 15 | mPairBtnIntCallback = NULL; |
Matt Briggs | 40:2ec4be320961 | 16 | |
Matt Briggs | 40:2ec4be320961 | 17 | std::memset(portExpanderROM0, 0x00, 8); |
Matt Briggs | 40:2ec4be320961 | 18 | std::memset(portExpanderROM1, 0x00, 8); |
Matt Briggs | 40:2ec4be320961 | 19 | portExpanderVal0 = 0x00; |
Matt Briggs | 40:2ec4be320961 | 20 | portExpanderVal1 = 0x00; |
Matt Briggs | 40:2ec4be320961 | 21 | } |
Matt Briggs | 40:2ec4be320961 | 22 | CmdResult BaseboardIO::init() |
Matt Briggs | 40:2ec4be320961 | 23 | { |
Matt Briggs | 40:2ec4be320961 | 24 | logError("Not implemented yet!!!"); |
Matt Briggs | 40:2ec4be320961 | 25 | } |
Matt Briggs | 40:2ec4be320961 | 26 | |
Matt Briggs | 40:2ec4be320961 | 27 | // Registering for interrupts |
Matt Briggs | 40:2ec4be320961 | 28 | void BaseboardIO::regCCInInt(void (*callback) (void)) |
Matt Briggs | 40:2ec4be320961 | 29 | { |
Matt Briggs | 40:2ec4be320961 | 30 | mCCInIntCallback = callback; |
Matt Briggs | 40:2ec4be320961 | 31 | } |
Matt Briggs | 40:2ec4be320961 | 32 | void BaseboardIO::regTamperInt(void (*callback) (void)) |
Matt Briggs | 40:2ec4be320961 | 33 | { |
Matt Briggs | 40:2ec4be320961 | 34 | mTamperIntCallback = callback; |
Matt Briggs | 40:2ec4be320961 | 35 | } |
Matt Briggs | 40:2ec4be320961 | 36 | void BaseboardIO::regPairBtnInt(void (*callback) (void)) |
Matt Briggs | 40:2ec4be320961 | 37 | { |
Matt Briggs | 40:2ec4be320961 | 38 | logError("Not implemented yet!!!"); |
Matt Briggs | 40:2ec4be320961 | 39 | } |
Matt Briggs | 40:2ec4be320961 | 40 | |
Matt Briggs | 40:2ec4be320961 | 41 | // Input |
Matt Briggs | 40:2ec4be320961 | 42 | CmdResult BaseboardIO::sampleUserSwitches() |
Matt Briggs | 40:2ec4be320961 | 43 | { |
Matt Briggs | 40:2ec4be320961 | 44 | logError("Not implemented yet!!!"); |
Matt Briggs | 40:2ec4be320961 | 45 | return cmdError; |
Matt Briggs | 40:2ec4be320961 | 46 | } |
Matt Briggs | 40:2ec4be320961 | 47 | bool BaseboardIO::isPairBtn() |
Matt Briggs | 40:2ec4be320961 | 48 | { |
Matt Briggs | 40:2ec4be320961 | 49 | logError("Not implemented yet!!!"); |
Matt Briggs | 40:2ec4be320961 | 50 | return false; |
Matt Briggs | 40:2ec4be320961 | 51 | } |
Matt Briggs | 40:2ec4be320961 | 52 | bool BaseboardIO::isCCOutNO() |
Matt Briggs | 40:2ec4be320961 | 53 | { |
Matt Briggs | 40:2ec4be320961 | 54 | logError("Not implemented yet!!!"); |
Matt Briggs | 40:2ec4be320961 | 55 | return false; |
Matt Briggs | 40:2ec4be320961 | 56 | } |
Matt Briggs | 40:2ec4be320961 | 57 | bool BaseboardIO::isRx() |
Matt Briggs | 40:2ec4be320961 | 58 | { |
Matt Briggs | 40:2ec4be320961 | 59 | logError("Not implemented yet!!!"); |
Matt Briggs | 40:2ec4be320961 | 60 | return false; |
Matt Briggs | 40:2ec4be320961 | 61 | } |
Matt Briggs | 40:2ec4be320961 | 62 | bool BaseboardIO::isLoRaWANMode() |
Matt Briggs | 40:2ec4be320961 | 63 | { |
Matt Briggs | 40:2ec4be320961 | 64 | logError("Not implemented yet!!!"); |
Matt Briggs | 40:2ec4be320961 | 65 | return false; |
Matt Briggs | 40:2ec4be320961 | 66 | } |
Matt Briggs | 40:2ec4be320961 | 67 | uint8_t BaseboardIO::rotarySwitch1() |
Matt Briggs | 40:2ec4be320961 | 68 | { |
Matt Briggs | 40:2ec4be320961 | 69 | logError("Not implemented yet!!!"); |
Matt Briggs | 40:2ec4be320961 | 70 | return 0; |
Matt Briggs | 40:2ec4be320961 | 71 | } |
Matt Briggs | 40:2ec4be320961 | 72 | uint8_t BaseboardIO::rotarySwitch2() |
Matt Briggs | 40:2ec4be320961 | 73 | { |
Matt Briggs | 40:2ec4be320961 | 74 | logError("Not implemented yet!!!"); |
Matt Briggs | 40:2ec4be320961 | 75 | return 0; |
Matt Briggs | 40:2ec4be320961 | 76 | } |
Matt Briggs | 40:2ec4be320961 | 77 | |
Matt Briggs | 40:2ec4be320961 | 78 | // Output |
Matt Briggs | 40:2ec4be320961 | 79 | CmdResult BaseboardIO::ledOn() |
Matt Briggs | 40:2ec4be320961 | 80 | { |
Matt Briggs | 40:2ec4be320961 | 81 | logError("Not implemented yet!!!"); |
Matt Briggs | 40:2ec4be320961 | 82 | return cmdError; |
Matt Briggs | 40:2ec4be320961 | 83 | } |
Matt Briggs | 40:2ec4be320961 | 84 | CmdResult BaseboardIO::ledOff() |
Matt Briggs | 40:2ec4be320961 | 85 | { |
Matt Briggs | 40:2ec4be320961 | 86 | logError("Not implemented yet!!!"); |
Matt Briggs | 40:2ec4be320961 | 87 | return cmdError; |
Matt Briggs | 40:2ec4be320961 | 88 | } |
Matt Briggs | 40:2ec4be320961 | 89 | CmdResult BaseboardIO::relayAlert() |
Matt Briggs | 40:2ec4be320961 | 90 | { |
Matt Briggs | 40:2ec4be320961 | 91 | logError("Not implemented yet!!!"); |
Matt Briggs | 40:2ec4be320961 | 92 | return cmdError; |
Matt Briggs | 40:2ec4be320961 | 93 | } |
Matt Briggs | 40:2ec4be320961 | 94 | CmdResult BaseboardIO::relayNormal() |
Matt Briggs | 40:2ec4be320961 | 95 | { |
Matt Briggs | 40:2ec4be320961 | 96 | logError("Not implemented yet!!!"); |
Matt Briggs | 40:2ec4be320961 | 97 | return cmdError; |
Matt Briggs | 40:2ec4be320961 | 98 | } |
Matt Briggs | 40:2ec4be320961 | 99 | |
Matt Briggs | 40:2ec4be320961 | 100 | // Future |
Matt Briggs | 40:2ec4be320961 | 101 | CmdResult BaseboardIO::serialRx(bool enable) |
Matt Briggs | 40:2ec4be320961 | 102 | { |
Matt Briggs | 40:2ec4be320961 | 103 | logError("Not implemented yet!!!"); |
Matt Briggs | 40:2ec4be320961 | 104 | return cmdError; |
Matt Briggs | 40:2ec4be320961 | 105 | } |
Matt Briggs | 40:2ec4be320961 | 106 | CmdResult BaseboardIO::serialTx(bool enable) |
Matt Briggs | 40:2ec4be320961 | 107 | { |
Matt Briggs | 40:2ec4be320961 | 108 | logError("Not implemented yet!!!"); |
Matt Briggs | 40:2ec4be320961 | 109 | return cmdError; |
Matt Briggs | 40:2ec4be320961 | 110 | } |
Matt Briggs | 40:2ec4be320961 | 111 | |
Matt Briggs | 40:2ec4be320961 | 112 | // private |
Matt Briggs | 40:2ec4be320961 | 113 | |
Matt Briggs | 40:2ec4be320961 | 114 | CmdResult readInfoFromEEPROM() |
Matt Briggs | 40:2ec4be320961 | 115 | { |
Matt Briggs | 40:2ec4be320961 | 116 | logError("Not implemented yet!!!"); |
Matt Briggs | 40:2ec4be320961 | 117 | return cmdError; |
Matt Briggs | 40:2ec4be320961 | 118 | } |
Matt Briggs | 40:2ec4be320961 | 119 | CmdResult writeInfoToEEPROM() |
Matt Briggs | 40:2ec4be320961 | 120 | { |
Matt Briggs | 40:2ec4be320961 | 121 | logError("Not implemented yet!!!"); |
Matt Briggs | 40:2ec4be320961 | 122 | return cmdError; |
Matt Briggs | 40:2ec4be320961 | 123 | } |
Matt Briggs | 40:2ec4be320961 | 124 | CmdResult identifyPortExpanders() |
Matt Briggs | 40:2ec4be320961 | 125 | { |
Matt Briggs | 40:2ec4be320961 | 126 | logError("Not implemented yet!!!"); |
Matt Briggs | 40:2ec4be320961 | 127 | return cmdError; |
Matt Briggs | 40:2ec4be320961 | 128 | } |