Easy IoT General

Digital 1-to-8 I2C Multiplexer on Stm32

userHead Account cancelled 2019-01-05 09:48:44 3346 Views0 Replies
Hello,
I want to buy one multiplexer to use more than 4 sensor. I read the manual/datasheet and also I checked the example. I'm not sure, how can I read/write data from sensor's. In STM32 i have 2 commands to read and write for example:
HAL_I2C_Mem_Write(&hi2c1, 0x39<<1, 0x00, 1, (uint8_t*)0x03, 1, 100);
where
HAL_I2C_Mem_Write(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint16_t MemAddress, uint16_t MemAddSize, uint8_t *pData, uint16_t Size, uint32_t Timeout)
so, I using first module of I2C. Sensor addres is 0x39, I writng 0x03 to register 0x00 to power on sensor. Then i can read the data:
HAL_I2C_Mem_Read(&hi2c1, 0x39<<1, 0xEC, 1, (uint8_t*)&Data, sizeof(Data), 100);
where
HAL_I2C_Mem_Read(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint16_t MemAddress, uint16_t MemAddSize, uint8_t *pData, uint16_t Size, uint32_t Timeout)
so, I reading from register 0xEC all data.

So, the question is, how to write/read data form sensor by using multiplexer? On Ardiuno it's look no cleary.
Thanks ;)