samples: drivers: counter: alarm: Fix compilation for nrf boards

Sample was not compiling for nordic boards because RTC_0
instance was not enabled by default and RTC_0 device is using
different DT define.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
This commit is contained in:
Krzysztof Chruscinski 2019-06-11 13:27:19 +02:00 committed by Anas Nashif
commit ea44b056bc
5 changed files with 32 additions and 4 deletions

View file

@ -0,0 +1,14 @@
# Kconfig - Config for counter alarm sample
#
# Copyright (c) 2019 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: Apache-2.0
#
config COUNTER_RTC0
bool
default y if SOC_FAMILY_NRF
source "Kconfig.zephyr"

View file

@ -40,6 +40,10 @@ void main(void)
printk("Counter alarm sample\n\n");
counter_dev = device_get_binding(DT_RTC_0_NAME);
if (counter_dev == NULL) {
printk("Device not found\n");
return;
}
counter_start(counter_dev);

View file

@ -20,4 +20,7 @@
#define DT_WDT_0_NAME DT_NORDIC_NRF_WATCHDOG_WDT_0_LABEL
#define DT_RTC_0_NAME DT_NORDIC_NRF_RTC_RTC_0_LABEL
#define DT_RTC_1_NAME DT_NORDIC_NRF_RTC_RTC_1_LABEL
/* End of SoC Level DTS fixup file */

View file

@ -29,4 +29,8 @@
#define DT_WDT_0_NAME DT_NORDIC_NRF_WATCHDOG_WDT_0_LABEL
#define DT_RTC_0_NAME DT_NORDIC_NRF_RTC_RTC_0_LABEL
#define DT_RTC_1_NAME DT_NORDIC_NRF_RTC_RTC_1_LABEL
#define DT_RTC_2_NAME DT_NORDIC_NRF_RTC_RTC_2_LABEL
/* End of SoC Level DTS fixup file */

View file

@ -32,10 +32,13 @@
#define DT_SPI_2_NAME DT_NORDIC_NRF_SPI_SPI_2_LABEL
#define DT_SPI_3_NAME DT_NORDIC_NRF_SPI_SPI_3_LABEL
#define DT_WDT_0_NAME DT_NORDIC_NRF_WATCHDOG_WDT_0_LABEL
#define DT_WDT_0_NAME DT_NORDIC_NRF_WATCHDOG_WDT_0_LABEL
#define DT_TIMER_0_NAME DT_NORDIC_NRF_TIMER_TIMER_0_LABEL
#define DT_TIMER_1_NAME DT_NORDIC_NRF_TIMER_TIMER_1_LABEL
#define DT_TIMER_2_NAME DT_NORDIC_NRF_TIMER_TIMER_2_LABEL
#define DT_TIMER_0_NAME DT_NORDIC_NRF_TIMER_TIMER_0_LABEL
#define DT_TIMER_1_NAME DT_NORDIC_NRF_TIMER_TIMER_1_LABEL
#define DT_TIMER_2_NAME DT_NORDIC_NRF_TIMER_TIMER_2_LABEL
#define DT_RTC_0_NAME DT_NORDIC_NRF_RTC_RTC_0_LABEL
#define DT_RTC_1_NAME DT_NORDIC_NRF_RTC_RTC_1_LABEL
/* End of SoC Level DTS fixup file */