summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSadeep Madurange <sadeep@asciimx.com>2024-11-16 21:30:31 +0800
committerSadeep Madurange <sadeep@asciimx.com>2024-11-16 21:30:31 +0800
commitb1799c15f551f8703a12a0b899dc5e3fad157bde (patch)
treeb22d128e07785449592bffa8244e2265a35dec28
parentf9cc5786a1edc1048d7ac966696c65c03f5d4129 (diff)
downloadsmart-home-b1799c15f551f8703a12a0b899dc5e3fad157bde.tar.gz
Refactor defines and remove cli().
-rw-r--r--door_lock/servo.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/door_lock/servo.c b/door_lock/servo.c
index afc1971..28b669f 100644
--- a/door_lock/servo.c
+++ b/door_lock/servo.c
@@ -10,23 +10,20 @@
#define PWM_MAX 2500
#define PWM_TOP 20000
-#define PWM_LOCK PWM_MID
-#define PWM_UNLOCK PWM_MAX - 50
-
#define SERVO_PIN PB1
#define LOCK_BTN PD6
#define UNLOCK_BTN PD7
static inline void lock(void)
{
- OCR1A = PWM_LOCK;
+ OCR1A = PWM_MID;
_delay_ms(100);
OCR1A = PWM_TOP;
}
static inline void unlock(void)
{
- OCR1A = PWM_UNLOCK;
+ OCR1A = PWM_MAX - 50;
_delay_ms(100);
OCR1A = PWM_TOP;
}
@@ -62,8 +59,6 @@ static inline void servo_init(void)
int main(void)
{
- cli();
-
servo_init();
pcint2_init();
serial_init();