diff options
author | Björn Stenberg <bjorn@haxx.se> | 2004-09-19 21:58:37 +0000 |
---|---|---|
committer | Björn Stenberg <bjorn@haxx.se> | 2004-09-19 21:58:37 +0000 |
commit | 6c33c51a4ca9907d23e3154d956fd6781122f492 (patch) | |
tree | f0e598efaf064bb72c33c0a8a2edba4cf9ebb13c /firmware/drivers | |
parent | 17f54a40f100a3343a15a431d235699024aa76c8 (diff) | |
download | rockbox-6c33c51a4ca9907d23e3154d956fd6781122f492.tar.gz rockbox-6c33c51a4ca9907d23e3154d956fd6781122f492.zip |
Redesigned the button handling. The code now uses symbolic function defines instead of checking for specific buttons. This makes it easier to add support for new devices with different button layouts.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5091 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/drivers')
-rw-r--r-- | firmware/drivers/button.c | 11 | ||||
-rw-r--r-- | firmware/drivers/serial.c | 2 |
2 files changed, 6 insertions, 7 deletions
diff --git a/firmware/drivers/button.c b/firmware/drivers/button.c index f934052746..25cdd3d96b 100644 --- a/firmware/drivers/button.c +++ b/firmware/drivers/button.c | |||
@@ -267,7 +267,6 @@ void button_set_flip(bool flip) | |||
267 | } | 267 | } |
268 | } | 268 | } |
269 | 269 | ||
270 | |||
271 | /* | 270 | /* |
272 | * Get button pressed from hardware | 271 | * Get button pressed from hardware |
273 | */ | 272 | */ |
@@ -376,12 +375,12 @@ static int button_read(void) | |||
376 | if(adc_read(2) < 0x180) | 375 | if(adc_read(2) < 0x180) |
377 | btn |= BUTTON_RIGHT; | 376 | btn |= BUTTON_RIGHT; |
378 | if(adc_read(3) < 0x180) | 377 | if(adc_read(3) < 0x180) |
379 | btn |= BUTTON_PLAY | BUTTON_UP; | 378 | btn |= BUTTON_PLAY; |
380 | 379 | ||
381 | if ( !(porta & 0x20) ) | 380 | if ( !(porta & 0x20) ) |
382 | btn |= BUTTON_ON; | 381 | btn |= BUTTON_ON; |
383 | if ( !(porta & 0x800) ) | 382 | if ( !(porta & 0x800) ) |
384 | btn |= BUTTON_STOP | BUTTON_DOWN; | 383 | btn |= BUTTON_STOP; |
385 | 384 | ||
386 | return btn; | 385 | return btn; |
387 | } | 386 | } |
@@ -488,7 +487,7 @@ static int button_read(void) | |||
488 | if(adc_read(ADC_BUTTON_OPTION) > 0x200) /* active high */ | 487 | if(adc_read(ADC_BUTTON_OPTION) > 0x200) /* active high */ |
489 | btn |= BUTTON_MENU; | 488 | btn |= BUTTON_MENU; |
490 | if(adc_read(ADC_BUTTON_ONOFF) < 0x120) /* active low */ | 489 | if(adc_read(ADC_BUTTON_ONOFF) < 0x120) /* active low */ |
491 | btn |= BUTTON_ON; | 490 | btn |= BUTTON_OFF; |
492 | 491 | ||
493 | /* Check the 4 direction keys, hard-coded analog limits for now */ | 492 | /* Check the 4 direction keys, hard-coded analog limits for now */ |
494 | if (data >= 0x2EF) | 493 | if (data >= 0x2EF) |
@@ -496,9 +495,9 @@ static int button_read(void) | |||
496 | else if (data >= 0x246) | 495 | else if (data >= 0x246) |
497 | btn |= BUTTON_RIGHT; | 496 | btn |= BUTTON_RIGHT; |
498 | else if (data >= 0x19D) | 497 | else if (data >= 0x19D) |
499 | btn |= BUTTON_PLAY | BUTTON_UP; | 498 | btn |= BUTTON_UP; |
500 | else if (data >= 0x0A1) | 499 | else if (data >= 0x0A1) |
501 | btn |= BUTTON_STOP | BUTTON_DOWN; | 500 | btn |= BUTTON_DOWN; |
502 | 501 | ||
503 | return btn; | 502 | return btn; |
504 | } | 503 | } |
diff --git a/firmware/drivers/serial.c b/firmware/drivers/serial.c index 11dadc6f19..e1e0eb82e9 100644 --- a/firmware/drivers/serial.c +++ b/firmware/drivers/serial.c | |||
@@ -85,7 +85,7 @@ int remote_control_rx(void) | |||
85 | } | 85 | } |
86 | else | 86 | else |
87 | { | 87 | { |
88 | #ifndef HAVE_NEO_KEYPAD /* This needs to be fixed for Neo */ | 88 | #if !defined(HAVE_NEO_KEYPAD) && !defined(HAVE_ONDIO_KEYPAD) |
89 | switch (btn) | 89 | switch (btn) |
90 | { | 90 | { |
91 | case STOP: | 91 | case STOP: |