Esempio n. 1
0
int stm32_lm75initialize(FAR const char *devpath)
{
  FAR struct i2c_dev_s *i2c;
  int ret;

  /* Configure PB.5 as Input pull-up.  This pin can be used as a temperature
   * sensor interrupt (not fully implemented).
   */

  stm32_configgpio(GPIO_LM75_OSINT);

  /* Get an instance of the I2C1 interface */

  i2c =  up_i2cinitialize(1);
  if (!i2c)
    {
      return -ENODEV;
    }

  /* Then register the temperature sensor */

  ret = lm75_register(devpath, i2c, 0x48);
  if (ret < 0)
    {
      (void)up_i2cuninitialize(i2c);
    }
  return ret;
}
Esempio n. 2
0
int tiva_tmp100_initialize(FAR const char *devpath)
{
  FAR struct i2c_master_s *i2c;
  int ret;

  /* Get an instance of the I2C6 interface */

  i2c =  tiva_i2cbus_initialize(TMP100_I2CBUS);
  if (!i2c)
    {
      return -ENODEV;
    }

  /* Then register the temperature sensor */

  ret = lm75_register(devpath, i2c, TMP100_I2CADDR);
  if (ret < 0)
    {
      (void)tiva_i2cbus_uninitialize(i2c);
    }

  return ret;
}