Cosmetic changes from review of last PR.

This commit is contained in:
Gregory Nutt 2019-01-09 07:49:19 -06:00
parent d4a38a8974
commit e74cabf923
4 changed files with 47 additions and 19 deletions

View File

@ -287,6 +287,7 @@ static int scd30_write_cmd(FAR struct scd30_dev_s *priv, uint16_t cmd,
return (ret >= 0) ? OK : ret;
#else
/* UART mode not implemented yet. */
return -ENODEV;
#endif
}
@ -315,6 +316,7 @@ static int scd30_read_words(FAR struct scd30_dev_s *priv,
return (ret >= 0) ? OK : ret;
#else
/* UART mode not implemented yet. */
return -ENODEV;
#endif
}
@ -390,7 +392,9 @@ static int scd30_check_data_crc(FAR const struct scd30_word_s *words,
while (num_words)
{
if (scd30_crc_word(scd30_data_word_to_uint16(words)) != words->crc)
{
return -1;
}
num_words--;
words++;
@ -413,7 +417,9 @@ static int scd30_softreset(FAR struct scd30_dev_s *priv)
ret = scd30_write_cmd(priv, SCD30_CMD_SOFT_RESET, NULL, 0);
if (ret < 0)
{
return ret;
}
return 0;
}

View File

@ -326,10 +326,14 @@ static int sgp30_read_cmd(FAR struct sgp30_dev_s *priv, struct sgp30_cmd_s cmd,
msg[0].length = 2;
ret = sgp30_do_transfer(priv->i2c, msg, 1);
sgp30_dbg("cmd: 0x%04X delay: %uus ret: %d\n", cmd.address,
cmd.read_delay_usec, ret);
if (ret < 0)
{
return ret;
}
up_udelay(cmd.read_delay_usec + 100);
@ -400,7 +404,9 @@ static int sgp30_check_data_crc(FAR const struct sgp30_word_s *words,
while (num_words)
{
if (sgp30_crc_word(sgp30_data_word_to_uint16(words)) != words->crc)
{
return -1;
}
num_words--;
words++;

View File

@ -281,6 +281,7 @@ static int sps30_write_cmd(FAR struct sps30_dev_s *priv, uint16_t cmd,
return (ret >= 0) ? OK : ret;
#else
/* UART mode not implemented yet. */
return -ENODEV;
#endif
}
@ -308,9 +309,13 @@ static int sps30_read_cmd(FAR struct sps30_dev_s *priv, uint16_t cmd,
msg[0].length = 2;
ret = sps30_do_transfer(priv->i2c, msg, 1);
sps30_dbg("cmd: 0x%04X ret: %d\n", cmd, ret);
if (ret < 0)
{
return ret;
}
msg[0].frequency = CONFIG_SPS30_I2C_FREQUENCY;
msg[0].addr = priv->addr;
@ -325,6 +330,7 @@ static int sps30_read_cmd(FAR struct sps30_dev_s *priv, uint16_t cmd,
return (ret >= 0) ? OK : ret;
#else
/* UART mode not implemented yet. */
return -ENODEV;
#endif
}
@ -400,7 +406,9 @@ static int sps30_check_data_crc(FAR const struct sps30_word_s *words,
while (num_words)
{
if (sps30_crc_word(sps30_data_word_to_uint16(words)) != words->crc)
{
return -1;
}
num_words--;
words++;
@ -423,7 +431,9 @@ static int sps30_softreset(FAR struct sps30_dev_s *priv)
ret = sps30_write_cmd(priv, SPS30_CMD_SOFT_RESET, NULL, 0);
if (ret < 0)
{
return ret;
}
return 0;
}
@ -600,7 +610,9 @@ static int sps30_read_dev_info(FAR struct sps30_dev_s *priv, uint16_t cmd,
}
if (outlen)
{
*out = '\0';
}
return ret;
}
@ -959,7 +971,9 @@ static int sps30_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
}
if (arg > 0 && arg < 15)
{
arg = 15;
}
sps30_set_command_param(&param, arg);
ret = sps30_write_cmd(priv, SPS30_CMD_SET_AUTO_CLEANING_INTERVAL,

View File

@ -58,6 +58,7 @@ struct sps30_conv_data_s
/* Mass Concentrations for particle ranges PM1.0, PM2.5, PM4.0, PM10.
* Unit is [µg/m³] (microgram per cubicmeter).
*/
float mass_concenration_pm1_0;
float mass_concenration_pm2_5;
float mass_concenration_pm4_0;
@ -74,6 +75,7 @@ struct sps30_conv_data_s
float number_concenration_pm10;
/* Typical particle size. Unit is [µm] (micrometer). */
float typical_particle_size;
};