summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJérémy Dufour2008-03-27 23:37:16 +0100
committerJérémy Dufour2008-03-27 23:37:16 +0100
commit97881b8496332efe46ec67fe6d4979420bc45035 (patch)
treefe123983b8db8c320201258d1342e68591082ace
parent4f88ee97a923151dea8f9bf8c1ea3620dc848d08 (diff)
* digital/io/src
- correct bug in reading the state of a pin in switch module.
-rw-r--r--digital/io/src/switch.h22
1 files 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
@@ -44,9 +44,14 @@
#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.
@@ -54,9 +59,14 @@
#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 */