this is a direct fork of example-ublox-cellular-interface that adds support for USBSerial, and leverages the geneva-cellular-driver library.
Dependencies: ublox-at-cellular-interface ublox-cellular-base
Diff: main.cpp
- Revision:
- 42:33504aa2fe69
- Parent:
- 38:e09e02c31ba1
--- a/main.cpp Tue Aug 27 19:11:55 2019 +0500 +++ b/main.cpp Wed Sep 04 02:25:09 2019 +0000 @@ -15,8 +15,14 @@ */ #include "mbed.h" #include "UbloxATCellularInterface.h" -#include "UbloxATCellularInterfaceN2xx.h" +#include "USBSerial.h" +/******************** Comms *********************/ +USBSerial pc(true); +FileHandle* mbed::mbed_override_console(int) +{ + return &pc; +} // You must select the correct interface library for your board, by // uncommenting the correct line below. Supported combinations are // indicated with a "Y" in the table below. @@ -34,7 +40,6 @@ // library). However, it is slower than using the LWIP/PPP on the mbed // MCU interface since more string parsing is required. #define INTERFACE_CLASS UbloxATCellularInterface -//#define INTERFACE_CLASS UbloxATCellularInterfaceN2xx // The credentials of the SIM in the board. If PIN checking is enabled // for your SIM card you must set this to the required PIN. @@ -47,15 +52,15 @@ // username and password NULL), or you may leave all three as NULL and then // a lookup will be attempted for a small number of known networks // (see APN_db.h in mbed-os/features/netsocket/cellular/utils). -#define APN NULL +#define APN "hologram" #define USERNAME NULL #define PASSWORD NULL #define TCP_SERVER "os.mbed.com" // LEDs -DigitalOut ledRed(LED1, 1); -DigitalOut ledGreen(LED2, 1); -DigitalOut ledBlue(LED3, 1); +DigitalOut ledRed(LED_RED, 1); +DigitalOut ledGreen(LED_GREEN, 1); +DigitalOut ledBlue(LED_BLUE, 1); // The user button volatile bool buttonPressed = false; @@ -130,14 +135,14 @@ int main() { - INTERFACE_CLASS *interface = new INTERFACE_CLASS(); +// INTERFACE_CLASS *interface = new INTERFACE_CLASS(); // If you need to debug the cellular interface, comment out the // instantiation above and uncomment the one below. // For the N2xx interface, change xxx to MBED_CONF_UBLOX_CELL_BAUD_RATE, // while for the non-N2xx interface change it to MBED_CONF_UBLOX_CELL_N2XX_BAUD_RATE. -// INTERFACE_CLASS *interface = new INTERFACE_CLASS(MDMTXD, MDMRXD, -// xxx, -// true); + INTERFACE_CLASS *interface = new INTERFACE_CLASS(MDMTXD, MDMRXD, + 115200, + true); #ifndef TARGET_UBLOX_C030_N211 TCPSocket sockTcp; #endif @@ -151,7 +156,7 @@ // No user button on C027 InterruptIn userButton(NC); #else - InterruptIn userButton(SW0); + InterruptIn userButton(USR_BTN); #endif // Attach a function to the user button