i am programming nrf-51 dk's program.
i have to get data from sensor, so i am studying example code which is twi_sensor.
i don't know well these function.
nrf_drv_twi_tx(&m_twi_mma_7660, MMA7660_ADDR, reg, sizeof(reg), false);
i know function's parameters is
[in] p_instance TWI instance.
[in] address Address of a specific slave device (only 7 LSB).
[in] p_data Pointer to a transmit buffer.
[in] length Number of bytes to send.
[in] xfer_pending After a specified number of bytes, transmission will be suspended (if xfer_pending is set) or stopped (if not).
but how do i know TWI instance and address Address of a specific slave device?
the example code's parameters that is m_twi_mma_7660, MMA7660_ADDR are acceleration sensor's instance and address.
but i'm going to use heart rate sensor.
and when i execute the example program, nrf_drv_twi_tx returns error.
so it is locked at 'while(m_set_mode_done == false);'.
what is the problem?
ret_code_t err_code;
/* Writing to MMA7660_REG_MODE "1" enables the accelerometer. */
uint8_t reg[2] = {MMA7660_REG_MODE, ACTIVE_MODE};
err_code = nrf_drv_twi_tx(&m_twi_mma_7660, MMA7660_ADDR, reg, sizeof(reg), false);
APP_ERROR_CHECK(err_code);
while(m_set_mode_done == false);
please let me know. i need help....