Skip to content

Commit d5905ba

Browse files
committed
fix style + use a shared irq handler
1 parent 8b82160 commit d5905ba

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

include/pico_servo.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@
2828

2929
void servo_set_bounds(uint, uint);
3030

31-
int servo_init();
32-
int servo_clock_auto();
31+
int servo_init(void);
32+
int servo_clock_auto(void);
3333
int servo_clock_source(uint);
3434
int servo_clock_manual(uint);
3535
int servo_attach(uint);
36-
int servo_enable();
36+
int servo_enable(void);
3737
int servo_move_to(uint, uint);
3838
int servo_microseconds(uint, uint);
3939

src/pico_servo.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ static uint min_us = 500;
5050
static uint max_us = 2500;
5151
static float us_per_unit = 0.f;
5252

53-
static void wrap_cb()
53+
static void wrap_cb(void)
5454
{
5555
uint offset;
5656

@@ -86,7 +86,7 @@ void servo_set_bounds(uint a, uint b)
8686
}
8787
}
8888

89-
int servo_init()
89+
int servo_init(void)
9090
{
9191
for (int i = 0; i < 30; ++i)
9292
{
@@ -96,12 +96,13 @@ int servo_init()
9696
memset(servo_pos, 0, 32 * sizeof(uint));
9797
memset(servo_pos_buf, 0, 16 * sizeof(uint));
9898

99-
irq_set_exclusive_handler(PWM_IRQ_WRAP, wrap_cb);
99+
//irq_set_exclusive_handler(PWM_IRQ_WRAP, wrap_cb);
100+
irq_add_shared_handler(PWM_IRQ_WRAP, wrap_cb, PICO_SHARED_IRQ_HANDLER_DEFAULT_ORDER_PRIORITY);
100101

101102
return 0;
102103
}
103104

104-
int servo_clock_auto()
105+
int servo_clock_auto(void)
105106
{
106107
return servo_clock_source(CLOCKS_FC0_SRC_VALUE_PLL_SYS_CLKSRC_PRIMARY);
107108
}

0 commit comments

Comments
 (0)