
DSGateway sketch program for Nucleo. This program is using DSGatewayLibMBED
Dependencies: DSgatewayMBED mbed TrackReporterS88_DS
Diff: main.cpp
- Revision:
- 2:4bece8af05e8
- Parent:
- 1:28c58a355b7f
diff -r 28c58a355b7f -r 4bece8af05e8 main.cpp --- a/main.cpp Sat Jan 24 06:46:34 2015 +0000 +++ b/main.cpp Sat Jan 31 22:16:02 2015 +0000 @@ -1,5 +1,6 @@ #include "mbed.h" #include "DSGatewayMBED.h" +#include "TrackReporterS88_DS.h" #include <string> #define MAX_S88DECODER 1 @@ -12,6 +13,7 @@ /* class definition */ Serial serial_pc(SERIAL_TX, SERIAL_RX); DSGatewayLib ds_gw; +TrackReporterS88_DS reporter(MAX_S88DECODER); int gCounter = 0; string gReceivedMessage; @@ -142,7 +144,7 @@ } boolean dispatch() { - boolean aResult; + //boolean aResult; if (function.compare("setLocoDirection") == 0) { return ds_gw.SetLocoDirection(arguments[0], (unsigned char)arguments[1]); @@ -168,7 +170,7 @@ aMaxS88Num = arguments[0]; } - //reporter.refresh(aMaxS88Num); + reporter.refresh(aMaxS88Num); //Send a S88 sensor reply serial_pc.printf("@S88,"); @@ -177,8 +179,8 @@ for( int j = 0; j < aMaxS88Num; j++) { - //aFlags = (reporter.getByte((j << 1) + 1) << 8) + reporter.getByte(j << 1); - aFlags = 0; + aFlags = (reporter.getByte((j << 1) + 1) << 8) + reporter.getByte(j << 1); + //aFlags = 0; serial_pc.printf("%x", aFlags); serial_pc.printf(",");