This mDot firmware will allow USB to directly utilize AT command without the need the use of RS232 DB9 port.
Dependencies: MTS-Serial libmDot mbed-rtos mbed
Fork of mDot_USB_AT_firmware by
main.cpp@14:eecf7851d6ff, 2016-10-19 (annotated)
- Committer:
- ahario
- Date:
- Wed Oct 19 10:26:54 2016 +0000
- Revision:
- 14:eecf7851d6ff
- Parent:
- 13:4830e5bf89cc
Update from libmDot has overwritten the orginal main.cpp; ; Main.cpp has been updated again to allow AT command to be accessed via USB
Who changed what in which revision?
User | Revision | Line number | New 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" |
ahario | 13:4830e5bf89cc | 6 | |
Mike Fiore |
9:ff62b20f7000 | 7 | #define SERIAL_BUFFER_SIZE 512 |
ahario | 13:4830e5bf89cc | 8 | |
ahario | 13:4830e5bf89cc | 9 | //mts::ATSerial debug(USBTX, USBRX); |
ahario | 13:4830e5bf89cc | 10 | Serial debug(XBEE_DOUT, XBEE_DIN); |
ahario | 13:4830e5bf89cc | 11 | |
Mike Fiore |
9:ff62b20f7000 | 12 | int main() |
Mike Fiore |
9:ff62b20f7000 | 13 | { |
Mike Fiore |
9:ff62b20f7000 | 14 | debug.baud(115200); |
ahario | 13:4830e5bf89cc | 15 | |
Mike Fiore |
9:ff62b20f7000 | 16 | mDot* dot = mDot::getInstance(); |
ahario | 13:4830e5bf89cc | 17 | |
Mike Fiore |
9:ff62b20f7000 | 18 | // Seed the RNG |
Mike Fiore |
9:ff62b20f7000 | 19 | srand(dot->getRadioRandom()); |
ahario | 13:4830e5bf89cc | 20 | |
ahario | 13:4830e5bf89cc | 21 | //Create pointer to ATSerial class |
Mike Fiore |
9:ff62b20f7000 | 22 | mts::ATSerial* serial; |
ahario | 13:4830e5bf89cc | 23 | |
Mike Fiore |
9:ff62b20f7000 | 24 | if (dot->getFlowControl()) |
ahario | 13:4830e5bf89cc | 25 | //if MDOT_OK set serial to be connected to DB9 pin |
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 |
9:ff62b20f7000 | 27 | else |
ahario | 13:4830e5bf89cc | 28 | //Else if not MDOT_OK set ATSerial class pointer to |
ahario | 13:4830e5bf89cc | 29 | serial = new mts::ATSerial(USBTX, USBRX, SERIAL_BUFFER_SIZE, SERIAL_BUFFER_SIZE); |
ahario | 13:4830e5bf89cc | 30 | |
Mike Fiore |
9:ff62b20f7000 | 31 | debug.baud(dot->getDebugBaud()); |
Mike Fiore |
9:ff62b20f7000 | 32 | serial->baud(dot->getBaud()); |
ahario | 13:4830e5bf89cc | 33 | |
ahario | 13:4830e5bf89cc | 34 | //Create object form CommandTerminal.cpp using constructor |
ahario | 13:4830e5bf89cc | 35 | //CommandTerminal(mts::ATSerial& serial, mDot* dot) |
Mike Fiore |
9:ff62b20f7000 | 36 | CommandTerminal term(*serial, dot); |
ahario | 13:4830e5bf89cc | 37 | |
Mike Fiore |
9:ff62b20f7000 | 38 | term.start(); |
ahario | 13:4830e5bf89cc | 39 | } |