This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

button power dissipation

FormerMember
FormerMember

hello everyone:

i use interrupt to handle button.and when i init it,the power is increase about 200uA. i think the interrupt will not increase the power

void gpiote_event_handler(uint32_t event_pins_low_to_high, uint32_t event_pins_high_to_low)
{
//	SEGGER_RTT_printf(0,"GPIO interrupt ---\r\n");
	if (event_pins_low_to_high & (1 << CHECK_SIM)) { // 
		CHECK_SIM_Handle();//SEGGER_RTT_printf(0,"CHECK_SIM  in\r\n");
	}

	if (event_pins_high_to_low & (1 << CHECK_SIM)) { // 
		CHECK_SIM_Handle();//SEGGER_RTT_printf(0,"CHECK_SIM  out\r\n");
	}
	
	if (event_pins_high_to_low & (1 << BUTTON_PIN)) { // 
		Touch_Key_Handle();
	}

	if ((event_pins_high_to_low & (1 << STDBY)) || (event_pins_low_to_high & (1 << STDBY))) {
		ChargeState_Handle();
	}

	if ((event_pins_high_to_low & (1 << CHRG)) || (event_pins_low_to_high & (1 << CHRG))) {
		ChargeState_Handle();
	}
}
static void buttons_init()
{
    uint32_t err_code;

    uint32_t   low_to_high_bitmask = (1<<CHECK_SIM)|(1 << STDBY) |(1 << CHRG);//|0x00000000;
    uint32_t   high_to_low_bitmask = (1<<CHECK_SIM)|(1 << BUTTON_PIN)|(1 << STDBY)|(1 << CHRG);
    
    // Configure BUTTON1 with SENSE enabled
	nrf_gpio_cfg_input(CHECK_SIM, NRF_GPIO_PIN_PULLUP);
    nrf_gpio_cfg_input(BUTTON_PIN, NRF_GPIO_PIN_PULLUP);//touch key//NRF_GPIO_PIN_NOPULL
	nrf_gpio_cfg_input(STDBY, NRF_GPIO_PIN_NOPULL);//chrg
	nrf_gpio_cfg_input(CHRG, NRF_GPIO_PIN_NOPULL);//chrg
	
    APP_GPIOTE_INIT(4);   
    
    err_code = app_gpiote_user_register((app_gpiote_user_id_t*)&m_app_gpiote_my_id, 
                                        low_to_high_bitmask, 
                                        high_to_low_bitmask, 
                                        gpiote_event_handler);
    APP_ERROR_CHECK(err_code);
    
    err_code = app_gpiote_user_enable(m_app_gpiote_my_id);
    APP_ERROR_CHECK(err_code);
}
Related