Skip to content
Snippets Groups Projects
Unverified Commit 64da21fa authored by Sebastian Meiling's avatar Sebastian Meiling Committed by GitHub
Browse files

Merge pull request #8640 from aabadie/pr/drivers/hts221_fixes

drivers/hts221: minor fixes
parents 21a792dd 6ea16d7d
No related branches found
No related tags found
No related merge requests found
...@@ -94,7 +94,7 @@ int hts221_init(hts221_t *dev, const hts221_params_t *params); ...@@ -94,7 +94,7 @@ int hts221_init(hts221_t *dev, const hts221_params_t *params);
int hts221_reboot(const hts221_t *dev); int hts221_reboot(const hts221_t *dev);
/** /**
* @brief Set device to continues measurements * @brief Set device to one shot measurement
* *
* @param[in] dev device descriptor of sensor * @param[in] dev device descriptor of sensor
* *
...@@ -103,10 +103,10 @@ int hts221_reboot(const hts221_t *dev); ...@@ -103,10 +103,10 @@ int hts221_reboot(const hts221_t *dev);
int hts221_one_shot(const hts221_t *dev); int hts221_one_shot(const hts221_t *dev);
/** /**
* @brief Set device to continues measurements * @brief Set device to continuous measurements
* *
* @param[in] dev device descriptor of sensor * @param[in] dev device descriptor of sensor
* @param[in] rate conversion rate for continues mode * @param[in] rate conversion rate for continuous mode
* *
* @return 0 on success, or error otherwise * @return 0 on success, or error otherwise
*/ */
......
...@@ -47,17 +47,17 @@ int main(void) ...@@ -47,17 +47,17 @@ int main(void)
uint16_t hum = 0; uint16_t hum = 0;
int16_t temp = 0; int16_t temp = 0;
if (hts221_read_humidity(&dev, &hum) != HTS221_OK) { if (hts221_read_humidity(&dev, &hum) != HTS221_OK) {
puts(" -- failed to humidity!"); puts(" -- failed to read humidity!");
} }
if (hts221_read_temperature(&dev, &temp) != HTS221_OK) { if (hts221_read_temperature(&dev, &temp) != HTS221_OK) {
puts(" -- failed to temperature!"); puts(" -- failed to read temperature!");
} }
bool negative = (temp < 0); bool negative = (temp < 0);
if (negative) { if (negative) {
temp = -temp; temp = -temp;
} }
printf("H: %u.%u%%, T:%c%u.%u°C\n", (hum/10), (hum%10), printf("H: %u.%u%%, T:%c%u.%u°C\n", (hum / 10), (hum % 10),
(negative ? '-' : ' '), (temp/10), (temp%10)); (negative ? '-' : ' '), (temp / 10), (temp % 10));
xtimer_sleep(SLEEP_S); xtimer_sleep(SLEEP_S);
} }
return 0; return 0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment