Skip to content

Commit f608b72

Browse files
committed
some cleanup
1 parent 82de1c3 commit f608b72

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/pico_servo.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
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

3939
static float clkdiv;
4040
static 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+

0 commit comments

Comments
 (0)