Skip to content

Commit

Permalink
Merge pull request RIOT-OS#5240 from basilfx/feature/si70xx_improvements
Browse files Browse the repository at this point in the history
drivers: si70xx: result bugfixes
  • Loading branch information
OlegHahm committed Apr 13, 2016
2 parents df574d6 + cf5e4c8 commit 5269017
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions drivers/si70xx/si70xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -99,7 +99,7 @@ uint16_t si70xx_get_relative_humidity(si70xx_t *dev)
return 10000;
}
else {
return humidity;
return (uint16_t) humidity;
}
}

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions tests/driver_si70xx/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions tests/driver_si70xx/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 5269017

Please sign in to comment.