Defined but not used warning

I added some functionality to asset_tracker_v2. I used two pins of Nordic chip for following purpose: 1. Detect BMS, pin as Input 2. Reset BMS, pin as output. The pins overlay is added in nrf9160dk_nrf9160_ns.overlay file. The pins configuration and binding etc is done in an bms_module_event.h file. The pins are handled in a thread function in bms_module.c file a below:

static void module_thread_fn(void)
{

..

..

while (true) {
                     module_get_next_msg(&self, &msg);
                     switch (state) {
                                                  case BMS_INIT:
                                                                           on_state_init();
                                                                 break;

..

                                            }

                     }

}

//*******************************************************************
K_THREAD_DEFINE(bms_module_thread, CONFIG_BMS_THREAD_STACK_SIZE, module_thread_fn, NULL, NULL, NULL,K_LOWEST_APPLICATION_THREAD_PRIO, 0, 2000);

//********************************************************************

static void on_state_init(void)
{ int ret;
struct bms_module_event *bms_init_event = new_bms_module_event();
if (!device_is_ready(bms_detect_pin.port)){
bms_detect_pin.port = NULL;
}
else{
ret = gpio_pin_configure_dt(&bms_detect_pin,GPIO_INPUT);
if(ret!=0){bms_detect_pin.port = NULL;}
else {detect_pin_flag = true;}
}
if (bms_reset_pin.port &&!device_is_ready(bms_reset_pin.port)){
bms_reset_pin.port = NULL;
}
if(bms_reset_pin.port)
{
ret = gpio_pin_configure_dt(&bms_reset_pin,GPIO_OUTPUT_LOW);
if(ret!=0){bms_reset_pin.port = NULL;}
else {reset_pin_flag = true;}
}
if((detect_pin_flag == true)&&(reset_pin_flag == true)){bms_init_event->type=BMS_PIN_SUCCESS;state_set(BMS_DETECT);}
else{bms_init_event->type=BMS_PIN_FAIL;}

APP_EVENT_SUBMIT(bms_init_event);
}

The below mentioned content is from bms_module_event.h file : 

//*********

static bool detect_pin_flag = false, reset_pin_flag = false;


#define BMS_DETECT_NODE DT_ALIAS(bmsdetect)
#define BMS_RESET_NODE DT_ALIAS(bmsreset)

#if !DT_NODE_HAS_STATUS(BMS_DETECT_NODE, okay)
#error "Unsupported board: BMS_DETECT devicetree alias is not defined"
#endif

#if !DT_NODE_HAS_STATUS(BMS_RESET_NODE, okay)
#error "Unsupported board: BMS_RESET devicetree alias is not defined"
#endif

static struct gpio_dt_spec bms_detect_pin = GPIO_DT_SPEC_GET_OR(BMS_DETECT_NODE, bmsios,{0});

static struct gpio_dt_spec bms_reset_pin = GPIO_DT_SPEC_GET_OR(BMS_RESET_NODE, bmsios,{0});

//****************************

The code added to overlay file is below:

aliases{
bmsdetect = &bmsdetect;
bmsreset = &bmsreset;
};
bmspins {
compatible = "bmspins";
status = "okay";
bmsdetect: bms_det {
bmsios = < &gpio0 0x8 0x11 >;
label = "BMS Detect PIN";
status = "okay";
};
bmsreset: bms_rst {
bmsios = < &gpio0 0x9 0x11 >;
label = "BMS Reset PIN";
status = "okay";
};
};

Though build is successful, but shows warnings as shown in image below. Why these warnings and what is the solution ?

Parents Reply Children
No Data
Related