RTOS homework 4

Dependencies:   C12832_lcd mbed

Files at this revision

API Documentation at this revision

Comitter:
gatedClock
Date:
Sun Aug 18 15:19:07 2013 +0000
Parent:
1:5f41e2df0e85
Child:
3:8ff0c9c853be
Commit message:
in progress.

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Sun Aug 18 15:13:19 2013 +0000
+++ b/main.cpp	Sun Aug 18 15:19:07 2013 +0000
@@ -38,6 +38,12 @@
     #define LCD2 lcd.locate(0,11);              // LCD line 2.
     #define LCD3 lcd.locate(0,22);              // LCD line 3.
     
+    #define JOYUP     p15
+    #define JOYDOWN   p12
+    #define JOYLEFT   p13
+    #define JOYRIGHT  p16
+    #define JOYCENTER p14
+    
     #define METROMAX       800                  // max. beats per minute.
     #define METROMIN         8                  // min. beats per minute.
     #define UDSAMPLERATE     0.1                // how often to sample U/D joystick.
@@ -52,9 +58,11 @@
 //--global_instances----------------------------//------------------------------ 
     C12832_LCD  lcd;                            // LCD object.
     
-    DigitalIn   joyStickUp    (p15);            // 1 if joystick up     pressed.
-    DigitalIn   joyStickDown  (p12);            // 1 if joystick down   pressed.
-    DigitalIn   joyStickCenter(p14);            // 1 if joystick middle pressed.
+    InterruptIn   joyStickUp    (p15);            // 1 if joystick up     pressed.
+    InterruptIn   joyStickDown  (p12);            // 1 if joystick down   pressed.
+    InterruptIn   joyStickLeft  (p13);
+    InterruptIn   joyStickRight (p16);
+    InterruptIn   joyStickCenter(p14);            // 1 if joystick middle pressed.
 
     DigitalOut  led3(LED1);                     // leftmost LED.
     
@@ -77,21 +85,8 @@
 //==============================================//==============================
     int main(void) 
     {
-      initialization();                         // initialize settings.
-      
-                                                // metronome ticker.
-      tickerMetronome.attach(&interrupt_service_M,fMetroDelay);
-      
-                                                // LCD ticker.
-      tickerLCD.attach(&lcd_display,LCDSAMPLERATE);       
-      
-                                                // up/down joystick sampling.
-      tickerJoystickUD.attach(&interrupt_service_UD,UDSAMPLERATE);
-      
-      while (1)                                 // main loop.
-      {
-        wait(10.0);                             // it's all interrupt-driven.
-      } 
+      joyStickUp.rise(&ISR_up);    
+
     }       
 /*----------------------------------------------//----------------------------*/
     void initialization(void)                   // program initializations.