Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed-rtos mbed C12832_lcd LM75B
main.cpp
- Committer:
- gatedClock
- Date:
- 2013-08-30
- Revision:
- 1:9188d4668a88
- Parent:
- 0:fcca4db7b32a
- Child:
- 2:665ffa57031f
File content as of revision 1:9188d4668a88:
/*----------------------------------------------//------------------------------
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 tickerMetronome; // blinking LED.
Ticker tickerLCD; // display ticker.
Timeout timeoutDutyCycle; // LED duty cycle delay.
Timeout timeoutMetronome;
//-------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");
}
/*----------------------------------------------//----------------------------*/