Detection of currently connected modules and/or tags

Hi there,
is there any general option or function how could be found out which modules and/or tags is currently connected to Core module for choosing right behaviour?
For example if there is LCD module currently disconnected, data from temperature sensor should be sent wirelessly.

Hi,

when I was playing with esp8266, I used I2C scanner for checking occupied I2C addresses (eg. https://gist.github.com/tfeldmann/5411375). I hope you can use same method here.

From source code, you can see that LCD is connected to I2C address 0x3c (https://github.com/bigclownlabs/bcf-sdk/blob/8d8f067a96217205999e267a7af19464c57fbe18/bcl/src/bc_module_lcd.c#L317). But there is probably no list of all devices with their address.

I don’t have any code, compatible with BC now, but maybe in the future…

1 Like

Thank you.
There are complete list of I²C device addresses here if you meant this.

Nice! Then I2C scanner can show also other details about address.

1 Like

You can do some I2C dummy reading, maybe even read just 0 bytes. All bc_i2c... functions return false when device doesn’t answer with ACK after their address is send to the bus.

… minute later …

Yes, it works. LCD Module detection

uint8_t dummy_byte;
bool lcd_module_connected = bc_i2c_memory_read_8b(BC_I2C_I2C0, 0x3c, 0x00, &dummy_byte);

I’ve set reading register 0x00. It could work different for other I2C devices. Best is to use WHO_AM_I I2C register for sensors which has it.

2 Likes

Thanks @expee and @hub.martin for your advices.
I’ll try it. :grin: