From 97881b8496332efe46ec67fe6d4979420bc45035 Mon Sep 17 00:00:00 2001 From: Jérémy Dufour Date: Thu, 27 Mar 2008 23:37:16 +0100 Subject: * digital/io/src - correct bug in reading the state of a pin in switch module. --- digital/io/src/switch.h | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/digital/io/src/switch.h b/digital/io/src/switch.h index e09d6a8c..3b4e060e 100644 --- a/digital/io/src/switch.h +++ b/digital/io/src/switch.h @@ -43,20 +43,30 @@ */ #define SWITCH_COLOR_PORT PORTC +/** + * Color selector read register port. + */ +#define SWITCH_COLOR_PIN PINC + /** * Color selector switch pin number of the port. */ -#define SWITCH_COLOR_PIN 0 +#define SWITCH_COLOR_PIN_NUMBER 0 /** * Jack switch port. */ #define SWITCH_JACK_PORT PORTC +/** + * Jack switch read register port. + */ +#define SWITCH_JACK_PIN PINC + /** * Jack switch pin number of the port. */ -#define SWITCH_JACK_PIN 1 +#define SWITCH_JACK_PIN_NUMBER 1 /** @} */ @@ -69,8 +79,8 @@ switch_init (void) { /* By default, all pins are in input direction */ /* Enable the pull-ups */ - set_bit (SWITCH_COLOR_PORT, SWITCH_COLOR_PIN); - set_bit (SWITCH_JACK_PORT, SWITCH_JACK_PIN); + set_bit (SWITCH_COLOR_PORT, SWITCH_COLOR_PIN_NUMBER); + set_bit (SWITCH_JACK_PORT, SWITCH_JACK_PIN_NUMBER); } /** @@ -79,7 +89,7 @@ switch_init (void) inline uint8_t switch_get_color (void) { - return bit_is_set (SWITCH_COLOR_PORT, SWITCH_COLOR_PIN); + return bit_is_set (SWITCH_COLOR_PIN, SWITCH_COLOR_PIN_NUMBER); } /** @@ -88,7 +98,7 @@ switch_get_color (void) inline uint8_t switch_get_jack (void) { - return bit_is_set (SWITCH_JACK_PORT, SWITCH_JACK_PIN); + return bit_is_set (SWITCH_JACK_PIN, SWITCH_JACK_PIN_NUMBER); } #endif /* switch_h */ -- cgit v1.2.3