diff options
| author | Memiks | 2020-01-08 09:38:20 +0900 |
|---|---|---|
| committer | Damien George | 2020-01-14 23:48:42 +1100 |
| commit | 4ab4bf3ec6e891a49a827b659d5d4764a40ee404 (patch) | |
| tree | ed84775e1b3cf7c53b4cc288e85376ce5151e499 /ports/teensy/teensy_hal.h | |
| parent | 3448e69c2d6f6f066907005f56bbd26fffb756e9 (diff) | |
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.
Diffstat (limited to 'ports/teensy/teensy_hal.h')
| -rw-r--r-- | ports/teensy/teensy_hal.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/ports/teensy/teensy_hal.h b/ports/teensy/teensy_hal.h index aef38a2ad..f2e66821d 100644 --- a/ports/teensy/teensy_hal.h +++ b/ports/teensy/teensy_hal.h @@ -125,4 +125,4 @@ struct _pin_obj_t; #define mp_hal_pin_high(p) (((p)->gpio->PSOR) = (p)->pin_mask) #define mp_hal_pin_low(p) (((p)->gpio->PCOR) = (p)->pin_mask) #define mp_hal_pin_read(p) (((p)->gpio->PDIR >> (p)->pin) & 1) -#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)) |
