mDot AT-Firmware for testing

Dependencies:   MTS-Serial libmDot-mbed5

Fork of Dot-AT-Firmware by MultiTech

Committer:
Fran6
Date:
Mon Aug 14 12:40:21 2017 +0000
Revision:
16:3b1d46c1db11
Parent:
14:f9a77400b622
mDot AT-Firmware

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Mike Fiore 9:ff62b20f7000 1 #include "mbed.h"
Mike Fiore 9:ff62b20f7000 2 #include "mDot.h"
Mike Fiore 9:ff62b20f7000 3 #include "CommandTerminal.h"
Mike Fiore 9:ff62b20f7000 4 #include "ATSerial.h"
Mike Fiore 9:ff62b20f7000 5 #include "ATSerialFlowControl.h"
Mike Fiore 9:ff62b20f7000 6
Mike Fiore 9:ff62b20f7000 7 #define SERIAL_BUFFER_SIZE 512
Mike Fiore 9:ff62b20f7000 8
Mike Fiore 14:f9a77400b622 9 Serial debug(USBTX, USBRX);
Mike Fiore 14:f9a77400b622 10
Mike Fiore 14:f9a77400b622 11 #ifndef UNIT_TEST
Mike Fiore 9:ff62b20f7000 12
Mike Fiore 9:ff62b20f7000 13 int main()
Mike Fiore 9:ff62b20f7000 14 {
Mike Fiore 9:ff62b20f7000 15 debug.baud(115200);
Mike Fiore 9:ff62b20f7000 16
Mike Fiore 9:ff62b20f7000 17 mDot* dot = mDot::getInstance();
Mike Fiore 9:ff62b20f7000 18
Mike Fiore 9:ff62b20f7000 19 // Seed the RNG
Mike Fiore 9:ff62b20f7000 20 srand(dot->getRadioRandom());
Mike Fiore 9:ff62b20f7000 21
Mike Fiore 9:ff62b20f7000 22 mts::ATSerial* serial;
Mike Fiore 9:ff62b20f7000 23
Mike Fiore 9:ff62b20f7000 24 if (dot->getFlowControl())
Mike Fiore 14:f9a77400b622 25 #if defined(TARGET_MTS_MDOT_F411RE)
Mike Fiore 9:ff62b20f7000 26 serial = new mts::ATSerialFlowControl(XBEE_DOUT, XBEE_DIN, XBEE_RTS, XBEE_CTS, SERIAL_BUFFER_SIZE, SERIAL_BUFFER_SIZE);
Mike Fiore 14:f9a77400b622 27 #else
Mike Fiore 14:f9a77400b622 28 serial = new mts::ATSerialFlowControl(UART1_TX, UART1_RX, UART1_RTS, UART1_CTS, SERIAL_BUFFER_SIZE, SERIAL_BUFFER_SIZE);
Mike Fiore 14:f9a77400b622 29 #endif
Mike Fiore 9:ff62b20f7000 30 else
Mike Fiore 14:f9a77400b622 31 #if defined(TARGET_MTS_MDOT_F411RE)
Mike Fiore 9:ff62b20f7000 32 serial = new mts::ATSerial(XBEE_DOUT, XBEE_DIN, SERIAL_BUFFER_SIZE, SERIAL_BUFFER_SIZE);
Mike Fiore 14:f9a77400b622 33 #else
Mike Fiore 14:f9a77400b622 34 serial = new mts::ATSerial(UART1_TX, UART1_RX, SERIAL_BUFFER_SIZE, SERIAL_BUFFER_SIZE);
Mike Fiore 14:f9a77400b622 35 #endif
Mike Fiore 9:ff62b20f7000 36
Mike Fiore 9:ff62b20f7000 37 debug.baud(dot->getDebugBaud());
Mike Fiore 9:ff62b20f7000 38 serial->baud(dot->getBaud());
Mike Fiore 9:ff62b20f7000 39
Mike Fiore 14:f9a77400b622 40 CommandTerminal term(*serial);
Mike Fiore 14:f9a77400b622 41 CommandTerminal::_dot = dot;
Mike Fiore 14:f9a77400b622 42
Mike Fiore 14:f9a77400b622 43 term.init();
Mike Fiore 9:ff62b20f7000 44
Mike Fiore 9:ff62b20f7000 45 term.start();
Mike Fiore 9:ff62b20f7000 46 }
Mike Fiore 14:f9a77400b622 47
Mike Fiore 14:f9a77400b622 48 #endif // UNIT_TEST
Mike Fiore 14:f9a77400b622 49