24 const char cmd_sht21_help[] =
"SHT21 test: call sht21 no args for more help";
26 bool cmd_sht21_exec(
int argc,
const char *args[])
28 int temperature, humidity;
33 puts(
"\nsht21 read temp: read Temperature - hold mode \nsht21 read humi: read Humidity - hold mode \nsht21 trigT: trigger Temperature measurement \nsht21 readT: read Temperature \nsht21 trigRH: trigger Relative Humidity measurement \nsht21 readRH: read Relative Humidity");
37 if ( (argc == 1) && (strcmp(args[0],
"trigT") == 0))
42 else if ( (argc == 1) && (strcmp(args[0],
"readT") == 0))
45 printf(
"\n\nTemperature: %d.%d C", (temperature/100), (temperature%100));
49 else if ( (argc == 1) && (strcmp(args[0],
"trigRH") == 0))
54 else if ( (argc == 1) && (strcmp(args[0],
"readRH") == 0))
57 printf(
"\n\nHumidity: %d.%d %%", (humidity/10), (humidity%10));
61 else if ( (argc == 2) && (strcmp(args[0],
"read") == 0) && (strcmp(args[1],
"temp") == 0))
64 printf(
"\n\nTemperature: %d.%d C", (temperature/100), (temperature%100));
68 else if ( (argc == 2) && (strcmp(args[0],
"read") == 0) && (strcmp(args[1],
"humi") == 0))
71 printf(
"\n\nHumidity: %d.%d %%", (humidity/10), (humidity%10));
bool sht21Humi(I2C_Device *dev, uint8_t addr, int *answer)
Starts and reads the relative humidity from SHT21 at I2C address 'addr' (hold master mode); puts the ...
bool sht21Temp(I2C_Device *dev, uint8_t addr, int *answer)
Starts and reads the temperatures from SHT21 at I2C address 'addr' (hold master mode); puts the resul...
#define I2C3
Virtual OpenCores I2C.
bool sht21ReadTemp(I2C_Device *dev, uint8_t addr, int *answer)
Reads the temperatures from SHT21 at I2C address 'addr'; puts the result in answer.
bool sht21ReadHumid(I2C_Device *dev, uint8_t addr, int *answer)
Reads the relative humidity from SHT21 at I2C address 'addr'; puts the result in answer.
void errPrint(bool clear)
Prints the last error.
#define SHT21_I2C_ADDR
SHT21 I2C Address.
This driver is to read the SHT21 I2C temperature and humidity sensor.
bool sht21StartTempMeas(I2C_Device *dev, uint8_t addr)
Starts the temperature measurement in the SHT21 module at I2C address 'addr'.
bool sht21StartHumidMeas(I2C_Device *dev, uint8_t addr)
Starts the relative humidity measurement in the SHT21 module at I2C address 'addr'.
Configures the board-specific peripherals, like I2C, SPI etc...