Datasheet

Testing the Shell Command
You can test the new 'test' shell command by connecting over serial:
/* Shell command struct */
static struct shell_cmd shell_test_cmd_struct = {
.sc_cmd = "test",
.sc_cmd_func = shell_test_cmd
};
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);
/* Call this before sysinit to register the command */
#if MYNEWT_VAL(SHELL_TASK)
shell_cmd_register(&shell_test_cmd_struct);
#endif
/* Initialize the OS */
sysinit();
while (1) {
/* Run the event queue to process background events */
os_eventq_run(os_eventq_dflt_get());
}
return rc;
}
/* Implement the 'test' command handler */
static int
shell_test_cmd(int argc, char **argv)
{
console_printf("Test!\n");
return 0;
}
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);
}
}
© Adafruit Industries https://learn.adafruit.com/adafruit-nrf52-pro-feather Page 60 of 87