]> git.scottworley.com Git - tattlekey/blame_incremental - client/blink.c
client: Stop sleeping separately for each re-send
[tattlekey] / client / blink.c
... / ...
CommitLineData
1#include "pico/cyw43_arch.h"
2#include "pico/stdlib.h"
3
4#include "blink.h"
5
6void one_blink(int duration) {
7 cyw43_arch_gpio_put(CYW43_WL_GPIO_LED_PIN, 1);
8 sleep_ms(duration);
9 cyw43_arch_gpio_put(CYW43_WL_GPIO_LED_PIN, 0);
10 sleep_ms(duration);
11}
12
13void signal(int count, int duration) {
14 for (int i = 0; i < count; i++)
15 one_blink(duration);
16 sleep_ms(1000);
17}
18
19void blink_forever(int duration) {
20 while (true) {
21 one_blink(duration);
22 }
23}
24
25void signal_error_by_blinking() { blink_forever(100); }
26void signal_success_by_blinking() { blink_forever(400); }