SMS message display on LED Matrix board with printer option

Dependencies:   AdafruitThermalPrinter HT1632_LedMatrix VodafoneUSBModem mbed-rtos mbed

Files at this revision

API Documentation at this revision

Comitter:
SomeRandomBloke
Date:
Mon Jul 29 21:10:47 2013 +0000
Parent:
6:323d7422ca8b
Child:
8:401c7a593dd0
Commit message:
updated LED Matrix library

Changed in this revision

HT1632_LedMatrix.lib Show annotated file Show diff for this revision Revisions of this file
VodafoneUSBModem.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed-rtos.lib Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- a/HT1632_LedMatrix.lib	Mon Apr 08 20:55:20 2013 +0000
+++ b/HT1632_LedMatrix.lib	Mon Jul 29 21:10:47 2013 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/SomeRandomBloke/code/HT1632_LedMatrix/#9a869360d0ae
+http://mbed.org/users/SomeRandomBloke/code/HT1632_LedMatrix/#b051965066db
--- a/VodafoneUSBModem.lib	Mon Apr 08 20:55:20 2013 +0000
+++ b/VodafoneUSBModem.lib	Mon Jul 29 21:10:47 2013 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/VodafoneUSBModem/#07ac4e1ea5b0
+http://mbed.org/users/mbed_official/code/VodafoneUSBModem/#f8d65dc86a97
--- a/main.cpp	Mon Apr 08 20:55:20 2013 +0000
+++ b/main.cpp	Mon Jul 29 21:10:47 2013 +0000
@@ -47,8 +47,9 @@
 #include <ctype.h>
 
 #include "mbed.h"
+//#include "beep.h"
 #include "VodafoneUSBModem.h"
-//#include <LinkMonitor.h>
+//#include "LinkMonitor.h"
 
 #ifdef USE_LED
 #include "HT1632_LedMatrix.h"
@@ -57,13 +58,17 @@
 #include "AdafruitThermal.h"
 #endif
 
-#define DEBUG 1
+//#define DEBUG 1
 
 #ifdef USE_LED
 // Default scrolling message includes own number obtained using USSD request
 #define INFO_MSG "       Send a message to "
+//#define INFO_MSG "       Welcome to the IoT London Showcase. Send a message to "
+//#define INFO_MSG "       Welcome to the Reading Geek Night. Send a message to "
 #endif
 
+#define BRIGHTNESS 10
+
 // Vodafone USSD commands
 #define USSD_COMMAND_OWN_NUMBER "*#100#"
 #define USSD_COMMAND_BALANCE "*#134#"
@@ -87,8 +92,10 @@
 #define LED_MAX_DISPLAY_X 4
 #define LED_MAX_DISPLAY_Y 1
 
+
 // create object to control the LED Matrix
-HT1632_LedMatrix led = HT1632_LedMatrix();
+HT1632_LedMatrix led = HT1632_LedMatrix(p7, p5, p19, p17, p18, p20);    //, LED_MAX_DISPLAY_X,LED_MAX_DISPLAY_Y );
+//HT1632_LedMatrix led = HT1632_LedMatrix(p7, p5, p17, p18, p19, p20);    //, LED_MAX_DISPLAY_X,LED_MAX_DISPLAY_Y );
 #define DISPDELAY 90
 #endif
 
@@ -111,6 +118,9 @@
 void matrixDemo( void );
 #endif
 
+// Define object for buzzer to signal new message received
+//Beep buzzer(p21);
+
 // Define the onboard LEDs to use as status indicators
 DigitalOut led1(LED1);      // Activity
 DigitalOut led2(LED2);      // Activity, alternates with led2
@@ -149,6 +159,7 @@
 {
     strncpy( newMsgBuf, newMsgStart, MAX_MSG_LENGTH );
     resetMessage = true;
+ //   buzzer.beep(1000,0.5);
 }
 
 
@@ -267,6 +278,7 @@
     threadRestartCount++;
 
     // Getting the link state seems to speed up startup of the library
+    // Sometimes startup doesnt happen - need way to retry this
     modem.getLinkState( &pRssi,&pRegistrationState, &pBearer);
 #ifdef DEBUG
     debug_pc.printf("Link state Rssi: %d, Registration state %x Bearer %x\n",pRssi,pRegistrationState, pBearer);
@@ -402,6 +414,7 @@
         // TODO add minimum interval between message changes, e.g. 60s
         if( resetMessage && msgFinished ) {
             led.clear();
+            led.setBrightness(BRIGHTNESS);
             crtPos = 0;
             msgx = 1;
             msgFinished = false;
@@ -489,14 +502,19 @@
 
     led.init(LED_MAX_DISPLAY_X,LED_MAX_DISPLAY_Y);    // Use all displays as 128x8 display
     led.clear();
-    led.setBrightness(10);
+    led.setBrightness(BRIGHTNESS);
     //led.displayOff(); // Turn off display for now until receiver task has started
     bool twoLineDisplay = (LED_MAX_DISPLAY_X > 1);
     led.putString( 0, 0, "SMS to LED Display" );
 
-    Thread::wait(3000);   // Wait for display to initialise after power up
+//    Thread::wait(3000);   // Wait for display to initialise after power up
 #endif
 
+    // Startup beep
+ //   buzzer.beep(1000,0.5);
+    
+    Thread::wait(30000);     // Wait for bit longer to ensure dongle powers up
+
     // Set initial blank message
     resetMessageBuffers();
 
@@ -505,7 +523,7 @@
     Thread displayTask(displayScrollingLine, NULL, osPriorityNormal, 1024 * 4);
 #endif
 
-    // Show we are still working by alternitively flashing LED1 adn LED2, once a second
+    // Show we are still working by alternitively flashing LED1 and LED2, once a second
     led1 = 0;       // Working
     led2 = 1;       // Alternate with led1
     led3 = 0;       // Received and processing SMS
--- a/mbed-rtos.lib	Mon Apr 08 20:55:20 2013 +0000
+++ b/mbed-rtos.lib	Mon Jul 29 21:10:47 2013 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed-rtos/#53e6cccd8782
+http://mbed.org/users/mbed_official/code/mbed-rtos/#58b30ac3f00e
--- a/mbed.bld	Mon Apr 08 20:55:20 2013 +0000
+++ b/mbed.bld	Mon Jul 29 21:10:47 2013 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed/builds/5e5da4a5990b
\ No newline at end of file
+http://mbed.org/users/mbed_official/code/mbed/builds/b3110cd2dd17
\ No newline at end of file