acassis commented on issue #12159:
URL: https://github.com/apache/nuttx/issues/12159#issuecomment-2060011261

   Hi @xiaotailang you don't need to do nothing special, just call look the 
examples inside boards/arm/stm32/common/src/
   
   ```
   stm32_bh1750.c:  ret = bh1750fvi_register(devpath, i2c, BH1750FVI_I2C_ADDR);
   stm32_bmp180.c:  ret = bmp180_register(devpath, i2c);
   stm32_ina219.c:  ret = ina219_register(devpath, i2c, 0x40, 100000, 0x00);
   stm32_lcd_backpack.c:  ret = pcf8574_lcd_backpack_register(devpath, i2c, 
&cfg);
   stm32_lm75.c:  ret = lm75_register(devpath, i2c, 0x48);
   stm32_mlx90614.c:  ret = mlx90614_register(devpath, i2c, MLX90614_ADDRESS);
   stm32_nunchuck.c:  ret = nunchuck_register(devpath, i2c);
   stm32_veml6070.c:  ret = veml6070_register(devpath, i2c, 
VEML6070_I2C_DATA_LSB_CMD_ADDR);
   ```
   
   Just initialize the I2C Bus/Port as you saw:
   
   i2c = stm32_i2cbus_initialize(I2C_BUS);  /* Bus could be 1, 2 or 3 */
   
   And them you just call the blablabladevicename_register() passing this i2c 
pointer, as you see in these files.
   
   Actually this code to register the i2c_register(i2c, DS1307_I2C_BUS); is 
incorrect, because it is already done at stm32_bringup.c. So I will punish the 
guy who did it! (myself) Hehehe.
   
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to