This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

i2c and low power

Hi, all

I'm trying to i2c(twi) in low power..

while(true) {
    __WFE();
    __SEV();
    __WFE();
}

In this case, I want to generate an interrupt through the i2c read function " read_touch_data " (under code).

void read_touch_data(void) 
{
    m_xfer_done = false;

    /* Read 1 byte from the specified address - skip 3 bits dedicated for fractional part of temperature. */
    ret_code_t err_code = nrf_drv_twi_rx(&m_tch_twi, TOUCH_ADDR, &m_touch_value, 2);
    APP_ERROR_CHECK(err_code);
}


Where should I define the "read_touch_data" function to generate an interrupt in low power state?

I originally used do-while statements, but I don't think this is an interrupt, so I ask you a question. Thank you.

do {
  read_touch_data();
  nrf_delay_ms(1000);

  idle_state_handle();

} while(!m_touch_value[1]);  

Related