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
main.cpp
- Committer:
- MYY
- Date:
- 2019-03-31
- Revision:
- 0:4ada39fe4ffc
- Child:
- 1:7a3eed610fea
File content as of revision 0:4ada39fe4ffc:
#include "mbed.h"
#include "Image.h"
#include "Rotate.h"
#include "Gamepad.h"
#define PI 3.1415
Image Image;
N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11);
Rotate Rotate;
InterruptIn A(PTB9);
void A_isr();
void init_K64F();
volatile int g_A_flag = 0;
int main()
{
// first need to initialise display
lcd.init();
// change set contrast in range 0.0 to 1.0
// 0.4 appears to be a good starting point
lcd.setContrast(0.5);
A.mode(PullDown);
A.rise(&A_isr);
// since SW2 has an external pull-up, we should disable to internal pull-down
// resistor that is enabled by default using InterruptIn
Rotate.return_flag=1;
Rotate.return_angle=PI;
while(1) {
int detector=A.read();
// these are default settings so not strictly needed
lcd.normalMode(); // normal colour mode
lcd.setBrightness(0.4); // put LED backlight on 50%
// x origin, y origin, rows, cols, sprite
if(g_A_flag) {
detector=1;
}
switch(detector) {
case 0 :
lcd.clear();
lcd.printString("Misery Miner!",0,0);
lcd.refresh();
wait(0.1);
break;
case 1 :
Rotate.rotate(lcd,Image, Rotate.return_angle, PI, Rotate.return_flag);
//printf("f%", Rotate.return_angle);
break;
}
}
}
void A_isr()
{
g_A_flag = 1;
}