# HG changeset patch # User Tero Koskinen # Date 1505514601 -10800 # Sat Sep 16 01:30:01 2017 +0300 # Node ID 993c1d16c9ccc514be193e6319af0854a967dcce # Parent f59d94a031ebf260fbb8d9888e0566f67d2faff8 Update to the latest samd platform api. Also, set additional binary linker output for ctl project. diff --git a/.hgsubstate b/.hgsubstate --- a/.hgsubstate +++ b/.hgsubstate @@ -1,1 +1,1 @@ -54c6c425a4d04da8e03a0d69e76bb42a4562f71b targets/Adafruit_Feather_M0_Basic/samd2x-peripheral-lib +d3ecd938cdf6c8862261f1899f44eaeedd938312 targets/Adafruit_Feather_M0_Basic/samd2x-peripheral-lib diff --git a/adafruit-feather-m0-basic-template.hzp b/adafruit-feather-m0-basic-template.hzp --- a/adafruit-feather-m0-basic-template.hzp +++ b/adafruit-feather-m0-basic-template.hzp @@ -18,36 +18,41 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/Adafruit_Feather_M0_Basic_package.xml b/packages/Adafruit_Feather_M0_Basic_package.xml --- a/packages/Adafruit_Feather_M0_Basic_package.xml +++ b/packages/Adafruit_Feather_M0_Basic_package.xml @@ -1,6 +1,9 @@ - + + + SAMD2x CTL peripheral library updated to the new version. + FreeRTOS template. SAMD2x CTL peripheral library updated. diff --git a/targets/Adafruit_Feather_M0_Basic/ctl_board.c b/targets/Adafruit_Feather_M0_Basic/ctl_board.c --- a/targets/Adafruit_Feather_M0_Basic/ctl_board.c +++ b/targets/Adafruit_Feather_M0_Basic/ctl_board.c @@ -12,11 +12,11 @@ #include #include -#include "platform_atmel_d21_i2c.h" -#include "platform_atmel_d21_spi.h" -#include "platform_atmel_d21_uart.h" -#include "d2x_gpio.h" -#include "d2x_eic.h" +#include "platform_samd_i2c.h" +#include "platform_samd_spi.h" +#include "platform_samd_uart.h" +#include "platform_samd_gpio.h" +#include "platform_samd_eic.h" #include "pin_mapping.h" #define SERCOM_MISO_PAD_0 0 @@ -142,15 +142,15 @@ CTL_UART_t *uart, *uart5; CTL_SPI_BUS_t *spi_bus; - d21_uart_set_pin_config(adafruit_uarts, 6); - d21_spi_set_pin_config(adafruit_m0_spis, ADAFRUIT_M0_SPI_AMOUNT); - d2x_eic_init(); + samd_uart_set_pin_config(adafruit_uarts, 6); + samd_spi_set_pin_config(adafruit_m0_spis, ADAFRUIT_M0_SPI_AMOUNT); + samd_eic_init(); // SCL & SDA pins on the Feather board. - d21_configure_i2c_bus(3, 100000); + samd_configure_i2c_bus(3, 100000); // Polled uart0, pins 0 (RX) and 1 (TX) on Feather M0 - uart = d21_uart(0); + uart = samd_uart(0); ctl_uart_init(uart, NULL, NULL); ctl_uart_set_baud(uart, 9600); ctl_uart_puts(uart, "board initialized\r\n"); @@ -173,7 +173,7 @@ ctl_board_on_button_pressed(CTL_ISR_FN_t isr) { gpio_set_extint(SAMD_PORT(ARDUINO_D5), SAMD_PIN(ARDUINO_D5), false); - d2x_eic_enable_int(15, false, SENSE_EDGE_FALLING, button_press, isr); + samd_eic_enable_int(15, false, SENSE_EDGE_FALLING, button_press, isr); } void diff --git a/targets/Adafruit_Feather_M0_Basic/m0_main_ctl.c b/targets/Adafruit_Feather_M0_Basic/m0_main_ctl.c --- a/targets/Adafruit_Feather_M0_Basic/m0_main_ctl.c +++ b/targets/Adafruit_Feather_M0_Basic/m0_main_ctl.c @@ -27,8 +27,8 @@ #include #include "libdevice/ctl_uart.h" -#include "platform_atmel_d21_uart.h" -#include "d2x_tickless_idle.h" +#include "platform_samd_uart.h" +#include "platform_samd_tickless_idle.h" CTL_TASK_t main_task, led_task; @@ -39,7 +39,7 @@ led_task_code(void *p) { unsigned int v=0; - CTL_UART_t *uart = d21_uart(0); + CTL_UART_t *uart = samd_uart(0); ctl_uart_puts(uart, "led_task_code started\r\n"); while (1) @@ -62,7 +62,7 @@ unsigned int v=0; ctl_task_init(&main_task, 255, "main"); // create subsequent tasks whilst running at the highest priority. - d2x_setup_tick(); + samd_setup_tick(); // Use timer 3 for tick (not systick) ctl_board_init(); ctl_board_set_leds(1); @@ -73,8 +73,9 @@ ctl_task_set_priority(&main_task, 0); // drop to lowest priority to start created tasks running. while (1) { - // tickless idle mode - d2x_deep_sleep(ctl_get_sleep_delay()); + // tickless idle mode. + // samd_deep_sleep puts mcu into standby mode in Release build and into idle0 mode in Debug build + samd_deep_sleep(ctl_get_sleep_delay()); } return 0; } diff --git a/targets/Adafruit_Feather_M0_Basic/pin_mapping.h b/targets/Adafruit_Feather_M0_Basic/pin_mapping.h --- a/targets/Adafruit_Feather_M0_Basic/pin_mapping.h +++ b/targets/Adafruit_Feather_M0_Basic/pin_mapping.h @@ -1,7 +1,7 @@ #ifndef PIN_MAPPING_H #define PIN_MAPPING_H -#include "d2x_gpio.h" +#include "platform_samd_gpio.h" #define ARDUINO_D0 SAMD_PAD(0, 11) // sercom 0 rx #define ARDUINO_D1 SAMD_PAD(0, 10) // sercom 0 tx diff --git a/targets/Adafruit_Feather_M0_Basic/project_templates_Adafruit_Feather_M0_Basic.xml b/targets/Adafruit_Feather_M0_Basic/project_templates_Adafruit_Feather_M0_Basic.xml --- a/targets/Adafruit_Feather_M0_Basic/project_templates_Adafruit_Feather_M0_Basic.xml +++ b/targets/Adafruit_Feather_M0_Basic/project_templates_Adafruit_Feather_M0_Basic.xml @@ -19,7 +19,7 @@ - + @@ -140,7 +140,7 @@ - + @@ -173,33 +173,33 @@ - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + - - - + + +