summaryrefslogtreecommitdiffstats
path: root/door_lock
diff options
context:
space:
mode:
authorSadeep Madurange <sadeep@asciimx.com>2024-11-16 19:08:49 +0800
committerSadeep Madurange <sadeep@asciimx.com>2024-11-16 19:08:49 +0800
commitce43b552667ae81e3754a663ce07c851db278e23 (patch)
tree00798b26ba7b933e2dfaff4bff92915d43d1d029 /door_lock
parent6d8764f090c6d82fae01fe3840d0f7c287b8119b (diff)
downloadsmart-home-ce43b552667ae81e3754a663ce07c851db278e23.tar.gz
Phase correct mode.
Diffstat (limited to 'door_lock')
-rw-r--r--door_lock/servo.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/door_lock/servo.c b/door_lock/servo.c
index 5144c28..c3a5f5e 100644
--- a/door_lock/servo.c
+++ b/door_lock/servo.c
@@ -5,12 +5,12 @@
#include "cmd.h"
#include "serial.h"
-#define PWM_MIN 999
-#define PWM_MID 2999
-#define PWM_MAX 4999
+#define PWM_MIN 500
+#define PWM_MID 1500
+#define PWM_MAX 2500
#define PWM_LOCK PWM_MID
-#define PWM_UNLOCK PWM_MAX - 100
+#define PWM_UNLOCK PWM_MAX - 50
#define SERVO_PIN PB1
#define LOCK_BTN PD6
@@ -21,9 +21,9 @@ static inline void servo_init(void)
DDRB |= (1 << SERVO_PIN);
TCCR1A |= (1 << WGM11) | (1 << COM1A1);
- TCCR1B |= (1 << WGM12) | (1 << WGM13) | (1 << CS11);
+ TCCR1B |= (1 << WGM13) | (1 << CS11);
- ICR1 = 39999;
+ ICR1 = 20000;
DDRD &= ~((1 << LOCK_BTN) | (1 << UNLOCK_BTN));
PORTD |= (1 << LOCK_BTN) | (1 << UNLOCK_BTN);