From ceeb787a6fd1174b6e7764b4fd4bbc8b4105410c Mon Sep 17 00:00:00 2001 From: Marian Buschsieweke Date: Tue, 22 Oct 2024 21:50:00 +0200 Subject: [PATCH] drivers: no need to convert gpio_read() to bool We just changed the API so that it returns bool anyway. --- drivers/dht/dht.c | 2 +- drivers/epd_bw_spi/epd_bw_spi.c | 4 ++-- drivers/lm75/lm75.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/dht/dht.c b/drivers/dht/dht.c index 437e7ae4c0..cd57be636b 100644 --- a/drivers/dht/dht.c +++ b/drivers/dht/dht.c @@ -74,7 +74,7 @@ static void _wait_for_level(gpio_t pin, bool expected, uint32_t start) /* Calls to ztimer_now() can be relatively slow on low end platforms. * Mixing in a busy down-counting loop solves issues e.g. on AVR boards. */ uint8_t pre_timeout = 0; - while (((bool)gpio_read(pin) != expected) && (++pre_timeout + while ((gpio_read(pin) != expected) && (++pre_timeout || ztimer_now(ZTIMER_USEC) < start + SPIN_TIMEOUT)) {} } diff --git a/drivers/epd_bw_spi/epd_bw_spi.c b/drivers/epd_bw_spi/epd_bw_spi.c index d5ff4bb371..c343a2d421 100644 --- a/drivers/epd_bw_spi/epd_bw_spi.c +++ b/drivers/epd_bw_spi/epd_bw_spi.c @@ -30,7 +30,7 @@ static void epd_bw_spi_cmd_start(epd_bw_spi_params_t *p, uint8_t cmd, bool cont) { DEBUG("[epd_bw_spi] cmd_start: command 0x%02x\n", cmd); if (gpio_is_valid(p->busy_pin)) { - while ((bool)gpio_read(p->busy_pin) == p->busy_value) {} + while (gpio_read(p->busy_pin) == p->busy_value) {} } gpio_clear(p->dc_pin); spi_transfer_byte(p->spi, p->cs_pin, cont, (uint8_t)cmd); @@ -52,7 +52,7 @@ static void epd_bw_spi_wait(epd_bw_spi_params_t *p, uint32_t msec) { if (gpio_is_valid(p->busy_pin)) { DEBUG("[epd_bw_spi] wait: for busy bin\n"); - while ((bool)gpio_read(p->busy_pin) == p->busy_value) {} + while (gpio_read(p->busy_pin) == p->busy_value) {} } else { DEBUG("[epd_bw_spi] wait: for %" PRIu32 " milliseconds\n", msec); diff --git a/drivers/lm75/lm75.c b/drivers/lm75/lm75.c index 8a78251fe7..85e774cf3b 100644 --- a/drivers/lm75/lm75.c +++ b/drivers/lm75/lm75.c @@ -244,7 +244,7 @@ int lm75_get_os_pin(lm75_t *dev, bool *os_pin_state) { return LM75_ERROR; } - *os_pin_state = !!gpio_read(dev->lm75_params.gpio_alarm) == dev->lm75_params.polarity; + *os_pin_state = gpio_read(dev->lm75_params.gpio_alarm) == dev->lm75_params.polarity; return LM75_SUCCESS; }