@@ 1,1 1,1 @@
-f674d0b248f4e186186e79867325eda7cedca0c9 targets/Adafruit_Feather_M0_Basic/samd2x-peripheral-lib
+92f2926c55ce15d2ca07783bbd325b959183d34a targets/Adafruit_Feather_M0_Basic/samd2x-peripheral-lib
@@ 28,26 28,27 @@
#include "libdevice/ctl_uart.h"
#include "platform_atmel_d21_uart.h"
+#include "d2x_tickless_idle.h"
CTL_TASK_t main_task, led_task;
-#define STACKSIZE 64
+#define STACKSIZE 64
unsigned led_task_stack[1+STACKSIZE+1];
-void
+void
led_task_code(void *p)
-{
+{
unsigned int v=0;
CTL_UART_t *uart = d21_uart(0);
ctl_uart_puts(uart, "led_task_code started\r\n");
while (1)
- {
- // task logic goes here
+ {
+ // task logic goes here
v++;
ctl_board_set_leds(v % 2);
ctl_timeout_wait(ctl_get_current_time() + ctl_get_ticks_per_second() * 3);
- }
+ }
}
void
@@ 60,7 61,8 @@ int main(void)
{
unsigned int v=0;
ctl_task_init(&main_task, 255, "main"); // create subsequent tasks whilst running at the highest priority.
- ctl_start_timer(ctl_increment_tick_from_isr); // start the timer
+
+ d2x_setup_tick();
ctl_board_init();
ctl_board_set_leds(1);
@@ 70,9 72,9 @@ int main(void)
ctl_task_run(&led_task, 1, led_task_code, 0, "led_task", STACKSIZE, led_task_stack+1, 0);
ctl_task_set_priority(&main_task, 0); // drop to lowest priority to start created tasks running.
while (1)
- {
+ {
// tickless idle mode
- ctl_sleep(ctl_get_sleep_delay());
+ d2x_deep_sleep(ctl_get_sleep_delay());
}
return 0;
}