homework 7

Dependencies:   mbed-rtos mbed C12832_lcd LM75B

main.cpp

Committer:
gatedClock
Date:
2013-08-30
Revision:
2:665ffa57031f
Parent:
1:9188d4668a88
Child:
3:adb6af8649f8

File content as of revision 2:665ffa57031f:

/*----------------------------------------------//------------------------------
    student   : m-moore
    class     : rtos
    directory : RTOS_HW_07
    file      : main.cpp
----description---------------------------------//------------------------------

-----includes-----------------------------------//----------------------------*/
    #include "mbed.h"                           // mbed class.
    #include "rtos.h"
    #include "C12832_lcd.h"                     // LCD class.
//---defines------------------------------------//------------------------------
    #define LCD1 lcd.locate(0, 0);              // LCD line 1.
    #define LCD2 lcd.locate(0,11);              // LCD line 2.
    #define LCD3 lcd.locate(0,22);              // LCD line 3.

//--global_definitions--------------------------//------------------------------
//--global_variables----------------------------//------------------------------ 

//--global_instances----------------------------//------------------------------ 
    C12832_LCD   lcd;                           // LCD object.
    
    InterruptIn  iJoyStickUp    (p15);          // joystick up rising edge.
    InterruptIn  iJoyStickDown  (p12);          // joystick down rising edge.
    InterruptIn  iJoyStickLeft  (p13);          // joystick left rising edge.
    InterruptIn  iJoyStickRight (p16);          // joystick right rising edge.
    InterruptIn  iJoyStickCenter(p14);          // 1 if joystick middle pressed.

    DigitalOut  led3(LED1);                     // leftmost LED.
    

    
    Ticker      tickerMeasureTemperature;
    Ticker      tickerLCDUpdate;
    Ticker      tickerLEDUpdate;
    Ticker      tickerBeeper;
//-------prototypes-----------------------------//------------------------------
    void ISR_up();
    void ISR_down();
    void ISR_left();
    void ISR_right();
    void ISR_center();
//==============================================//==============================
    int main(void) 
    {
      iJoyStickUp.rise   (&ISR_up);
      iJoyStickDown.rise (&ISR_down);
      iJoyStickLeft.rise (&ISR_left); 
      iJoyStickRight.rise(&ISR_right);
      iJoyStickCenter.rise(&ISR_center); 
      
      initialization();                         // initialize variables.
      

      
      while(1)                                  // all timer/interrupt driven.
      {
        wait(10.0);
      }
    }       
/*----------------------------------------------//----------------------------*/
    void initialization(void)                   // program initializations.
    {

    }
/*----------------------------------------------//----------------------------*/
    void ISR_up(void)
    {
      printf(" ISR_up \n\r");
    }
/*----------------------------------------------//----------------------------*/
    void ISR_down(void)
    {
      printf(" ISR_down \n\r");
    }
/*----------------------------------------------//----------------------------*/
    void ISR_left(void)
    {
      printf(" ISR_left \n\r");
    }
/*----------------------------------------------//----------------------------*/
    void ISR_right(void)
    {
      printf(" ISR_right \n\r");
    }
/*----------------------------------------------//----------------------------*/
    void ISR_center(void)
    {
      printf(" ISR_center \n\r");
    }
/*----------------------------------------------//----------------------------*/


    
/*----------------------------------------------//----------------------------*/
    void measureTemperature(void)
    {
      printf(" measureTemerature \n\r");
    }
/*----------------------------------------------//----------------------------*/
    void LCDUpdate(void)
    {
      printf(" LCDUpdate \n\r");
    }
/*----------------------------------------------//----------------------------*/
    void LEDUpdate(void)
    {
      printf(" LEDUpdate \n\r");
    }
/*----------------------------------------------//----------------------------*/
    void Beeper(void)
    {
      printf(" Beeper \n\r");
    }
/*----------------------------------------------//----------------------------*/