summaryrefslogtreecommitdiff
path: root/n/es-2006/src/others.h
diff options
context:
space:
mode:
Diffstat (limited to 'n/es-2006/src/others.h')
-rw-r--r--n/es-2006/src/others.h40
1 files changed, 19 insertions, 21 deletions
diff --git a/n/es-2006/src/others.h b/n/es-2006/src/others.h
index dd88722..0e25348 100644
--- a/n/es-2006/src/others.h
+++ b/n/es-2006/src/others.h
@@ -3,7 +3,7 @@
// others.h
// es - Input/Output general purpose board. {{{
//
-// Copyright (C) 2006 Dufour Jérémy
+// Copyright (C) 2006 Patrick Goncalves - (Dufour Jérémy)
//
// Robot APB Team/Efrei 2004.
// Web: http://assos.efrei.fr/robot/
@@ -40,31 +40,31 @@
/* access to value of pins of PORTA */
#define GET_PIN_OF_PORTA(n) ( PINA & _BV(n) )
-// /* SET DDRA */
-// /* set bit of DDR to 0 in order to set the pin n of PORTA in mode in */
-// #define SET_PIN_IN_MODE_IN_OF_PORTA(n) ( DDRA &= ~_BV(n) )
-// /* set bit of DDR to 1 in order to set the pin n of PORTA in mode out */
-// #define SET_PIN_IN_MODE_OUT_OF_PORTA(n) ( DDRA |= ~_BV(n) )
-
/** return the value of pin select color */
-inline uint8_t others_selectcoul(void)
+inline uint8_t others_selectcoul (void)
{
- return GET_PIN_OF_PORTA(SELECT_COLOR_PIN);
-};
+ return GET_PIN_OF_PORTA (SELECT_COLOR_PIN);
+}
/** return the value of pin jack */
-inline uint8_t others_jack(void)
+inline uint8_t others_jack (void)
{
- return GET_PIN_OF_PORTA(JACK_PIN);
-};
+ return GET_PIN_OF_PORTA (JACK_PIN);
+}
/** return the value of pin contact */
-inline uint8_t others_contact(void)
+inline uint8_t others_contact (void)
{
- return GET_PIN_OF_PORTA(CONTACT_PIN);
-};
+ return GET_PIN_OF_PORTA (CONTACT_PIN);
+}
+
+/** Return the jack and the select_colour at the same time */
+inline uint8_t other_jack_color (void)
+{
+ return (PINA & 0x03);
+}
-/** initialisation of color button (put select color pin in mode 'IN') */
+/** Initialisation of color button (put select color pin in mode 'IN') */
inline void others_init(void)
{
/* init DDRA (0 default) */
@@ -74,9 +74,7 @@ inline void others_init(void)
/* DDRA &= ~_BV(SELECT_COLOR_PIN); */
/* pull up in mode in */
- PORTA = PORTA | _BV(SELECT_COLOR_PIN) | _BV(JACK_PIN) | _BV(CONTACT_PIN);
-};
-
-
+ PORTA |= _BV(SELECT_COLOR_PIN) | _BV(JACK_PIN) | _BV(CONTACT_PIN);
+}
#endif // others_h