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.
Dependents: YATTT sd_map_test cPong SnowDemo ... more
PokittoLib
Library for programming Pokitto hardware
How to Use
- Import this library to online compiler (see button "import" on the right hand side
- DO NOT import mbed-src anymore, a better version is now included inside PokittoLib
- Change My_settings.h according to your project
- Start coding!
Revision 41:e667167aa9d8, committed 2018-04-25
- 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));
}