Hello guys I tried to start TWI bus and got a lot of questions. (NRF51 1422 AC)
I added necessary libraries, could You tell me what more i need to include in my code :
#define TWI_MASTER_CONFIG_CLOCK_PIN_NUMBER (0U)
#define TWI_MASTER_CONFIG_DATA_PIN_NUMBER (2U)
//
static const nrf_drv_twi_t m_twi = NRF_DRV_TWI_INSTANCE(0);
static nrf_drv_twi_config_t nrf_drv_twi_config =
{ .scl = TWI_MASTER_CONFIG_CLOCK_PIN_NUMBER,
.sda = TWI_MASTER_CONFIG_DATA_PIN_NUMBER,
.frequency = NRF_TWI_FREQ_100K,
.interrupt_priority = 0};
void nrf_drv_twi_initialize(void){
nrf_drv_twi_init(&m_twi, &nrf_drv_twi_config, 0, NULL);
nrf_drv_twi_enable(&m_twi);
}
void nrf_drv_twi_uninitialize(void){
nrf_drv_twi_uninit(&m_twi);
nrf_drv_twi_disable(&m_twi);
}
and
nrf_drv_twi_tx(&m_twi,(0x49<<1),&read_adress,1,true);
nrf_drv_twi_rx(&m_twi,(0x49<<1),&value1, 1);
But is not working for me. Could u answer me too, operation (0x49<<1) with sensor adress is necessary with our example ?