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
Diff: main.cpp
- Revision:
- 1:7a3eed610fea
- Parent:
- 0:4ada39fe4ffc
- Child:
- 4:b52a0d2925df
--- a/main.cpp Sun Mar 31 18:45:25 2019 +0000
+++ b/main.cpp Mon Apr 01 01:43:36 2019 +0000
@@ -1,6 +1,7 @@
#include "mbed.h"
#include "Image.h"
#include "Rotate.h"
+#include "Release.h"
#include "Gamepad.h"
#define PI 3.1415
@@ -10,14 +11,18 @@
Rotate Rotate;
+Release Release;
InterruptIn A(PTB9);
+InterruptIn B(PTD0);
void A_isr();
+void B_isr();
void init_K64F();
volatile int g_A_flag = 0;
+volatile int g_B_flag = 0;
int main()
{
@@ -26,8 +31,12 @@
// 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);
+ B.mode(PullDown);
+ B.rise(&B_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;
@@ -43,6 +52,11 @@
detector=1;
}
+ if(g_B_flag) {
+ g_A_flag=0;
+ detector=2;
+ }
+
switch(detector) {
case 0 :
lcd.clear();
@@ -54,7 +68,16 @@
Rotate.rotate(lcd,Image, Rotate.return_angle, PI, Rotate.return_flag);
//printf("f%", Rotate.return_angle);
break;
+ case 2 :
+ Release.release(lcd,Image, Rotate.return_angle);
+ //printf("f%", Rotate.return_angle);
+ g_A_flag = 1;
+ g_B_flag = 0;
+ break;
+
}
+
+
}
}
@@ -63,3 +86,7 @@
g_A_flag = 1;
}
+void B_isr()
+{
+ g_B_flag = 1;
+}