Hi,
I'd want to implement RTC for regular testing of a variable. I am largely based on The BLE_uart exemple and have added a timer instance and a PWM instance. As the variable I want to check come about every second or more, I wanted to use the RTC librarr for low power consumption.
#include "nrf_drv_rtc.h" #include "nrf_drv_clock.h" const nrf_drv_rtc_t rtc = NRF_DRV_RTC_INSTANCE(1); /** @brief: Function for handling the RTC0 interrupts. * Triggered on TICK and COMPARE0 match. */ static void rtc_handler(nrf_drv_rtc_int_type_t int_type) { if (int_type == NRF_DRV_RTC_INT_COMPARE0) { NRF_LOG_INFO("COMPARE"); } else if (int_type == NRF_DRV_RTC_INT_TICK) { NRF_LOG_INFO("TICK"); } } /** @brief Function starting the internal LFCLK XTAL oscillator. */ static void lfclk_config(void) { ret_code_t err_code = nrf_drv_clock_init(); APP_ERROR_CHECK(err_code); nrf_drv_clock_lfclk_request(NULL); } /** @brief Function initialization and configuration of RTC driver instance. */ static void rtc_config(void) { uint32_t err_code; //Initialize RTC instance nrf_drv_rtc_config_t config = NRF_DRV_RTC_DEFAULT_CONFIG; config.prescaler = 4095; err_code = nrf_drv_rtc_init(&rtc, &config, rtc_handler); APP_ERROR_CHECK(err_code); //Enable tick event & interrupt nrf_drv_rtc_tick_enable(&rtc,true); //Set compare channel to trigger interrupt after COMPARE_COUNTERTIME seconds err_code = nrf_drv_rtc_cc_set(&rtc, 0, COMPARE_COUNTERTIME * 8,true); APP_ERROR_CHECK(err_code); //Power on RTC instance nrf_drv_rtc_enable(&rtc); } void rtc_init() { lfclk_config(); rtc_config(); }
I have this error message :
multiple definition of `RTC1_IRQHandler'; \components\libraries\timer/drv_rtc.c:353: first defined here
I'd like to know if I need some configuration or if I could and how to create custom event based on pin input (softdevice based event).
Best Regards,
Charles