Use display to show serial message Only for test

Dependencies:   EFM32_SegmentLCD IOFuncLib mbed

Revision:
0:c0d5dcd1de43
Child:
1:08217ba7f63c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Jul 16 21:06:45 2015 +0000
@@ -0,0 +1,63 @@
+#include "mbed.h"
+#include "EFM32_SegmentLCD.h"
+#include "IOFuncLib.h"
+
+
+silabs::EFM32_SegmentLCD segmentDisplay;
+
+
+/*------------ Constant definitions --------------*/
+#define TX_PIN          USBTX
+#define RX_PIN          USBRX
+#define BRATE           115200
+#define LED_PIN         LED1
+#define TOGGLE_RATE     (0.5f)
+#define BUFF_LENGTH     5
+
+#define INIT_SECONDS        17600
+
+/*-------- Check if platform compatible ----------*/
+#if DEVICE_SERIAL_ASYNCH
+Serial test_connection(USBTX, USBRX);
+#else
+#error "Platform not compatible with Low Power APIs for Serial"
+#endif
+
+/*------------------ Variables -------------------*/
+LowPowerTicker      blinker;
+bool                blinking = false;
+event_callback_t    serialEventCb;
+//DigitalOut          LED(LED_PIN);
+uint8_t             rx_buf[BUFF_LENGTH + 1];
+
+volatile uint32_t seconds = INIT_SECONDS;
+Flasher led(LED_PIN);
+
+/******************** Define Timers *****************************/
+// devo separare i timers. Non so il perche'
+LowPowerTicker refreshTicker;
+/*------------------ Callbacks -------------------*/
+
+
+//------------ Funzioni -------------
+#include "Functions.h"
+
+//-------------------------------------
+
+
+/*-------------------- Main ----------------------*/
+int main()
+{
+    /* Very Simple Main (tm) */
+    serialEventCb.attach(serialCb);
+
+    /* Setup serial connection */
+    test_connection.baud(BRATE);
+    test_connection.printf("Low Power API test\n\nSend 'S' to toggle blinking\n");
+    test_connection.read(rx_buf, BUFF_LENGTH, serialEventCb, SERIAL_EVENT_RX_ALL, 'S');
+
+    /* Let the callbacks take care of everything */
+    refreshTicker.attach(&tickerCallback, 1.0f);
+
+    while(1) sleep();
+}
\ No newline at end of file