mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
drivers: si70xx: bugfixes + test improvements
This commit is contained in:
parent
df574d6f2d
commit
cf5e4c8fb6
@ -84,7 +84,7 @@ int si70xx_init(si70xx_t *dev, i2c_t i2c_dev, uint8_t address)
|
||||
uint16_t si70xx_get_relative_humidity(si70xx_t *dev)
|
||||
{
|
||||
uint32_t raw;
|
||||
uint16_t humidity;
|
||||
int32_t humidity;
|
||||
|
||||
/* perform measurement */
|
||||
raw = si70xx_measure(dev, SI70XX_MEASURE_RH_HOLD);
|
||||
@ -99,7 +99,7 @@ uint16_t si70xx_get_relative_humidity(si70xx_t *dev)
|
||||
return 10000;
|
||||
}
|
||||
else {
|
||||
return humidity;
|
||||
return (uint16_t) humidity;
|
||||
}
|
||||
}
|
||||
|
||||
@ -129,8 +129,8 @@ void si70xx_get_both(si70xx_t *dev, uint16_t *humidity, int16_t *temperature)
|
||||
uint64_t si70xx_get_serial(si70xx_t *dev)
|
||||
{
|
||||
uint8_t out[2];
|
||||
uint8_t in_first[8];
|
||||
uint8_t in_second[8];
|
||||
uint8_t in_first[8] = { 0 };
|
||||
uint8_t in_second[8] = { 0 };
|
||||
|
||||
/* read the lower bytes */
|
||||
out[0] = SI70XX_READ_ID_FIRST_A;
|
||||
@ -165,7 +165,7 @@ uint8_t si70xx_get_id(si70xx_t *dev)
|
||||
uint8_t si70xx_get_revision(si70xx_t *dev)
|
||||
{
|
||||
uint8_t out[2];
|
||||
uint8_t in;
|
||||
uint8_t in = 0;
|
||||
|
||||
/* read the revision number */
|
||||
out[0] = SI70XX_READ_REVISION_A;
|
||||
|
@ -9,8 +9,8 @@ USEMODULE += xtimer
|
||||
|
||||
# set default device parameters in case they are undefined
|
||||
TEST_I2C ?= 0
|
||||
TEST_I2C_ADDR ?= 128
|
||||
TEST_PIN_EN ?= 57
|
||||
TEST_I2C_ADDR ?= 0x80
|
||||
TEST_PIN_EN ?= GPIO_PIN\(0,0\)
|
||||
|
||||
# export parameters
|
||||
CFLAGS += -DTEST_I2C=$(TEST_I2C)
|
||||
|
@ -103,8 +103,8 @@ int main(void)
|
||||
both = !both;
|
||||
|
||||
/* display results */
|
||||
printf("relative humidity: %d.%d\n", humidity / 100, humidity % 100);
|
||||
printf("temperature: %d.%d C\n", temperature / 100, temperature % 100);
|
||||
printf("relative humidity: %d.%02d\n", humidity / 100, humidity % 100);
|
||||
printf("temperature: %d.%02d C\n", temperature / 100, temperature % 100);
|
||||
|
||||
/* sleep between measurements */
|
||||
xtimer_usleep(1000 * MS_IN_USEC);
|
||||
|
Loading…
Reference in New Issue
Block a user