Hi,
I'm considering using NRF52832/52840 as BLE central while configuring its I2C as slave.
Should I initialize I2C with TWIS instance? How do I suppose to set the slave address?
I've check the "twi_master_with_twis_slave" sample of SDK16. But I'm bit of confused since the sample is bonding TWIS with FLASH.
Perhaps I just need to implement this part to initialize TWIS?
Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
const nrf_drv_twis_config_t config =
{
.addr = {m_config.slave_addr, 0},
.scl = m_config.scl_s,
.scl_pull = NRF_GPIO_PIN_PULLUP,
.sda = m_config.sda_s,
.sda_pull = NRF_GPIO_PIN_PULLUP,
.interrupt_priority = APP_IRQ_PRIORITY_HIGH
};
/* Init TWIS */
do
{
ret = nrf_drv_twis_init(&m_twis, &config, twis_event_handler);
if (NRF_SUCCESS != ret)
{
break;
}
nrf_drv_twis_enable(&m_twis);
}while (0);
Address here is defined as:
Fullscreen
1
#define EEPROM_SIM_ADDR 0x50 //!< Simulated EEPROM TWI slave address.
If I were use several NRF52s as slaves, how do I suppose to set each address? Does the 7 bits fully customizable?
Thanks