ports: Modify mp_hal_pin_write macro so it can be used as a function.

Even though it doesn't return anything it could still be used like a
function.  Addresses issue #5501.
This commit is contained in:
Memiks
2020-01-08 09:38:20 +09:00
committed by Damien George
parent 3448e69c2d
commit 4ab4bf3ec6
4 changed files with 4 additions and 4 deletions

View File

@@ -65,7 +65,7 @@ const char * nrfx_error_code_lookup(uint32_t err_code);
#define mp_hal_pin_high(p) nrf_gpio_pin_set(p->pin)
#define mp_hal_pin_low(p) nrf_gpio_pin_clear(p->pin)
#define mp_hal_pin_read(p) (nrf_gpio_pin_dir_get(p->pin) == NRF_GPIO_PIN_DIR_OUTPUT) ? nrf_gpio_pin_out_read(p->pin) : nrf_gpio_pin_read(p->pin)
#define mp_hal_pin_write(p, v) do { if (v) { mp_hal_pin_high(p); } else { mp_hal_pin_low(p); } } while (0)
#define mp_hal_pin_write(p, v) ((v) ? mp_hal_pin_high(p) : mp_hal_pin_low(p))
#define mp_hal_pin_od_low(p) mp_hal_pin_low(p)
#define mp_hal_pin_od_high(p) mp_hal_pin_high(p)
#define mp_hal_pin_open_drain(p) nrf_gpio_cfg_input(p->pin, NRF_GPIO_PIN_NOPULL)