summaryrefslogtreecommitdiffhomepage
path: root/digital/io/src
diff options
context:
space:
mode:
authorJérémy Dufour2008-03-22 16:17:19 +0100
committerJérémy Dufour2008-03-22 16:17:19 +0100
commitb6e28f0de9c2f02fe2cb5c3f8244f6b2199673b9 (patch)
treee5d9d0152f501ad55dec2cae3d4bea37b75ee64b /digital/io/src
parent553b844b18f45fbe0ead56162f1100c73b9866c4 (diff)
* digital/io/src
- use the helper macro set_bit where needed.
Diffstat (limited to 'digital/io/src')
-rw-r--r--digital/io/src/servo.c7
-rw-r--r--digital/io/src/switch.h3
2 files changed, 4 insertions, 6 deletions
diff --git a/digital/io/src/servo.c b/digital/io/src/servo.c
index 66fb9681..19f97a63 100644
--- a/digital/io/src/servo.c
+++ b/digital/io/src/servo.c
@@ -26,7 +26,7 @@
#include "servo.h"
#include "io.h" /* General defines of registers */
-#include "modules/utils/utils.h" /* regv */
+#include "modules/utils/utils.h" /* regv, set_bit */
#include "modules/utils/byte.h" /* v16_to_v8 */
/**
@@ -86,7 +86,6 @@ SIGNAL (SIG_OVERFLOW2);
void
servo_init (void)
{
-#define set_bit(port, bit) (port |= _BV(bit))
/* Set-up all the pins of the servo to out direction */
set_bit (SERVO_PORT, 0);
set_bit (SERVO_PORT, 1);
@@ -104,7 +103,7 @@ servo_init (void)
servo_updating_id_ = 0;
/* Enable overflow interrupt */
- TIMSK |= _BV (TOIE2);
+ set_bit (TIMSK, TOIE2);
}
/* Set the high time of the input signal of a servo (and its position). */
@@ -152,7 +151,7 @@ SIGNAL (SIG_OVERFLOW2)
if (servo_updating_id_ != 0)
SERVO_PORT &= ~_BV (servo_updating_id_ - 1);
/* Set to high state the current servo motor pin */
- SERVO_PORT |= _BV (servo_updating_id_);
+ set_bit (SERVO_PORT, servo_updating_id_);
/* Plan next timer overflow to the TOP minus the current configuration
* of the servo motor */
TCNT2 = SERVO_TCNT_TOP - servo_high_time_[servo_updating_id_];
diff --git a/digital/io/src/switch.h b/digital/io/src/switch.h
index 4d2acd36..e09d6a8c 100644
--- a/digital/io/src/switch.h
+++ b/digital/io/src/switch.h
@@ -30,6 +30,7 @@
*/
#include "io.h"
+#include "modules/utils/utils.h" /* set_bit */
/**
* @defgroup SwitchConfiguration Configuration of the switch module.
@@ -68,10 +69,8 @@ switch_init (void)
{
/* By default, all pins are in input direction */
/* Enable the pull-ups */
-#define set_bit(port, bit) (port |= _BV(bit))
set_bit (SWITCH_COLOR_PORT, SWITCH_COLOR_PIN);
set_bit (SWITCH_JACK_PORT, SWITCH_JACK_PIN);
-#undef set_bit
}
/**