You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by cc...@apache.org on 2016/11/10 19:32:22 UTC

[13/19] incubator-mynewt-core git commit: MYNEWT-390: NRF hal_gpio_read does not return 1 when pin high

MYNEWT-390: NRF hal_gpio_read does not return 1 when pin high

This API is supposed to return 1 but was returning 1 << pin. This
has now been fixed so if the pin is high, 1 is returned.


Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/ee3cd755
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/ee3cd755
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/ee3cd755

Branch: refs/heads/develop
Commit: ee3cd755b8a96c93af1580fd0b2270355ad037d9
Parents: 0ec0bc4
Author: William San Filippo <wi...@runtime.io>
Authored: Wed Sep 21 21:53:07 2016 -0700
Committer: William San Filippo <wi...@runtime.io>
Committed: Wed Sep 21 21:55:06 2016 -0700

----------------------------------------------------------------------
 hw/mcu/nordic/nrf51xxx/src/hal_gpio.c | 2 +-
 hw/mcu/nordic/nrf52xxx/src/hal_gpio.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/ee3cd755/hw/mcu/nordic/nrf51xxx/src/hal_gpio.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/nrf51xxx/src/hal_gpio.c b/hw/mcu/nordic/nrf51xxx/src/hal_gpio.c
index bd8414a..dfbe9f7 100644
--- a/hw/mcu/nordic/nrf51xxx/src/hal_gpio.c
+++ b/hw/mcu/nordic/nrf51xxx/src/hal_gpio.c
@@ -414,7 +414,7 @@ void hal_gpio_write(int pin, int val)
  */
 int hal_gpio_read(int pin)
 {
-    return (NRF_GPIO->IN & GPIO_MASK(pin));
+    return ((NRF_GPIO->IN & GPIO_MASK(pin)) != 0);
 }
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/ee3cd755/hw/mcu/nordic/nrf52xxx/src/hal_gpio.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/nrf52xxx/src/hal_gpio.c b/hw/mcu/nordic/nrf52xxx/src/hal_gpio.c
index 490b8a3..0fbb5a3 100644
--- a/hw/mcu/nordic/nrf52xxx/src/hal_gpio.c
+++ b/hw/mcu/nordic/nrf52xxx/src/hal_gpio.c
@@ -160,7 +160,7 @@ void hal_gpio_write(int pin, int val)
  */
 int hal_gpio_read(int pin)
 {
-    return (NRF_P0->IN & HAL_GPIO_MASK(pin));
+    return ((NRF_P0->IN & HAL_GPIO_MASK(pin)) != 0);
 }
 
 /**