Jonne Valola / PokittoLib Featured

Dependents:   YATTT sd_map_test cPong SnowDemo ... more

PokittoLib

Library for programming Pokitto hardware

How to Use

  1. Import this library to online compiler (see button "import" on the right hand side
  2. DO NOT import mbed-src anymore, a better version is now included inside PokittoLib
  3. Change My_settings.h according to your project
  4. Start coding!

Files at this revision

API Documentation at this revision

Comitter:
Pokitto
Date:
Wed Apr 25 14:00:49 2018 +0000
Parent:
40:3b88ff5aff13
Child:
42:798b5d67b372
Commit message:
new button handler;

Changed in this revision

POKITTO_HW/HWButtons.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/POKITTO_HW/HWButtons.cpp	Mon Apr 23 00:21:50 2018 +0000
+++ b/POKITTO_HW/HWButtons.cpp	Wed Apr 25 14:00:49 2018 +0000
@@ -96,44 +96,51 @@
 {
 	//Pokitto::heldStates[BTN_A] = 1 - Pokitto::heldStates[BTN_A];
 	//uint32_t  pins = ((LPC_PIN_INT_T*)LPC_PININT)->FALL;
-	if ((((LPC_PIN_INT_T*)LPC_PININT)->RISE)&(1<<0)) Pokitto::heldStates[BTN_A] = 1;
-	else if ((((LPC_PIN_INT_T*)LPC_PININT)->FALL)&(1<<0)) Pokitto::heldStates[BTN_A] = 0;
+	//if ((((LPC_PIN_INT_T*)LPC_PININT)->RISE)&(1<<0)) Pokitto::heldStates[BTN_A] = 1;
+	//else if ((((LPC_PIN_INT_T*)LPC_PININT)->FALL)&(1<<0)) Pokitto::heldStates[BTN_A] = 0;
+	Pokitto::heldStates[BTN_A]=ABtn.read();
 	ClearPinInt((LPC_PIN_INT_T *)LPC_PININT, PININTCH(0));
 }
 
 void PIN_INT1_IRQHandler(void)
 {
-	if ((((LPC_PIN_INT_T*)LPC_PININT)->RISE)&(1<<1)) Pokitto::heldStates[BTN_B] = 1;
-	else if ((((LPC_PIN_INT_T*)LPC_PININT)->FALL)&(1<<1)) Pokitto::heldStates[BTN_B] = 0;
+	//if ((((LPC_PIN_INT_T*)LPC_PININT)->RISE)&(1<<1)) Pokitto::heldStates[BTN_B] = 1;
+	//else if ((((LPC_PIN_INT_T*)LPC_PININT)->FALL)&(1<<1)) Pokitto::heldStates[BTN_B] = 0;
+	Pokitto::heldStates[BTN_B]=BBtn.read();
 	ClearPinInt((LPC_PIN_INT_T *)LPC_PININT, PININTCH(1));
 }
 
 void PIN_INT2_IRQHandler(void)
 {
-	if ((((LPC_PIN_INT_T*)LPC_PININT)->RISE)&(1<<2)) Pokitto::heldStates[BTN_C] = 1;
-	else if ((((LPC_PIN_INT_T*)LPC_PININT)->FALL)&(1<<2)) Pokitto::heldStates[BTN_C] = 0;
+	//if ((((LPC_PIN_INT_T*)LPC_PININT)->RISE)&(1<<2)) Pokitto::heldStates[BTN_C] = 1;
+	//else if ((((LPC_PIN_INT_T*)LPC_PININT)->FALL)&(1<<2)) Pokitto::heldStates[BTN_C] = 0;
+	Pokitto::heldStates[BTN_C]=CBtn.read();
 	ClearPinInt((LPC_PIN_INT_T *)LPC_PININT, PININTCH(2));
 }
 
 void PIN_INT3_IRQHandler(void)
 {
-	if ((((LPC_PIN_INT_T*)LPC_PININT)->RISE)&(1<<3)) Pokitto::heldStates[BTN_UP] = 1;
-	else if ((((LPC_PIN_INT_T*)LPC_PININT)->FALL)&(1<<3)) Pokitto::heldStates[BTN_UP] = 0;
+	//if ((((LPC_PIN_INT_T*)LPC_PININT)->RISE)&(1<<3)) Pokitto::heldStates[BTN_UP] = 1;
+	//else if ((((LPC_PIN_INT_T*)LPC_PININT)->FALL)&(1<<3)) Pokitto::heldStates[BTN_UP] = 0;
+	Pokitto::heldStates[BTN_UP]=UBtn.read();
 	ClearPinInt((LPC_PIN_INT_T *)LPC_PININT, PININTCH(3));
 }
 
 void PIN_INT4_IRQHandler(void)
 {
-	if ((((LPC_PIN_INT_T*)LPC_PININT)->RISE)&(1<<4)) Pokitto::heldStates[BTN_DOWN] = 1;
-	else if ((((LPC_PIN_INT_T*)LPC_PININT)->FALL)&(1<<4)) Pokitto::heldStates[BTN_DOWN] = 0;
+	//if ((((LPC_PIN_INT_T*)LPC_PININT)->RISE)&(1<<4)) Pokitto::heldStates[BTN_DOWN] = 1;
+	//else if ((((LPC_PIN_INT_T*)LPC_PININT)->FALL)&(1<<4)) Pokitto::heldStates[BTN_DOWN] = 0;
+	Pokitto::heldStates[BTN_DOWN]=DBtn.read();
 	ClearPinInt((LPC_PIN_INT_T *)LPC_PININT, PININTCH(4));
 }
 
 void PIN_INT5_IRQHandler(void)
 {
     /* Hardware volume control */
-    if ((((LPC_PIN_INT_T*)LPC_PININT)->RISE)&(1<<5)) Pokitto::heldStates[BTN_LEFT] = 1;
-	else if ((((LPC_PIN_INT_T*)LPC_PININT)->FALL)&(1<<5)) Pokitto::heldStates[BTN_LEFT] = 0;
+    //if ((((LPC_PIN_INT_T*)LPC_PININT)->RISE)&(1<<5)) Pokitto::heldStates[BTN_LEFT] = 1;
+	//else if ((((LPC_PIN_INT_T*)LPC_PININT)->FALL)&(1<<5)) Pokitto::heldStates[BTN_LEFT] = 0;
+    Pokitto::heldStates[BTN_C]=CBtn.read();
+    Pokitto::heldStates[BTN_LEFT]=LBtn.read();
     if (Pokitto::heldStates[BTN_C] && Pokitto::heldStates[BTN_LEFT]==0) _s.volumeDown();
 	ClearPinInt((LPC_PIN_INT_T *)LPC_PININT, PININTCH(5));
 }
@@ -141,8 +148,10 @@
 void PIN_INT6_IRQHandler(void)
 {
     /* Hardware volume control */
-    if ((((LPC_PIN_INT_T*)LPC_PININT)->RISE)&(1<<6)) Pokitto::heldStates[BTN_RIGHT] = 1;
-	else if ((((LPC_PIN_INT_T*)LPC_PININT)->FALL)&(1<<6)) Pokitto::heldStates[BTN_RIGHT] = 0;
+    //if ((((LPC_PIN_INT_T*)LPC_PININT)->RISE)&(1<<6)) Pokitto::heldStates[BTN_RIGHT] = 1;
+	//else if ((((LPC_PIN_INT_T*)LPC_PININT)->FALL)&(1<<6)) Pokitto::heldStates[BTN_RIGHT] = 0;
+    Pokitto::heldStates[BTN_C]=CBtn.read();
+    Pokitto::heldStates[BTN_RIGHT]=RBtn.read();
     if (Pokitto::heldStates[BTN_C] && Pokitto::heldStates[BTN_RIGHT]==0) _s.volumeUp();
 	ClearPinInt((LPC_PIN_INT_T *)LPC_PININT, PININTCH(6));
 }