File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed
Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change 3434#define KILO 1e3
3535#define MICRO 1e-6
3636#define WRAP 10000
37- #define FREQ 50
37+ #define FREQ 50 // PWM frequency in hertz
3838
3939static float clkdiv ;
4040static uint min ;
@@ -56,7 +56,10 @@ static void wrap_cb(void)
5656
5757 for (int i = 0 ; i < 8 ; ++ i )
5858 {
59- if (slice_active [i ] == 0 ) continue ;
59+ if (slice_active [i ] == 0 )
60+ {
61+ continue ;
62+ }
6063
6164 pwm_clear_irq (i );
6265 offset = 16 * ((servo_pos_buf [i + 0 ] + 1 ) % 2 );
@@ -108,7 +111,6 @@ int servo_init(void)
108111 return 0 ;
109112}
110113
111-
112114/**
113115 * @brief Reference the primary clock.
114116 *
@@ -120,7 +122,6 @@ int servo_clock_auto(void)
120122 return servo_clock_source (CLOCKS_FC0_SRC_VALUE_PLL_SYS_CLKSRC_PRIMARY );
121123}
122124
123-
124125/**
125126 * @brief Specify the clock source.
126127 *
@@ -200,7 +201,7 @@ int servo_attach(uint pin)
200201
201202/**
202203 * @brief Move a servo.
203- * Move the servo on the specified pin to the specified angle.
204+ * Move the servo on the specified pin to the specified angle in degrees .
204205 *
205206 * @param pin The PWM pin controlling a servo.
206207 * @param angle The angle to move to.
@@ -240,3 +241,4 @@ int servo_microseconds(uint pin, uint us)
240241 servo_pos_buf [pos ] = (servo_pos_buf [pos ] + 1 ) % 2 ;
241242 return 0 ;
242243}
244+
You can’t perform that action at this time.
0 commit comments