mirror of
https://github.com/cesanta/mongoose.git
synced 2025-01-15 02:08:08 +08:00
Running two blinkers
This commit is contained in:
parent
72f0489ec2
commit
09b1d6aa72
@ -26,16 +26,19 @@ static void server(void *args) {
|
||||
}
|
||||
|
||||
static void blinker(void *args) {
|
||||
while (args == NULL) {
|
||||
led_toggle();
|
||||
vTaskDelay(pdMS_TO_TICKS(1000));
|
||||
uint16_t pin = ((char *) args)[0] == '1' ? LED2 : LED3;
|
||||
int ms = pin == LED2 ? 750 : 1500;
|
||||
for (;;) {
|
||||
gpio_toggle(pin);
|
||||
vTaskDelay(pdMS_TO_TICKS(ms));
|
||||
}
|
||||
}
|
||||
|
||||
int main(void) {
|
||||
init_hardware();
|
||||
xTaskCreate(server, "server", 4096, NULL, configMAX_PRIORITIES - 1, NULL);
|
||||
xTaskCreate(blinker, "blinker", 128, NULL, configMAX_PRIORITIES - 1, NULL);
|
||||
xTaskCreate(blinker, "blinker", 128, "1", configMAX_PRIORITIES - 1, NULL);
|
||||
xTaskCreate(blinker, "blinker", 128, "2", configMAX_PRIORITIES - 1, NULL);
|
||||
vTaskStartScheduler(); // This blocks
|
||||
return 0; // Unreachable
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user