![](/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
Diff: xDotBridge/src/main.cpp
- Revision:
- 38:8a512e23d99e
- Parent:
- 37:31f8e9c5d075
- Child:
- 39:64f79fa6e3cc
diff -r 31f8e9c5d075 -r 8a512e23d99e xDotBridge/src/main.cpp --- a/xDotBridge/src/main.cpp Wed Jan 25 16:22:14 2017 -0700 +++ b/xDotBridge/src/main.cpp Thu Jan 26 16:23:45 2017 -0700 @@ -44,6 +44,7 @@ //DigitalIn wake_DOUT(WAKE); //DigitalIn i2cOut1(I2C1_SCL); //DigitalIn i2cOut2(I2C1_SDA); +InterruptIn intTest(I2C1_SDA); //DigitalIn uartOut1(UART1_CTS); //DigitalIn uartOut2(UART1_RTS); //DigitalIn jtag_gpio1(SWDIO); @@ -258,6 +259,8 @@ // I/O Play // ////////////// + // Check interrupt + // // Check Analog // logInfo("Read AN1/GPIO1: %f", an1.read()); // logInfo("Read AN2/GPIO2: %f", an2.read()); // Ranges from 0.0 to 1.0 @@ -296,61 +299,57 @@ // OneWire Play // ////////////////// - logInfo("Starting OneWire Play"); - OneWire owMaster(I2C_SDA); - uint8_t addr[8]; - uint8_t result; - - // Search Bus - logInfo("Starting OneWire Search"); - do { - result = owMaster.search(addr); - logInfo("ROM Addr: %02x:%02x:%02x:%02x:%02x:%02x:%02x%02x\n", - addr[7],addr[6],addr[5],addr[4],addr[3],addr[2],addr[1],addr[0]); - } while (result == 1); - logInfo("Finished OneWire Search"); - wait(1.0); - - uint8_t pioStateAddr[] = {0x88, 0x00}; - uint8_t pioLatchAddr[] = {0x89, 0x00}; - uint8_t printAddr = 0x88; - while (true) { - owMaster.reset(); - owMaster.select(addr); - owMaster.write(0xF0); // Read Register Command - owMaster.write_bytes(pioStateAddr, 2); // Write 2 byte addr - printAddr = 0x88; - for (int i=0;i<8;i++) { - result = owMaster.read(); - logInfo("%02x Reg Value: %02x\n", printAddr++, result); - } - - owMaster.reset(); - owMaster.select(addr); - owMaster.write(0xF0); // Read Register Command - owMaster.write_bytes(pioLatchAddr, 2); // Write 2 byte addr - result = owMaster.read(); - logInfo("Latch Reg Value: %02x\n", result); - // TODO try reading inverted 16-bit CRC - - wait(1.0); - // Try write - owMaster.reset(); - owMaster.select(addr); - owMaster.write(0x5A); // Channel Access Write Command - uint8_t val = ~0xAA; - owMaster.write(val); // Pull-down all even bits - owMaster.write(~val); // Pull-down all even bits - result = owMaster.read(); - logInfo("Confirm after write value: %02x, expected %02x\n", result, 0xAA); - - // Check if the read back is just a latch reg thing or a true logic state - wait(1.0); - +// logInfo("Starting OneWire Play"); +// OneWire owMaster(I2C_SDA); +// uint8_t addr[8]; +// uint8_t result; +// +// // Search Bus +// logInfo("Starting OneWire Search"); +// do { +// result = owMaster.search(addr); +// logInfo("ROM Addr: %02x:%02x:%02x:%02x:%02x:%02x:%02x%02x\n", +// addr[7],addr[6],addr[5],addr[4],addr[3],addr[2],addr[1],addr[0]); +// } while (result == 1); +// logInfo("Finished OneWire Search"); +// wait(1.0); +// +// uint8_t pioStateAddr[] = {0x88, 0x00}; +// uint8_t pioLatchAddr[] = {0x89, 0x00}; +// uint8_t printAddr = 0x88; +// while (true) { +// owMaster.reset(); +// owMaster.select(addr); +// owMaster.write(0xF0); // Read Register Command +// owMaster.write_bytes(pioStateAddr, 2); // Write 2 byte addr +// printAddr = 0x88; +// for (int i=0;i<8;i++) { +// result = owMaster.read(); +// logInfo("%02x Reg Value: %02x\n", printAddr++, result); +// } +// +// owMaster.reset(); +// owMaster.select(addr); +// owMaster.write(0xF0); // Read Register Command +// owMaster.write_bytes(pioLatchAddr, 2); // Write 2 byte addr +// result = owMaster.read(); +// logInfo("Latch Reg Value: %02x\n", result); +// // TODO try reading inverted 16-bit CRC +// +// wait(1.0); +// // Try write +// owMaster.reset(); +// owMaster.select(addr); +// owMaster.write(0x5A); // Channel Access Write Command +// uint8_t val = ~0xAA; +// owMaster.write(val); // Pull-down all even bits +// owMaster.write(~val); // Pull-down all even bits +// result = owMaster.read(); +// logInfo("Confirm after write value: %02x, expected %02x\n", result, 0xAA); +// +// // Check if the read back is just a latch reg thing or a true logic state +// wait(1.0); } - - - } return 0;