Example program demonstrating sending and reading SMS messages from the cellular modem using the MTSAS library.

Dependencies:   mbed-src mtsas

Revision:
11:159b76eafb5c
Parent:
9:58dba06c3042
--- a/main.cpp	Thu Jul 09 15:44:59 2015 +0000
+++ b/main.cpp	Thu Jul 09 19:04:55 2015 +0000
@@ -1,7 +1,45 @@
 #include "mbed.h"
 #include "mtsas.h"
 
+/******************************** NOTE *******************************/
+/******** Uncomment the hardware platform you are working on. ********/
+#define DRAGONFLY
+//#define NUCLEO_F401RE
+//#define FREESCALE_KL46Z
+//#define FREESCALE_K64F
+/*********************************************************************/
+
 int main(){
+
+#if defined(DRAGONFLY)
+    /** Dragonfly
+    * To configure the serial pins for the Dragonfly board, use:
+    * RADIO_TX = pin PC_7, RADIO_RX = pin PC_6
+    * RADIO_RTS = pin PB_10,RADIO_CTS = pin PB_12
+    */
+    MTSSerialFlowControl* io = new MTSSerialFlowControl(RADIO_TX, RADIO_RX, RADIO_RTS, RADIO_CTS);
+#elif defined(NUCLEO_F401RE)
+    /** STMicro Nucleo F401RE
+    * The supported jumper configurations of the MTSAS do not line up with
+    * the pin mapping of the Nucleo F401RE. Therefore, the MTSAS serial TX
+    * pin (JP8 Pin 2) must be manually jumped to Serial1 RX (Shield pin D2)
+    * and the MTSAS serial RX pin (JP9 Pin 2) pin must be manually jumped to
+    * Serial1 TX (Shield pin D8).
+    */
+    MTSSerialFlowControl* io = new MTSSerialFlowControl(D8, D2, D3, D6);
+#elif defined(FREESCALE_KL46Z)
+    /** Freescale KL46Z
+    * To configure the serial pins for the Freescale KL46Z board, use MTSAS jumper
+    * configuration B.
+    */
+    MTSSerialFlowControl* io = new MTSSerialFlowControl(D2, D9, D3, D6);
+#elif defined(FREESCALE_K64F)    
+    /** Freescale K64F
+    * To configure the serial pins for the Freescale K64F board, use MTSAS jumper
+    * configuration A.
+    */
+    MTSSerialFlowControl* io = new MTSSerialFlowControl(D1, D0, D3, D6);
+#endif
     
     //Sets the log level to INFO, higher log levels produce more log output.
     //Possible levels: NONE, FATAL, ERROR, WARNING, INFO, DEBUG, TRACE
@@ -17,36 +55,6 @@
     txtmsg.phoneNumber = PHONE_NUMBER;
     txtmsg.message = "Hello World! MTSAS is up and running!";
     
-    /** STMicro Nucelo F401RE
-    * The supported jumper configurations of the MTSAS do not line up with
-    * the pin mapping of the Nucleo F401RE. Therefore, the MTSAS serial TX
-    * pin (JP8 Pin 2) must be manually jumped to Serial1 RX (Shield pin D2)
-    * and the MTSAS serial RX pin (JP9 Pin 2) pin must be manually jumped to
-    * Serial1 TX (Shield pin D8).
-    * Uncomment the following line to use the STMicro Nuceleo F401RE
-    */
-    MTSSerialFlowControl* io = new MTSSerialFlowControl(D8, D2, D3, D6);
-    
-    /** Dragonfly
-    * To configure the serial pins for the Dragonfly board, use:
-    * RADIO_TX = pin PC_7, RADIO_RX = pin PC_6
-    * RADIO_RTS = pin PB_10,RADIO_CTS = pin PB_12
-    * Uncomment the following line to use the Dragonfly board
-    */
-    //MTSSerialFlowControl* io = new MTSSerialFlowControl(RADIO_TX, RADIO_RX, RADIO_RTS, RADIO_CTS);
-    
-    /** Freescale KL46Z
-    * To configure the serial pins for the Freescale KL46Z board, use MTSAS jumper
-    * configuration B. Uncomment the following line to use the Freescale KL46Z board
-    */
-    //MTSSerialFlowControl* io = new MTSSerialFlowControl(D2, D9, D3, D6);
-    
-    /** Freescale K64F
-    * To configure the serial pins for the Freescale K64F board, use MTSAS jumper
-    * configuration A. Uncomment the following line to use the Freescale K64F board
-    */
-    //MTSSerialFlowControl* io = new MTSSerialFlowControl(D1, D0, D3, D6);
-    
     //Sets the baud rate for communicating with the radio
     io->baud(115200);