diff --git a/boards/common/msb-430/drivers/include/sht11-board.h b/boards/common/msb-430/drivers/include/sht1x-board.h similarity index 56% rename from boards/common/msb-430/drivers/include/sht11-board.h rename to boards/common/msb-430/drivers/include/sht1x-board.h index a79fe22b4d9414da141707d52c31e11428a4b661..873504d47c92fa511c7eb611de1f8a4b0800941d 100644 --- a/boards/common/msb-430/drivers/include/sht11-board.h +++ b/boards/common/msb-430/drivers/include/sht1x-board.h @@ -6,8 +6,8 @@ * directory for more details. */ -#ifndef SHT11_BOARD_H -#define SHT11_BOARD_H +#ifndef SHT1X_BOARD_H +#define SHT1X_BOARD_H /** * @ingroup boards_common_msb-430 @@ -32,18 +32,18 @@ extern "C" { * DATA = P3B4 */ -#define SHT11_SCK_LOW P3OUT &= ~(BIT5); /**< serial clock line low */ -#define SHT11_SCK_HIGH P3OUT |= BIT5; /**< serial clock line high */ -#define SHT11_DATA (P3IN & BIT5) /**< read serial I/O */ -#define SHT11_DATA_LOW P3OUT &= ~(BIT5); /**< serial I/O line low */ -#define SHT11_DATA_HIGH P3OUT |= BIT5; /**< serial I/O line high */ -#define SHT11_DATA_IN P3DIR &= ~(BIT5); /**< serial I/O as input */ -#define SHT11_DATA_OUT P3DIR |= BIT5; /**< serial I/O as output */ -#define SHT11_INIT P3DIR |= BIT5; /* FIO1DIR |= BIT25; PINSEL3 &= ~(BIT14|BIT15 | BIT16|BIT17); */ +#define SHT1X_SCK_LOW P3OUT &= ~(BIT5); /**< serial clock line low */ +#define SHT1X_SCK_HIGH P3OUT |= BIT5; /**< serial clock line high */ +#define SHT1X_DATA (P3IN & BIT5) /**< read serial I/O */ +#define SHT1X_DATA_LOW P3OUT &= ~(BIT5); /**< serial I/O line low */ +#define SHT1X_DATA_HIGH P3OUT |= BIT5; /**< serial I/O line high */ +#define SHT1X_DATA_IN P3DIR &= ~(BIT5); /**< serial I/O as input */ +#define SHT1X_DATA_OUT P3DIR |= BIT5; /**< serial I/O as output */ +#define SHT1X_INIT P3DIR |= BIT5; /* FIO1DIR |= BIT25; PINSEL3 &= ~(BIT14|BIT15 | BIT16|BIT17); */ #ifdef __cplusplus } #endif /** @} */ -#endif /* SHT11_BOARD_H */ +#endif /* SHT1X_BOARD_H */ diff --git a/boards/common/msba2/drivers/include/sht11-board.h b/boards/common/msba2/drivers/include/sht1x-board.h similarity index 65% rename from boards/common/msba2/drivers/include/sht11-board.h rename to boards/common/msba2/drivers/include/sht1x-board.h index 7ee0009965815089280778938f45db381b052104..a70589b9ab7c2e80caf32a48de00315e30c9cdeb 100644 --- a/boards/common/msba2/drivers/include/sht11-board.h +++ b/boards/common/msba2/drivers/include/sht1x-board.h @@ -6,8 +6,8 @@ * directory for more details. */ -#ifndef SHT11_BOARD_H -#define SHT11_BOARD_H +#ifndef SHT1X_BOARD_H +#define SHT1X_BOARD_H /** * @ingroup boards_common_msba2 @@ -32,25 +32,25 @@ extern "C" { #endif /* serial clock line low */ -#define SHT11_SCK_LOW FIO1CLR = BIT25; +#define SHT1X_SCK_LOW FIO1CLR = BIT25; /* serial clock line high */ -#define SHT11_SCK_HIGH FIO1SET = BIT25; +#define SHT1X_SCK_HIGH FIO1SET = BIT25; /* read serial I/O */ -#define SHT11_DATA ((FIO1PIN & BIT26) != 0) +#define SHT1X_DATA ((FIO1PIN & BIT26) != 0) /* serial I/O line low */ -#define SHT11_DATA_LOW (FIO1CLR = BIT26); +#define SHT1X_DATA_LOW (FIO1CLR = BIT26); /* serial I/O line high */ -#define SHT11_DATA_HIGH (FIO1SET = BIT26); +#define SHT1X_DATA_HIGH (FIO1SET = BIT26); /* serial I/O as input */ -#define SHT11_DATA_IN (FIO1DIR &= ~BIT26) +#define SHT1X_DATA_IN (FIO1DIR &= ~BIT26) /* serial I/O as output */ -#define SHT11_DATA_OUT (FIO1DIR |= BIT26) +#define SHT1X_DATA_OUT (FIO1DIR |= BIT26) -#define SHT11_INIT FIO1DIR |= BIT25; PINSEL3 &= ~(BIT14|BIT15 | BIT16|BIT17); +#define SHT1X_INIT FIO1DIR |= BIT25; PINSEL3 &= ~(BIT14|BIT15 | BIT16|BIT17); #ifdef __cplusplus } #endif /** @} */ -#endif /* SHT11_BOARD_H */ +#endif /* SHT1X_BOARD_H */ diff --git a/drivers/Makefile.dep b/drivers/Makefile.dep index d9bed242d2d86fbfd14a9308300d261019ba447f..4a95122c303a9035400815ed9c3eb62feb76981b 100644 --- a/drivers/Makefile.dep +++ b/drivers/Makefile.dep @@ -302,7 +302,8 @@ ifneq (,$(filter servo,$(USEMODULE))) FEATURES_REQUIRED += periph_pwm endif -ifneq (,$(filter sht11,$(USEMODULE))) +ifneq (,$(filter sht1%,$(USEMODULE))) + USEMODULE += sht1x USEMODULE += xtimer endif diff --git a/drivers/include/sht11.h b/drivers/include/sht1x.h similarity index 60% rename from drivers/include/sht11.h rename to drivers/include/sht1x.h index 2378ca8c1b83245ec00a8af111af5bae7845c506..447aa74a1f48b67610b2d94bf3683bf028d974ec 100644 --- a/drivers/include/sht11.h +++ b/drivers/include/sht1x.h @@ -7,19 +7,20 @@ */ /** - * @defgroup drivers_sht11 SHT11 Humidity and Temperature Sensor + * @defgroup drivers_sht1x SHT10/SHT11/SHT15 Humidity and Temperature Sensor * @ingroup drivers_sensors - * @brief Driver for Sensirion SHT11 Humidity and Temperature Sensor + * @brief Driver for Sensirion SHT10/SHT11/SHT15 Humidity and Temperature + Sensor * @{ * * @file - * @brief SHT11 Device Driver + * @brief SHT10/SHT11/SHT15 Device Driver * * @author Freie Universität Berlin, Computer Systems & Telematics */ -#ifndef SHT11_H -#define SHT11_H +#ifndef SHT1X_H +#define SHT1X_H #include <stdint.h> @@ -27,22 +28,22 @@ extern "C" { #endif -#define SHT11_NO_ACK (0) /**< don't ack read in `read_byte` */ -#define SHT11_ACK (1) /**< do acknowledge read in `read_byte` */ +#define SHT1X_NO_ACK (0) /**< don't ack read in `read_byte` */ +#define SHT1X_ACK (1) /**< do acknowledge read in `read_byte` */ /* adr command r/w */ -#define SHT11_STATUS_REG_W (0x06) /**< will write to status register */ -#define SHT11_STATUS_REG_R (0x07) /**< will read from status register */ -#define SHT11_MEASURE_TEMP (0x03) /**< tell sensor to measure temperature */ -#define SHT11_MEASURE_HUMI (0x05) /**< tell sensor to measure humidity */ -#define SHT11_RESET (0x1E) /**< reset the sensor */ +#define SHT1X_STATUS_REG_W (0x06) /**< will write to status register */ +#define SHT1X_STATUS_REG_R (0x07) /**< will read from status register */ +#define SHT1X_MEASURE_TEMP (0x03) /**< tell sensor to measure temperature */ +#define SHT1X_MEASURE_HUMI (0x05) /**< tell sensor to measure humidity */ +#define SHT1X_RESET (0x1E) /**< reset the sensor */ /** time to wait after toggling the data line */ -#define SHT11_DATA_WAIT (1) +#define SHT1X_DATA_WAIT (1) /** time to wait after toggling the clock line */ -#define SHT11_CLK_WAIT (1) +#define SHT1X_CLK_WAIT (1) /** set measurement timeout to 1 second */ -#define SHT11_MEASURE_TIMEOUT (1000) +#define SHT1X_MEASURE_TIMEOUT (1000) /** * @brief sht11 measureable data @@ -51,7 +52,7 @@ typedef struct { float temperature; /**< temperature value */ float relhum; /**< linear relative humidity */ float relhum_temp; /**< temperature compensated relative humidity */ -} sht11_val_t; +} sht1x_val_t; /** * @brief SHT11 modes that can be measured @@ -59,12 +60,12 @@ typedef struct { typedef enum { TEMPERATURE = 1, HUMIDITY = 2 -} sht11_mode_t; +} sht1x_mode_t; /** * @brief Initialize SHT11 ports */ -void sht11_init(void); +void sht1x_init(void); /** * @brief Read sensor @@ -75,11 +76,11 @@ void sht11_init(void); * @return 1 on success, 0 otherwise * * Example: - * \code sht11_val sht11; - * sht11_read_sensor(&sht11, HUMIDITY|TEMPERATURE); + * \code sht1x_val sht11; + * sht1x_read_sensor(&sht11, HUMIDITY|TEMPERATURE); * printf("%-6.2f °C %5.2f %% %5.2f %%\n", sht11.temperature, sht11.relhum, sht11.relhum_temp); \endcode */ -uint8_t sht11_read_sensor(sht11_val_t *value, sht11_mode_t mode); +uint8_t sht1x_read_sensor(sht1x_val_t *value, sht1x_mode_t mode); /** * @brief Write status register @@ -88,7 +89,7 @@ uint8_t sht11_read_sensor(sht11_val_t *value, sht11_mode_t mode); * * @return 1 on success, 0 otherwise */ -uint8_t sht11_write_status(uint8_t *p_value); +uint8_t sht1x_write_status(uint8_t *p_value); /** * @brief Read status register with checksum @@ -98,11 +99,11 @@ uint8_t sht11_write_status(uint8_t *p_value); * * return 1 on success, 0 otherwise */ -uint8_t sht11_read_status(uint8_t *p_value, uint8_t *p_checksum); +uint8_t sht1x_read_status(uint8_t *p_value, uint8_t *p_checksum); #ifdef __cplusplus } #endif -#endif /* SHT11_H */ +#endif /* SHT1X_H */ /** @} */ diff --git a/drivers/sht11/Makefile b/drivers/sht1x/Makefile similarity index 100% rename from drivers/sht11/Makefile rename to drivers/sht1x/Makefile diff --git a/drivers/sht11/sht11.c b/drivers/sht1x/sht1x.c similarity index 72% rename from drivers/sht11/sht11.c rename to drivers/sht1x/sht1x.c index e92b15013b7f6b605d4170dafe7f7b9f9f89f0d7..c48d03a177e6c832c1832a0ef5162a1398b2b6f2 100644 --- a/drivers/sht11/sht11.c +++ b/drivers/sht1x/sht1x.c @@ -7,7 +7,7 @@ */ /** - * @ingroup drivers_sht11 + * @ingroup drivers_sht1x * @brief Driver for the Sensirion SHT11 humidity and temperature sensor * @{ * @@ -16,7 +16,7 @@ * * @version $Revision: 2396 $ * - * @note $Id: sht11.c 2396 2010-07-06 15:12:35Z ziegert $ + * @note $Id: sht1x.c 2396 2010-07-06 15:12:35Z ziegert $ * @} */ @@ -25,11 +25,11 @@ #include "xtimer.h" #include "mutex.h" -#include "sht11.h" -#include "sht11-board.h" +#include "sht1x.h" +#include "sht1x-board.h" #include "bitarithm.h" -float sht11_temperature_offset; +float sht1x_temperature_offset; /** * @brief Perform measurement @@ -76,15 +76,15 @@ static void transmission_start(void); static inline void clk_signal(void); /* mutex for exclusive measurement operation */ -mutex_t sht11_mutex = MUTEX_INIT; +mutex_t sht1x_mutex = MUTEX_INIT; /*---------------------------------------------------------------------------*/ static inline void clk_signal(void) { - SHT11_SCK_HIGH; - xtimer_usleep(SHT11_CLK_WAIT); - SHT11_SCK_LOW; - xtimer_usleep(SHT11_CLK_WAIT); + SHT1X_SCK_HIGH; + xtimer_usleep(SHT1X_CLK_WAIT); + SHT1X_SCK_LOW; + xtimer_usleep(SHT1X_CLK_WAIT); } /*---------------------------------------------------------------------------*/ @@ -93,17 +93,17 @@ static uint8_t write_byte(uint8_t value) uint8_t i; uint8_t ack; - SHT11_DATA_OUT; + SHT1X_DATA_OUT; /* send value bit by bit to sht11 */ for (i = 0; i < 8; i++) { if (value & BIT7) { - SHT11_DATA_HIGH; - xtimer_usleep(SHT11_DATA_WAIT); + SHT1X_DATA_HIGH; + xtimer_usleep(SHT1X_DATA_WAIT); } else { - SHT11_DATA_LOW; - xtimer_usleep(SHT11_DATA_WAIT); + SHT1X_DATA_LOW; + xtimer_usleep(SHT1X_DATA_WAIT); } /* trigger clock signal */ @@ -114,9 +114,9 @@ static uint8_t write_byte(uint8_t value) } /* wait for ack */ - SHT11_DATA_IN; - xtimer_usleep(SHT11_CLK_WAIT); - ack = SHT11_DATA; + SHT1X_DATA_IN; + xtimer_usleep(SHT1X_CLK_WAIT); + ack = SHT1X_DATA; clk_signal(); @@ -128,40 +128,40 @@ static uint8_t read_byte(uint8_t ack) uint8_t i; uint8_t value = 0; - SHT11_DATA_IN; - xtimer_usleep(SHT11_DATA_WAIT); + SHT1X_DATA_IN; + xtimer_usleep(SHT1X_DATA_WAIT); /* read value bit by bit */ for (i = 0; i < 8; i++) { value = value << 1; - SHT11_SCK_HIGH; - xtimer_usleep(SHT11_CLK_WAIT); + SHT1X_SCK_HIGH; + xtimer_usleep(SHT1X_CLK_WAIT); - if (SHT11_DATA) { + if (SHT1X_DATA) { /* increase data by one when DATA is high */ value++; } - SHT11_SCK_LOW; - xtimer_usleep(SHT11_CLK_WAIT); + SHT1X_SCK_LOW; + xtimer_usleep(SHT1X_CLK_WAIT); } /* send ack if necessary */ - SHT11_DATA_OUT; + SHT1X_DATA_OUT; if (ack) { - SHT11_DATA_LOW; - xtimer_usleep(SHT11_DATA_WAIT); + SHT1X_DATA_LOW; + xtimer_usleep(SHT1X_DATA_WAIT); } else { - SHT11_DATA_HIGH; - xtimer_usleep(SHT11_DATA_WAIT); + SHT1X_DATA_HIGH; + xtimer_usleep(SHT1X_DATA_WAIT); } clk_signal(); /* release data line */ - SHT11_DATA_IN; + SHT1X_DATA_IN; return value; } @@ -173,31 +173,31 @@ static void transmission_start(void) ___ ___ SCK : ___| |___| |______ */ - SHT11_DATA_OUT; + SHT1X_DATA_OUT; /* set initial state */ - SHT11_DATA_HIGH; - xtimer_usleep(SHT11_DATA_WAIT); - SHT11_SCK_LOW; - xtimer_usleep(SHT11_CLK_WAIT); + SHT1X_DATA_HIGH; + xtimer_usleep(SHT1X_DATA_WAIT); + SHT1X_SCK_LOW; + xtimer_usleep(SHT1X_CLK_WAIT); - SHT11_SCK_HIGH; - xtimer_usleep(SHT11_CLK_WAIT); + SHT1X_SCK_HIGH; + xtimer_usleep(SHT1X_CLK_WAIT); - SHT11_DATA_LOW; - xtimer_usleep(SHT11_DATA_WAIT); + SHT1X_DATA_LOW; + xtimer_usleep(SHT1X_DATA_WAIT); - SHT11_SCK_LOW; - xtimer_usleep(SHT11_CLK_WAIT); + SHT1X_SCK_LOW; + xtimer_usleep(SHT1X_CLK_WAIT); - SHT11_SCK_HIGH; - xtimer_usleep(SHT11_CLK_WAIT); + SHT1X_SCK_HIGH; + xtimer_usleep(SHT1X_CLK_WAIT); - SHT11_DATA_HIGH; - xtimer_usleep(SHT11_DATA_WAIT); + SHT1X_DATA_HIGH; + xtimer_usleep(SHT1X_DATA_WAIT); - SHT11_SCK_LOW; - xtimer_usleep(SHT11_CLK_WAIT); + SHT1X_SCK_LOW; + xtimer_usleep(SHT1X_CLK_WAIT); } /*---------------------------------------------------------------------------*/ static void connection_reset(void) @@ -208,10 +208,10 @@ static void connection_reset(void) SCK : __| |__| |__| |__| |__| |__| |__| |__| |__| |______| |___| |__ */ uint8_t i; - SHT11_DATA_HIGH; - xtimer_usleep(SHT11_DATA_WAIT); - SHT11_SCK_LOW; - xtimer_usleep(SHT11_CLK_WAIT); + SHT1X_DATA_HIGH; + xtimer_usleep(SHT1X_DATA_WAIT); + SHT1X_SCK_LOW; + xtimer_usleep(SHT1X_CLK_WAIT); for (i = 0; i < 9; i++) { clk_signal(); @@ -232,8 +232,8 @@ static uint8_t measure(uint8_t *p_value, uint8_t *p_checksum, uint8_t mode) xtimer_usleep(1000); /* wait untile sensor has finished measurement or timeout */ - for (i = 0; (i < SHT11_MEASURE_TIMEOUT) && (!error); i++) { - ack = SHT11_DATA; + for (i = 0; (i < SHT1X_MEASURE_TIMEOUT) && (!error); i++) { + ack = SHT1X_DATA; if (!ack) { break; @@ -245,44 +245,44 @@ static uint8_t measure(uint8_t *p_value, uint8_t *p_checksum, uint8_t mode) error += ack; /* read MSB */ - *(p_value + 1) = read_byte(SHT11_ACK); + *(p_value + 1) = read_byte(SHT1X_ACK); /* read LSB */ - *(p_value) = read_byte(SHT11_ACK); + *(p_value) = read_byte(SHT1X_ACK); /* read checksum */ - *p_checksum = read_byte(SHT11_NO_ACK); + *p_checksum = read_byte(SHT1X_NO_ACK); return (!error); } /*---------------------------------------------------------------------------*/ -void sht11_init(void) +void sht1x_init(void) { - sht11_temperature_offset = 0; - SHT11_INIT; + sht1x_temperature_offset = 0; + SHT1X_INIT; xtimer_usleep(11 * 1000); } /*---------------------------------------------------------------------------*/ -uint8_t sht11_read_status(uint8_t *p_value, uint8_t *p_checksum) +uint8_t sht1x_read_status(uint8_t *p_value, uint8_t *p_checksum) { uint8_t error = 0; transmission_start(); - error |= write_byte(SHT11_STATUS_REG_R); - *p_value = read_byte(SHT11_ACK); - *p_checksum = read_byte(SHT11_NO_ACK); + error |= write_byte(SHT1X_STATUS_REG_R); + *p_value = read_byte(SHT1X_ACK); + *p_checksum = read_byte(SHT1X_NO_ACK); return (!error); } /*---------------------------------------------------------------------------*/ -uint8_t sht11_write_status(uint8_t *p_value) +uint8_t sht1x_write_status(uint8_t *p_value) { uint8_t error = 0; transmission_start(); - error += write_byte(SHT11_STATUS_REG_W); + error += write_byte(SHT1X_STATUS_REG_W); error += write_byte(*p_value); return (!error); } /*---------------------------------------------------------------------------*/ -uint8_t sht11_read_sensor(sht11_val_t *value, sht11_mode_t mode) +uint8_t sht1x_read_sensor(sht1x_val_t *value, sht1x_mode_t mode) { uint8_t error = 0; uint8_t checksum; @@ -313,28 +313,28 @@ uint8_t sht11_read_sensor(sht11_val_t *value, sht11_mode_t mode) value->relhum = 0; value->relhum_temp = 0; - mutex_lock(&sht11_mutex); + mutex_lock(&sht1x_mutex); connection_reset(); /* measure humidity */ if (mode & HUMIDITY) { - error += (!measure((uint8_t *) &humi_int, &checksum, SHT11_MEASURE_HUMI)); + error += (!measure((uint8_t *) &humi_int, &checksum, SHT1X_MEASURE_HUMI)); } /* measure temperature */ if (mode & TEMPERATURE) { - error += (!measure((uint8_t *) &temp_int, &checksum, SHT11_MEASURE_TEMP)); + error += (!measure((uint8_t *) &temp_int, &checksum, SHT1X_MEASURE_TEMP)); } /* break on error */ if (error != 0) { connection_reset(); - mutex_unlock(&sht11_mutex); + mutex_unlock(&sht1x_mutex); return 0; } if (mode & TEMPERATURE) { - value->temperature = D1 + (D2 * ((float) temp_int)) + sht11_temperature_offset; + value->temperature = D1 + (D2 * ((float) temp_int)) + sht1x_temperature_offset; } if (mode & HUMIDITY) { @@ -345,6 +345,6 @@ uint8_t sht11_read_sensor(sht11_val_t *value, sht11_mode_t mode) } } - mutex_unlock(&sht11_mutex); + mutex_unlock(&sht1x_mutex); return 1; } diff --git a/makefiles/pseudomodules.inc.mk b/makefiles/pseudomodules.inc.mk index 1e3d3198985a4150e2374ae818a85333c828de4d..0d04d3cec7c6e1f84dd6ae2aa2a37df5051c9e69 100644 --- a/makefiles/pseudomodules.inc.mk +++ b/makefiles/pseudomodules.inc.mk @@ -95,6 +95,11 @@ PSEUDOMODULES += adc121c PSEUDOMODULES += sx1272 PSEUDOMODULES += sx1276 +# include variants of SHT1X drivers as pseudo modules +PSEUDOMODULES += sht10 +PSEUDOMODULES += sht11 +PSEUDOMODULES += sht15 + # include variants of Si114x drivers as pseudo modules PSEUDOMODULES += si1145 PSEUDOMODULES += si1146 diff --git a/sys/auto_init/auto_init.c b/sys/auto_init/auto_init.c index 067b367e8550186f57195e1dcdadd48e66ec25e7..617a0735235962e8a7fb5a165ff40cc3dbbcfb35 100644 --- a/sys/auto_init/auto_init.c +++ b/sys/auto_init/auto_init.c @@ -20,8 +20,8 @@ #include "auto_init.h" -#ifdef MODULE_SHT11 -#include "sht11.h" +#ifdef MODULE_SHT1X +#include "sht1x.h" #endif #ifdef MODULE_MCI @@ -101,9 +101,9 @@ void auto_init(void) DEBUG("Auto init xtimer module.\n"); xtimer_init(); #endif -#ifdef MODULE_SHT11 - DEBUG("Auto init SHT11 module.\n"); - sht11_init(); +#ifdef MODULE_SHT1X + DEBUG("Auto init SHT1X module.\n"); + sht1x_init(); #endif #ifdef MODULE_MCI DEBUG("Auto init mci module.\n"); diff --git a/sys/shell/commands/Makefile b/sys/shell/commands/Makefile index 8e8e56e3d9fc46427e64ca3c23d35c419bebb618..5d1908f2d13e9c4d903f37aab68495b514688e7d 100644 --- a/sys/shell/commands/Makefile +++ b/sys/shell/commands/Makefile @@ -8,8 +8,8 @@ endif ifneq (,$(filter ps,$(USEMODULE))) SRC += sc_ps.c endif -ifneq (,$(filter sht11,$(USEMODULE))) - SRC += sc_sht11.c +ifneq (,$(filter sht1x,$(USEMODULE))) + SRC += sc_sht1x.c endif ifneq (,$(filter lpc2387,$(USEMODULE))) SRC += sc_heap.c diff --git a/sys/shell/commands/sc_sht11.c b/sys/shell/commands/sc_sht1x.c similarity index 69% rename from sys/shell/commands/sc_sht11.c rename to sys/shell/commands/sc_sht1x.c index 6722626125bfb714a320248cca28e11d53fae7fd..2a379def5cce0afc2addf3ac1c2fbdd40fe4a10e 100644 --- a/sys/shell/commands/sc_sht11.c +++ b/sys/shell/commands/sc_sht1x.c @@ -22,11 +22,11 @@ #include <stdint.h> #include <stdlib.h> #include <string.h> -#include "sht11.h" +#include "sht1x.h" -#ifdef MODULE_SHT11 +#ifdef MODULE_SHT1X -extern float sht11_temperature_offset; +extern float sht1x_temperature_offset; int _get_humidity_handler(int argc, char **argv) { @@ -34,8 +34,8 @@ int _get_humidity_handler(int argc, char **argv) (void) argv; uint8_t success; - sht11_val_t sht11_val; - success = sht11_read_sensor(&sht11_val, HUMIDITY | TEMPERATURE); + sht1x_val_t sht1x_val; + success = sht1x_read_sensor(&sht1x_val, HUMIDITY | TEMPERATURE); if (!success) { printf("Error reading SHT11\n"); @@ -44,7 +44,7 @@ int _get_humidity_handler(int argc, char **argv) } else { printf("Relative humidity: %5.2f%% / Temperature compensated humidity; %5.2f%%\n", - (double) sht11_val.relhum, (double) sht11_val.relhum_temp); + (double) sht1x_val.relhum, (double) sht1x_val.relhum_temp); return 0; } @@ -56,8 +56,8 @@ int _get_temperature_handler(int argc, char **argv) (void) argv; uint8_t success; - sht11_val_t sht11_val; - success = sht11_read_sensor(&sht11_val, TEMPERATURE); + sht1x_val_t sht1x_val; + success = sht1x_read_sensor(&sht1x_val, TEMPERATURE); if (!success) { printf("Error reading SHT11\n"); @@ -65,7 +65,7 @@ int _get_temperature_handler(int argc, char **argv) return 1; } else { - printf("Temperature: %-6.2f°C\n", (double) sht11_val.temperature); + printf("Temperature: %-6.2f°C\n", (double) sht1x_val.temperature); return 0; } @@ -77,8 +77,8 @@ int _get_weather_handler(int argc, char **argv) (void) argv; uint8_t success; - sht11_val_t sht11_val; - success = sht11_read_sensor(&sht11_val, HUMIDITY | TEMPERATURE); + sht1x_val_t sht1x_val; + success = sht1x_read_sensor(&sht1x_val, HUMIDITY | TEMPERATURE); if (!success) { printf("Error reading SHT11\n"); @@ -87,8 +87,8 @@ int _get_weather_handler(int argc, char **argv) } else { printf("Relative humidity: %5.2f%% / Temperature compensated humidity; %5.2f%% ", - (double) sht11_val.relhum, (double) sht11_val.relhum_temp); - printf("Temperature: %-6.2f°C\n", (double) sht11_val.temperature); + (double) sht1x_val.relhum, (double) sht1x_val.relhum_temp); + printf("Temperature: %-6.2f°C\n", (double) sht1x_val.temperature); return 0; } @@ -102,8 +102,8 @@ int _set_offset_handler(int argc, char **argv) return 1; } else { - sht11_temperature_offset = atoi(argv[1]); - printf("Temperature offset set to %f\n", (double) sht11_temperature_offset); + sht1x_temperature_offset = atoi(argv[1]); + printf("Temperature offset set to %f\n", (double) sht1x_temperature_offset); return 0; } diff --git a/sys/shell/commands/shell_commands.c b/sys/shell/commands/shell_commands.c index 6ab2937dc293f0a4520237fce81cbe1501ee96ea..ce73861323c392790bcfdc716cac1a4010ec570a 100644 --- a/sys/shell/commands/shell_commands.c +++ b/sys/shell/commands/shell_commands.c @@ -37,7 +37,7 @@ extern int _heap_handler(int argc, char **argv); extern int _ps_handler(int argc, char **argv); #endif -#ifdef MODULE_SHT11 +#ifdef MODULE_SHT1X extern int _get_temperature_handler(int argc, char **argv); extern int _get_humidity_handler(int argc, char **argv); extern int _get_weather_handler(int argc, char **argv); @@ -153,7 +153,7 @@ const shell_command_t _shell_command_list[] = { #ifdef MODULE_PS {"ps", "Prints information about running threads.", _ps_handler}, #endif -#ifdef MODULE_SHT11 +#ifdef MODULE_SHT1X {"temp", "Prints measured temperature.", _get_temperature_handler}, {"hum", "Prints measured humidity.", _get_humidity_handler}, {"weather", "Prints measured humidity and temperature.", _get_weather_handler},