From c34127e754d4cf71e04e09cc0290b6ef28f4ded5 Mon Sep 17 00:00:00 2001 From: Glenn Ruben Bakke Date: Tue, 3 Jan 2017 21:17:37 +0100 Subject: [PATCH] nrf5/hal: Fixing bug in mp_hal_pin_read in mphalport.h which tried to read an OUT register. Corrected to read the IN register. --- nrf5/mphalport.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nrf5/mphalport.h b/nrf5/mphalport.h index 23e39a0997..ce8f991e5c 100644 --- a/nrf5/mphalport.h +++ b/nrf5/mphalport.h @@ -125,7 +125,7 @@ void mp_hal_stdout_tx_str(const char *str); #define mp_hal_pin_obj_t const pin_obj_t* #define mp_hal_pin_high(p) (((NRF_GPIO_Type *)((p)->gpio))->OUTSET = (p)->pin_mask) #define mp_hal_pin_low(p) (((NRF_GPIO_Type *)((p)->gpio))->OUTCLR = (p)->pin_mask) -#define mp_hal_pin_read(p) (((NRF_GPIO_Type *)((p)->gpio))->OUT >> ((p)->pin) & 1) +#define mp_hal_pin_read(p) (((NRF_GPIO_Type *)((p)->gpio))->IN >> ((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) // TODO: empty implementation for now. Used by machine_spi.c:69