mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
tests/shtcx: refactoring of code to work with the new shtcx module
This commit is contained in:
parent
999887a764
commit
453f877f79
@ -1,4 +1,10 @@
|
||||
#About
|
||||
Testing application for the SHTC1 temperature and humidity sensor
|
||||
Testing application for the SHTCX faimly of temperature and humidity sensors.
|
||||
This driver can be used with the SHTC1 and SHTC3 sensors.
|
||||
|
||||
Default driver is "shtc1". To use the SHTC3 driver, set the "DRIVER" when building the application:
|
||||
|
||||
DRIVER=shtc3 make BOARD=<your board>
|
||||
|
||||
#Usage
|
||||
Just build it using the `make BOARD=??? flash` command in the `tests/driver_shtc1` folder. Temperature and humidity values should be printed in the terminal every 2s
|
||||
Just build it using the `make BOARD=??? flash` command in the `tests/driver_shtcx` folder. Temperature and humidity values should be printed in the terminal every 2s
|
||||
|
@ -1,6 +1,7 @@
|
||||
# this file enables modules defined in Kconfig. Do not use this file for
|
||||
# application configuration. This is only needed during migration.
|
||||
CONFIG_MODULE_FMT=y
|
||||
CONFIG_MODULE_SHTCX=y
|
||||
CONFIG_MODULE_SHTC1=y
|
||||
CONFIG_MODULE_ZTIMER=y
|
||||
CONFIG_MODULE_ZTIMER_MSEC=y
|
||||
|
@ -10,7 +10,7 @@
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief Test application for the SHTC1 temperature and humidity sensor
|
||||
* @brief Test application for the SHTCX temperature and humidity sensor
|
||||
*
|
||||
* @author Steffen Robertz <steffen.robertz@rwth-aachen.de>
|
||||
* @author Josua Arndt <jarndt@ias.rwth-aachen.de>
|
||||
@ -24,12 +24,12 @@
|
||||
#include "timex.h"
|
||||
#include "ztimer.h"
|
||||
#include "fmt.h"
|
||||
#include "shtc1.h"
|
||||
#include "shtc1_params.h"
|
||||
#include "shtcx.h"
|
||||
#include "shtcx_params.h"
|
||||
|
||||
int main(void)
|
||||
{
|
||||
shtc1_t dev;
|
||||
shtcx_t dev;
|
||||
int16_t temp;
|
||||
uint16_t hum;
|
||||
|
||||
@ -37,15 +37,15 @@ int main(void)
|
||||
char str_hum[8];
|
||||
size_t len;
|
||||
|
||||
puts("SHTC1 test application\n");
|
||||
puts("SHTCX test application\n");
|
||||
|
||||
if ((shtc1_init(&dev, &shtc1_params[0])) != SHTC1_OK) {
|
||||
if ((shtcx_init(&dev, &shtcx_params[0])) != SHTCX_OK) {
|
||||
puts("can't initialize the sensor");
|
||||
return -1;
|
||||
}
|
||||
puts("SHTC1 initialized\n");
|
||||
puts("SHTCX initialized\n");
|
||||
while (1) {
|
||||
if (shtc1_read(&dev, &hum, &temp) == SHTC1_OK) {
|
||||
if (shtcx_read(&dev, &hum, &temp) == SHTCX_OK) {
|
||||
len = fmt_s16_dfp(str_temp, temp, -2);
|
||||
str_temp[len] = '\0';
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user