Fork to see if I can get working
Dependencies: BufferedSerial OneWire WinbondSPIFlash libxDot-dev-mbed5-deprecated
Fork of xDotBridge_update_test20180823 by
Revision 67:2115a2f1b945, committed 2017-03-21
- Comitter:
- Matt Briggs
- Date:
- Tue Mar 21 13:04:31 2017 -0600
- Parent:
- 66:bcaa6dbf538a
- Child:
- 68:51c25f4f6d9a
- Commit message:
- For real added disabling test mode to DS2408. Plus other incremental changes to code.
Changed in this revision
Binary file testBbio_v2_20170221.bin has changed
Binary file testBbio_v7_20170321.bin has changed
--- a/xDotBridge.doxyfile Wed Mar 15 11:46:40 2017 -0600 +++ b/xDotBridge.doxyfile Tue Mar 21 13:04:31 2017 -0600 @@ -38,7 +38,7 @@ # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 0.1 +PROJECT_NUMBER = 0.2 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a
--- a/xDotBridge/README.md Wed Mar 15 11:46:40 2017 -0600
+++ b/xDotBridge/README.md Tue Mar 21 13:04:31 2017 -0600
@@ -1,5 +1,5 @@
# xDotBridge Documentation {#mainpage}
-# Introduction
+## Introduction
This project is intended to support multiple products including Wireless
Bridge, MTS comm board, and camera comm board. The stretch goal of using a
single binary and intuiting all the different configurations. At a minimum it
@@ -87,29 +87,24 @@
TODO
#### Brute force alert message
-==============================================
-= Offset | Size (in Bytes) | Name =
-==============================================
-= 0x00 | 2 Bytes | Alert Msg Flag (0xEF10) =
-==============================================
-= 0x02 | 8 Bytes | xDot EUI =
-==============================================
-= 0x0A | 2 Bytes | Alert Data =
-==============================================
-= 0x0C | 4 Bytes | Alert Sequence Number =
-==============================================
+
+ Offset | Size (in Bytes) | Name
+------- | --------------- |-----------------
+ 0x00 | 2 Bytes | Alert Msg Flag (0xEF10)
+ 0x02 | 8 Bytes | xDot EUI
+ 0x0A | 2 Bytes | Alert Data
+ 0x0C | 4 Bytes | Alert Sequence Number
+
Total of 16 bytes
#### Brute force pair request message
-==============================================
-= Offset | Size (in Bytes) | Name =
-==============================================
-= 0x00 | 2 Bytes | Pair Request Flag (0xFE01)=
-==============================================
-= 0x02 | 8 Bytes | xDot EUI (requester) =
-==============================================
-= 0x0A | 6 Bytes | Reserved =
-==============================================
+
+ Offset | Size (in Bytes) | Name
+------- | --------------- |-----------------
+ 0x00 | 2 Bytes | Pair Request Flag (0xFE01)
+ 0x02 | 8 Bytes | xDot EUI (requester)
+ 0x0A | 6 Bytes | Reserved
+
* Total of 16 Bytes
Ideas for reserved:
@@ -117,21 +112,16 @@
* Messages generated
#### Brute force pair accept message
-==============================================
-= Offset | Size (in Bytes) | Name =
-==============================================
-= 0x00 | 2 Bytes | Pair Accept Flag (0xFD02) =
-==============================================
-= 0x02 | 8 Bytes | xDot EUI (RX Master) =
-==============================================
-= 0x0A | 4 Bytes | Reserved for Frequency =
-==============================================
-= 0x0E | 4 Bytes | Network Address =
-==============================================
-= 0x12 | 16 Bytes | Network Session Key =
-==============================================
-= 0x22 | 16 Bytes | Data session Key =
-==============================================
+
+ Offset | Size (in Bytes) | Name
+------- | --------------- | -----------------
+ 0x00 | 2 Bytes | Pair Accept Flag (0xFD02)
+ 0x02 | 8 Bytes | xDot EUI (RX Master)
+ 0x0A | 4 Bytes | Reserved for Frequency
+ 0x0E | 4 Bytes | Network Address
+ 0x12 | 16 Bytes | Network Session Key
+ 0x22 | 16 Bytes | Data session Key
+
* Total of 34 Bytes
## Peer to Peer Pair
@@ -192,44 +182,31 @@
* ULC
## Protocol Parameters
-==============================================
-= Dot Relative Addr | Size (in Bytes) | Name =
-==============================================
-= 0x1000 | 02 Bytes | Protocol Flag =
-==============================================
-= 0x1002 | 02 Bytes | Protocol Rev =
-==============================================
-= 0x1004 | 04 Bytes | Reserved for Frequency =
-==============================================
-= 0x1008 | 04 Bytes | Network Address =
-==============================================
-= 0x1010 | 16 Bytes | Network Session Key =
-==============================================
-= 0x1020 | 16 Bytes | Data Session Key =
-==============================================
-= 0x1030 | 02 Bytes | Logical Address Serial =
-==============================================
-= 0x1032 | 04 Bytes | Last Message SeqNum =
-==============================================
-Space needed is 54 bytes. Spaced used is 50 bytes
+
+ Dot Relative Addr | Size (in Bytes) | Name
+ ----------------- | --------------- | ---------
+ 0x1000 | 02 Bytes | Protocol Flag
+ 0x1002 | 02 Bytes | Protocol Rev
+ 0x1004 | 04 Bytes | Reserved for Frequency
+ 0x1008 | 04 Bytes | Network Address
+ 0x1010 | 16 Bytes | Network Session Key
+ 0x1020 | 16 Bytes | Data Session Key
+ 0x1030 | 02 Bytes | Logical Address Serial
+ 0x1032 | 04 Bytes | Last Message SeqNum
+
+Space needed is 50 bytes. Spaced used is 54 bytes
for better word alignment.
## IO Baseboard Parameters
-==============================================
-= Dot Relative Addr | Size (in Bytes) | Name =
-==============================================
-= 0x1100 | 2 Bytes | Baseboard Flag =
-==============================================
-= 0x1102 | 2 Bytes | Baseboard Rev =
-==============================================
-= 0x1104 | 2 Bytes | Baseboard Serial =
-==============================================
-= 0x1106 | 2 Bytes | Baseboard Configuration =
-==============================================
-= 0x1110 | 8 Bytes | PortEx0 64 bit ROM Addr =
-==============================================
-= 0x1118 | 8 Bytes | PortEx1 64 bit ROM Addr =
-==============================================
+
+ Dot Relative Addr | Size (in Bytes) | Name
+ ----------------- | --------------- | ---------
+ 0x1100 | 2 Bytes | Baseboard Flag
+ 0x1102 | 2 Bytes | Baseboard Rev
+ 0x1104 | 2 Bytes | Baseboard Serial
+ 0x1106 | 2 Bytes | Baseboard Configuration
+ 0x1110 | 8 Bytes | PortEx0 64 bit ROM Addr
+ 0x1118 | 8 Bytes | PortEx1 64 bit ROM Addr
Space needed is 24 bytes. Space used is 32 bytes.
--- a/xDotBridge/TESTS/autoLibs/testDs2408/testAPI.cpp Wed Mar 15 11:46:40 2017 -0600
+++ b/xDotBridge/TESTS/autoLibs/testDs2408/testAPI.cpp Tue Mar 21 13:04:31 2017 -0600
@@ -41,22 +41,11 @@
}
/**
- * Test the init function returns correctly
- */
-void test_init() {
- DS2408 ds2408(&OWMaster, ds2408Addr);
- CmdResult result = ds2408.init();
- TEST_ASSERT(result == cmdSuccess);
-}
-
-/**
* Checks that in idle state all the IOs are pulled up.
*/
void test_idle_state() {
DS2408 ds2408(&OWMaster, ds2408Addr);
CmdResult result;
- result = ds2408.init();
- TEST_ASSERT(result == cmdSuccess);
#ifdef USE_RELIABLE
result = ds2408.pioLogicReliableWrite(0xFF); // Leave all IOs high Z e.g. should float high
@@ -81,8 +70,6 @@
*/
void test_walk_the_zero() {
DS2408 ds2408(&OWMaster, ds2408Addr);
- CmdResult result = ds2408.init();
- TEST_ASSERT(result == cmdSuccess);
#ifdef USE_RELIABLE
result = ds2408.pioLogicReliableWrite(0xFF); // Leave all IOs high Z e.g. should float high
@@ -130,7 +117,7 @@
// Test cases
Case cases[] = {
Case("Testing search", test_search),
- Case("Testing init", test_init),
+// Case("Testing init", test_init),
Case("Testing idle state", test_idle_state),
Case("Test walking the zero", test_walk_the_zero)
};
--- a/xDotBridge/config.h Wed Mar 15 11:46:40 2017 -0600 +++ b/xDotBridge/config.h Tue Mar 21 13:04:31 2017 -0600 @@ -5,10 +5,10 @@ #ifndef CONFIG_H_ #define CONFIG_H_ -//#define __TEST__ 1 // Comment out for main application +#define __TEST__ 1 // Comment out for main application // Manual test. Comment out for main application. Or uncomment for individual test. -//#define __TEST_BBIO__ +#define __TEST_BBIO__ //#define __TEST_LRR__ //#define __TEST_PVD__ //#define __TEST_XDOT_DEV_COMM__
--- a/xDotBridge/inc/DS2408.h Wed Mar 15 11:46:40 2017 -0600
+++ b/xDotBridge/inc/DS2408.h Tue Mar 21 13:04:31 2017 -0600
@@ -31,8 +31,7 @@
/**
* @brief DS2408 constructor
*
- * @details Just initialized internal variables does not configure device
- * use init() for that.
+ * @details Just initialized internal variables and disables test mode
*
* On Entry:
* @param[in] owMaster - reference to 1-wire master
@@ -45,19 +44,6 @@
DS2408(OneWire *owMaster, uint8_t romAddr[8]);
/**
- * @brief init()
- *
- * @details Just a placeholder for now. Does initiate a reset on the OneWire bus.
- *
- * On Entry:
- *
- * On Exit:
- *
- * @return Result of operation zero for success
- */
- CmdResult init();
-
- /**
* @brief registerRead()
*
* @details reads state of pio
--- a/xDotBridge/manualTest/testBaseboardIO/testBaseboardIO.cpp Wed Mar 15 11:46:40 2017 -0600
+++ b/xDotBridge/manualTest/testBaseboardIO/testBaseboardIO.cpp Tue Mar 21 13:04:31 2017 -0600
@@ -4,12 +4,13 @@
#include "BaseboardIO.h"
//#include "MTSLog.h"
#include "dot_util.h"
+#include "MyLog.h"
#ifdef __TEST_BBIO__
mDot* dot = NULL; // Used by dot-utils
Serial pc(USBTX, USBRX); // Externally defined
-const int VERSION = 5;
+const int VERSION = 7;
char* bool2Str(bool in) {
if (in) {
@@ -113,7 +114,7 @@
pc.printf("= Tamper. State: N/A IntCnt: %04d =\r\n",
tamperIntCnt);
pc.printf("= CCIN. State: %s IntCnt: %02d =\r\n",
- bool2Str(0), ccInIntCnt);
+ bool2Str(mBbio->isCCInAlert()), ccInIntCnt);
pc.printf("= PVD (BROKEN). State: N/A IntCnt: %02d =\r\n",
pvdIntCnt);
pc.printf("= CC Normally Closed. State: %s =\r\n", bool2Str(mBbio->isCCNC()));
@@ -141,6 +142,7 @@
pc.baud(115200);
mts::MTSLog::setLogLevel(mts::MTSLog::TRACE_LEVEL);
+ MyLog::setLogLevel(MyLog::DEBUG_LEVEL);
wait(1.0);
--- a/xDotBridge/src/DS2408.cpp Wed Mar 15 11:46:40 2017 -0600
+++ b/xDotBridge/src/DS2408.cpp Tue Mar 21 13:04:31 2017 -0600
@@ -10,11 +10,7 @@
{
mMaster = owMaster;
std::memcpy(mRomAddr, romAddr, sizeof(mRomAddr));
-}
-
-CmdResult DS2408::init()
-{
- return disableTestMode();
+ disableTestMode();
}
CmdResult DS2408::registerReadReliable(uint8_t addr, uint8_t &val)
--- a/xDotBridge/src/main.cpp Wed Mar 15 11:46:40 2017 -0600
+++ b/xDotBridge/src/main.cpp Tue Mar 21 13:04:31 2017 -0600
@@ -135,6 +135,7 @@
unsigned int loopCnt = 0; // Just a quick temp varaible to keep track of loopNums
bool prevCCNormallyOpen;
PairBtnState pairBtnState;
+ uint32_t rxMsgCnt = 0;
/**
* Main Loop
*/
@@ -253,7 +254,7 @@
uint16_t data;
uint32_t msgSeqNum;
protocol->recvAlert(txEui, data, msgSeqNum);
- myLogInfo("Got msg num: %d", msgSeqNum);
+ myLogInfo("Got msg #%d, with Seqnum: %d", rxMsgCnt, msgSeqNum);
bbio->relayAlert();
ledPatterns.turnOn();
myLogInfo("Holding alert for %f secs", HoldTimeSetting::rotVal2Sec(bbio->rotarySwitch1()));
