aboutsummaryrefslogtreecommitdiff
path: root/AT91SAM7S256/Source/d_button.r
diff options
context:
space:
mode:
authorNicolas Schodet2011-07-04 01:23:24 +0200
committerNicolas Schodet2011-07-04 01:27:42 +0200
commitc331530002825a86f12151266a9772167a3a49ce (patch)
tree9a4bb16c6a87e30629da039e82cbf026dc361009 /AT91SAM7S256/Source/d_button.r
parent0cb650f1cf6f446bbb0186300a198b5936f49bb4 (diff)
parentb0472321014e8fcb110f4cecad734bb6a7e27ae0 (diff)
Merge branch 'jch-import' into jch-mergejch-merge
Conflicts: AT91SAM7S256/Source/BtTest.inc AT91SAM7S256/Source/Functions.inl AT91SAM7S256/Source/Ui.txt AT91SAM7S256/Source/c_cmd.c AT91SAM7S256/Source/c_input.c AT91SAM7S256/Source/c_output.c AT91SAM7S256/Source/c_ui.c AT91SAM7S256/Source/c_ui.h AT91SAM7S256/Source/d_loader.h AT91SAM7S256/Source/d_lowspeed.r AT91SAM7S256/Source/d_output.c AT91SAM7S256/Source/d_output.h
Diffstat (limited to 'AT91SAM7S256/Source/d_button.r')
-rw-r--r--AT91SAM7S256/Source/d_button.r31
1 files changed, 16 insertions, 15 deletions
diff --git a/AT91SAM7S256/Source/d_button.r b/AT91SAM7S256/Source/d_button.r
index c478394..1e24b36 100644
--- a/AT91SAM7S256/Source/d_button.r
+++ b/AT91SAM7S256/Source/d_button.r
@@ -40,10 +40,7 @@ static UBYTE RisingTime;
/* And because it's an AD value returned from the AVR */
/* then a peak detector is needed */
#define BUTTONRead(pB) {\
- UBYTE Tmp, BtnPtr;\
- UWORD TmpBtn;\
*pB = OldState;\
- BtnPtr = 0x01;\
if (OldVal < IoFromAvr.Buttons)\
{\
OldVal = IoFromAvr.Buttons;\
@@ -60,27 +57,31 @@ static UBYTE RisingTime;
{\
if (RisingTime > RISING_THRESHOLD)\
{\
- TmpBtn = IoFromAvr.Buttons;\
- if (0x40 > TmpBtn)\
- {\
- TmpBtn = 0x00;\
+ UBYTE Tmp, BtnPtr, TmpBtn;\
+ UWORD buttonsVal;\
+ buttonsVal = IoFromAvr.Buttons;\
+ TmpBtn = 0;\
+ if (buttonsVal > 0x5FF) {\
+ TmpBtn = 0x08;\
+ buttonsVal -= 0x7ff;\
}\
- else if (0x100 > TmpBtn)\
+ if (0x40 > buttonsVal)\
{\
- TmpBtn = 0x04;\
+ TmpBtn |= 0x00;\
}\
- else if (0x1FF > TmpBtn)\
+ else if (0x100 > buttonsVal)\
{\
- TmpBtn = 0x02;\
+ TmpBtn |= 0x04;\
}\
- else if (0x5FF > TmpBtn)\
+ else if (0x1FF > buttonsVal)\
{\
- TmpBtn = 0x01;\
+ TmpBtn |= 0x02;\
}\
- else\
+ else if (0x5FF > buttonsVal)\
{\
- TmpBtn = 0x08;\
+ TmpBtn |= 0x01;\
}\
+ BtnPtr = 0x01;\
for (Tmp = 0; Tmp < NOS_OF_AVR_BTNS; Tmp++)\
{\
if ((TmpBtn) & BtnPtr)\