2121#include <linux/slab.h>
2222#include <linux/jiffies.h>
2323
24- /* commands (high precision mode) */
24+ /* commands (high repeatability mode) */
2525static const unsigned char sht3x_cmd_measure_single_hpm [] = { 0x24 , 0x00 };
2626
27- /* commands (low power mode) */
27+ /* commands (low repeatability mode) */
2828static const unsigned char sht3x_cmd_measure_single_lpm [] = { 0x24 , 0x16 };
2929
3030/* commands for periodic mode */
@@ -66,9 +66,14 @@ enum sht3x_limits {
6666 limit_min_hyst ,
6767};
6868
69+ enum sht3x_repeatability {
70+ low_repeatability ,
71+ high_repeatability ,
72+ };
73+
6974DECLARE_CRC8_TABLE (sht3x_crc8_table );
7075
71- /* periodic measure commands (high precision mode) */
76+ /* periodic measure commands (high repeatability mode) */
7277static const char periodic_measure_commands_hpm [][SHT3X_CMD_LENGTH ] = {
7378 /* 0.5 measurements per second */
7479 {0x20 , 0x32 },
@@ -82,7 +87,7 @@ static const char periodic_measure_commands_hpm[][SHT3X_CMD_LENGTH] = {
8287 {0x27 , 0x37 },
8388};
8489
85- /* periodic measure commands (low power mode) */
90+ /* periodic measure commands (low repeatability mode) */
8691static const char periodic_measure_commands_lpm [][SHT3X_CMD_LENGTH ] = {
8792 /* 0.5 measurements per second */
8893 {0x20 , 0x2f },
@@ -132,7 +137,7 @@ struct sht3x_data {
132137 const unsigned char * command ;
133138 u32 wait_time ; /* in us*/
134139 unsigned long last_update ; /* last update in periodic mode*/
135- bool high_precision ;
140+ enum sht3x_repeatability repeatability ;
136141
137142 /*
138143 * cached values for temperature and humidity and limits
@@ -436,7 +441,7 @@ static void sht3x_select_command(struct sht3x_data *data)
436441 data -> command = sht3x_cmd_measure_periodic_mode ;
437442 data -> wait_time = 0 ;
438443 } else {
439- if (data -> high_precision ) {
444+ if (data -> repeatability == high_repeatability ) {
440445 data -> command = sht3x_cmd_measure_single_hpm ;
441446 data -> wait_time = SHT3X_SINGLE_WAIT_TIME_HPM ;
442447 } else {
@@ -584,7 +589,7 @@ static ssize_t update_interval_store(struct device *dev,
584589 }
585590
586591 if (mode > 0 ) {
587- if (data -> high_precision )
592+ if (data -> repeatability == high_repeatability )
588593 command = periodic_measure_commands_hpm [mode - 1 ];
589594 else
590595 command = periodic_measure_commands_lpm [mode - 1 ];
@@ -679,7 +684,7 @@ static int sht3x_probe(struct i2c_client *client)
679684 if (!data )
680685 return - ENOMEM ;
681686
682- data -> high_precision = true ;
687+ data -> repeatability = high_repeatability ;
683688 data -> mode = 0 ;
684689 data -> last_update = jiffies - msecs_to_jiffies (3000 );
685690 data -> client = client ;
0 commit comments