drivers/sensors/hyt271: Fix typos in comments and identifier

drivers/sensors/hyt271.c:

    * struct hyt271_dev_s: Identifier "lock_measure_cylce" was
      misspelled. Fix to "lock_measure_cycle" and update all instances
      in the file.

    * hyt271_mr(), hyt271_cmd(), hyt271_change_addr(),
      hyt271_measure_read(), hyt271_thread(): Update instances of the
      renamed "lock_measure_cycle" variable and fix various typos in
      comments.
This commit is contained in:
Nathan Hartman
2021-07-01 12:23:36 -04:00
committed by Xiang Xiao
parent de213401a7
commit ee81b5a1d5
+23 -23
View File
@@ -93,7 +93,7 @@ struct hyt271_dev_s
struct hyt271_sensor_s sensor[HYT271_SENSOR_MAX]; /* Sensor types */ struct hyt271_sensor_s sensor[HYT271_SENSOR_MAX]; /* Sensor types */
FAR struct i2c_master_s *i2c; /* I2C interface */ FAR struct i2c_master_s *i2c; /* I2C interface */
FAR struct hyt271_bus_s *bus; /* Bus power interface */ FAR struct hyt271_bus_s *bus; /* Bus power interface */
sem_t lock_measure_cylce; /* Locks measure cycle */ sem_t lock_measure_cycle; /* Locks measure cycle */
uint32_t freq; /* I2C Frequency */ uint32_t freq; /* I2C Frequency */
#ifdef CONFIG_SENSORS_HYT271_POLL #ifdef CONFIG_SENSORS_HYT271_POLL
unsigned int interval; /* Polling interval */ unsigned int interval; /* Polling interval */
@@ -256,7 +256,7 @@ static int hyt271_df(FAR struct hyt271_dev_s *dev,
/**************************************************************************** /****************************************************************************
* Name: hyt271_mr * Name: hyt271_mr
* *
* Description: Helper for sending a measurement cylce request. * Description: Helper for sending a measurement cycle request.
* *
* Parameter: * Parameter:
* dev - Pointer to private driver instance * dev - Pointer to private driver instance
@@ -274,10 +274,10 @@ static int hyt271_mr(FAR struct hyt271_dev_s *dev,
/* We only must send the i2c address with write bit enabled here. This /* We only must send the i2c address with write bit enabled here. This
* isn't provided by the i2c api, so instead sending a null byte seems * isn't provided by the i2c api, so instead sending a null byte seems
* working fine. * to work fine.
*/ */
buffer = 0x00; buffer = 0x00;
/* Send address only with write bit enabled */ /* Send address only with write bit enabled */
@@ -330,7 +330,7 @@ static int hyt271_cmd(FAR struct hyt271_dev_s *dev,
* Name: hyt271_cmd_response * Name: hyt271_cmd_response
* *
* Description: Helper for sending a command fetching the response after a * Description: Helper for sending a command fetching the response after a
* neccessary timeout. * necessary timeout.
* Parameter: * Parameter:
* dev - Pointer to private driver instance * dev - Pointer to private driver instance
* config - I2C configuration * config - I2C configuration
@@ -412,12 +412,12 @@ static int hyt271_change_addr(FAR struct hyt271_dev_s *dev, uint8_t addr)
return -EINVAL; return -EINVAL;
} }
/* Reset and subsequently operation must be mutual exclusive /* Reset and subsequent operations must be mutually exclusive. Prevents
* Prevents from beeing used by another open driver instance during this * from being used by another open driver instance during this address
* operations. * change operation.
*/ */
ret = nxsem_wait(&dev->lock_measure_cylce); ret = nxsem_wait(&dev->lock_measure_cycle);
if (ret < 0) if (ret < 0)
{ {
return ret; return ret;
@@ -474,7 +474,7 @@ static int hyt271_change_addr(FAR struct hyt271_dev_s *dev, uint8_t addr)
if ((buffer[2] & 0x7f) != dev->addr) if ((buffer[2] & 0x7f) != dev->addr)
{ {
snerr("wrong current I2C address responsed: 0x%x\n", buffer[2] & 0x7f); snerr("wrong current I2C address response: 0x%x\n", buffer[2] & 0x7f);
ret = -EIO; ret = -EIO;
goto err_unlock; goto err_unlock;
} }
@@ -500,7 +500,7 @@ static int hyt271_change_addr(FAR struct hyt271_dev_s *dev, uint8_t addr)
if ((buffer[2] & 0x7f) != addr) if ((buffer[2] & 0x7f) != addr)
{ {
snerr("wrong changed I2C address responsed: 0x%x\n", buffer[2] & 0x7f); snerr("wrong changed I2C address response: 0x%x\n", buffer[2] & 0x7f);
ret = -EIO; ret = -EIO;
goto err_unlock; goto err_unlock;
} }
@@ -518,11 +518,11 @@ static int hyt271_change_addr(FAR struct hyt271_dev_s *dev, uint8_t addr)
dev->addr = addr; dev->addr = addr;
nxsem_post(&dev->lock_measure_cylce); nxsem_post(&dev->lock_measure_cycle);
return OK; return OK;
err_unlock: err_unlock:
nxsem_post(&dev->lock_measure_cylce); nxsem_post(&dev->lock_measure_cycle);
return ret; return ret;
} }
@@ -530,7 +530,7 @@ err_unlock:
* Name: hyt271_measure_read * Name: hyt271_measure_read
* *
* Description: * Description:
* Performs a measuremnt cylce and reads measured data. * Performs a measurement cycle and reads measured data.
* *
* Parameter: * Parameter:
* dev - Pointer to private driver instance * dev - Pointer to private driver instance
@@ -547,12 +547,12 @@ static int hyt271_measure_read(FAR struct hyt271_dev_s *dev,
struct i2c_config_s config; struct i2c_config_s config;
uint8_t buffer[4]; uint8_t buffer[4];
/* Measure request and read operation must be mutual exclusive /* Measure request and read operation must be mutually exclusive.
* Prevents from beeing used by another open driver instance during this * Prevents from being used by another open driver instance during this
* read operation. * read operation.
*/ */
ret = nxsem_wait(&dev->lock_measure_cylce); ret = nxsem_wait(&dev->lock_measure_cycle);
if (ret < 0) if (ret < 0)
{ {
return ret; return ret;
@@ -589,19 +589,19 @@ static int hyt271_measure_read(FAR struct hyt271_dev_s *dev,
buffer[2] << 8 | buffer[3]; buffer[2] << 8 | buffer[3];
data->timestamp = hyt271_curtime(); data->timestamp = hyt271_curtime();
nxsem_post(&dev->lock_measure_cylce); nxsem_post(&dev->lock_measure_cycle);
return OK; return OK;
err_unlock: err_unlock:
nxsem_post(&dev->lock_measure_cylce); nxsem_post(&dev->lock_measure_cycle);
return ret; return ret;
} }
/**************************************************************************** /****************************************************************************
* Name: hyt271_fetch * Name: hyt271_fetch
* *
* Description: Performs a measuremnt cylce and data read with data * Description: Performs a measurement cycle and data read with data
* conversion. * conversion.
* *
* Parameter: * Parameter:
@@ -790,7 +790,7 @@ static int hyt271_thread(int argc, char** argv)
if (!hsensor->enabled && !tsensor->enabled) if (!hsensor->enabled && !tsensor->enabled)
{ {
/* Reset inital read identifier */ /* Reset initial read identifier */
priv->initial_read = false; priv->initial_read = false;
@@ -908,7 +908,7 @@ int hyt271_register(int devno, FAR struct i2c_master_s *i2c, uint8_t addr,
priv->initial_read = false; priv->initial_read = false;
#endif #endif
nxsem_init(&priv->lock_measure_cylce, 0, 1); nxsem_init(&priv->lock_measure_cycle, 0, 1);
#ifdef CONFIG_SENSORS_HYT271_POLL #ifdef CONFIG_SENSORS_HYT271_POLL
nxsem_init(&priv->run, 0, 0); nxsem_init(&priv->run, 0, 0);
nxsem_set_protocol(&priv->run, SEM_PRIO_NONE); nxsem_set_protocol(&priv->run, SEM_PRIO_NONE);
@@ -970,7 +970,7 @@ humi_err:
temp_err: temp_err:
sensor_unregister(&priv->sensor[HYT271_SENSOR_TEMP].lower, devno); sensor_unregister(&priv->sensor[HYT271_SENSOR_TEMP].lower, devno);
nxsem_destroy(&priv->lock_measure_cylce); nxsem_destroy(&priv->lock_measure_cycle);
kmm_free(priv); kmm_free(priv);
return ret; return ret;
} }