Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Power failure comparator, nRF52811

Hello,

nRFSD5 v16.0, softdevice v.7.0.1, nRF52811

I want to detect power failure/low battery voltage using POF feature of nRF52811 chip. Here is the code I'm using:

#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>

#include "nrf_gpio.h"
#include "nrfx_uart.h"
#include "nrfx_comp.h"
#include "nrfx_systick.h"
#include "nrf_log.h"

#include "cue_driver.h"

static void sys_evt_dispatch(uint32_t sys_evt) { 
    if (sys_evt == NRF_EVT_POWER_FAILURE_WARNING) { 
        //testData = 0; 
        NRF_LOG_INFO("Power failure...");
    } 
}

void pof_init(){
    uint32_t err_code;

    err_code = sd_power_pof_enable(POWER_POFCON_POF_Enabled << POWER_POFCON_POF_Pos);
    APP_ERROR_CHECK(err_code);

    err_code = sd_power_pof_threshold_set(POWER_POFCON_THRESHOLD_V27);
    APP_ERROR_CHECK(err_code);

    // Subscribe for Sys events.
    err_code = softdevice_sys_evt_handler_set(sys_evt_dispatch);
    APP_ERROR_CHECK(err_code);
}

When I compile, get following error:

undefined reference to `softdevice_sys_evt_handler_set'

I searched online but cannot find the cause of error. I found an example here but that is for SDK11. How can I do the same for SDK16.0? 

Parents Reply Children
No Data
Related