Datasheet

Checking Task Status
#include <assert.h>
#include <string.h>
#include "os/os.h"
#include "bsp/bsp.h"
#include "hal/hal_gpio.h"
#include "sysinit/sysinit.h"
/* Define task stack and task object */
#define LED_TASK_PRIO (100) /* 1 = highest, 255 = lowest */
#define LED_STACK_SIZE OS_STACK_ALIGN(64)
struct os_task led_task;
os_stack_t led_task_stack[LED_STACK_SIZE];
static void led_task_func(void *arg);
int
main(int argc, char **argv)
{
int rc;
/* Initialize the task */
os_task_init(&led_task, "blinky", led_task_func, NULL,
LED_TASK_PRIO, OS_WAIT_FOREVER, led_task_stack,
LED_STACK_SIZE);
/* Initialize the OS */
sysinit();
while (1) {
/* Run the event queue to process background events */
os_eventq_run(os_eventq_dflt_get());
}
return rc;
}
static void
led_task_func(void *arg)
{
/* Configure the LED GPIO as an output and HIGH (On) */
hal_gpio_init_out(LED_BLINK_PIN, 1);
while (1) {
/* Wait one second */
os_time_delay(OS_TICKS_PER_SEC * 1);
/* Toggle the LED */
hal_gpio_toggle(LED_BLINK_PIN);
}
}
You can vary the blinky rate by adjusting the delay in 'os_time_delay' in the task handler
© Adafruit Industries https://learn.adafruit.com/adafruit-nrf52-pro-feather Page 56 of 87