PokittoLib is the library needed for programming the Pokitto DIY game console (www.pokitto.com)

Revision:
41:e667167aa9d8
Parent:
40:3b88ff5aff13
--- 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));
 }