1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

drivers: no need to convert gpio_read() to bool

We just changed the API so that it returns bool anyway.
This commit is contained in:
Marian Buschsieweke 2024-10-22 21:50:00 +02:00
parent c2c2cc8592
commit ceeb787a6f
No known key found for this signature in database
GPG Key ID: 758BD52517F79C41
3 changed files with 4 additions and 4 deletions

View File

@ -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. /* 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. */ * Mixing in a busy down-counting loop solves issues e.g. on AVR boards. */
uint8_t pre_timeout = 0; 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)) {} || ztimer_now(ZTIMER_USEC) < start + SPIN_TIMEOUT)) {}
} }

View File

@ -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); DEBUG("[epd_bw_spi] cmd_start: command 0x%02x\n", cmd);
if (gpio_is_valid(p->busy_pin)) { 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); gpio_clear(p->dc_pin);
spi_transfer_byte(p->spi, p->cs_pin, cont, (uint8_t)cmd); 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)) { if (gpio_is_valid(p->busy_pin)) {
DEBUG("[epd_bw_spi] wait: for busy bin\n"); 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 { else {
DEBUG("[epd_bw_spi] wait: for %" PRIu32 " milliseconds\n", msec); DEBUG("[epd_bw_spi] wait: for %" PRIu32 " milliseconds\n", msec);

View File

@ -244,7 +244,7 @@ int lm75_get_os_pin(lm75_t *dev, bool *os_pin_state) {
return LM75_ERROR; 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; return LM75_SUCCESS;
} }