You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by an...@apache.org on 2019/06/03 09:13:29 UTC

[mynewt-core] branch master updated: hw/mcu/nordic: Remove duplicated GPIO mapping macros

This is an automated email from the ASF dual-hosted git repository.

andk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git


The following commit(s) were added to refs/heads/master by this push:
     new 63dfc83  hw/mcu/nordic: Remove duplicated GPIO mapping macros
63dfc83 is described below

commit 63dfc83ba2c1662818e8f0198e2d584d0709febb
Author: Andrzej Kaczmarek <an...@codecoup.pl>
AuthorDate: Mon Jun 3 10:26:16 2019 +0200

    hw/mcu/nordic: Remove duplicated GPIO mapping macros
---
 hw/mcu/nordic/nrf52xxx/include/mcu/nrf52_hal.h | 16 +-------------
 hw/mcu/nordic/nrf52xxx/src/hal_gpio.c          | 29 --------------------------
 2 files changed, 1 insertion(+), 44 deletions(-)

diff --git a/hw/mcu/nordic/nrf52xxx/include/mcu/nrf52_hal.h b/hw/mcu/nordic/nrf52xxx/include/mcu/nrf52_hal.h
index f566024..64b5fe0 100644
--- a/hw/mcu/nordic/nrf52xxx/include/mcu/nrf52_hal.h
+++ b/hw/mcu/nordic/nrf52xxx/include/mcu/nrf52_hal.h
@@ -78,21 +78,7 @@ struct nrf52_hal_spi_cfg {
  *  user specifies a pin that is not used by the processor. If an invalid pin
  *  number is used unexpected and/or erroneous behavior will result.
  */
-#ifdef NRF52
-#define HAL_GPIO_INDEX(pin)     (pin)
-#define HAL_GPIO_PORT(pin)      (NRF_P0)
-#define HAL_GPIO_MASK(pin)      (1 << pin)
-#define HAL_GPIOTE_PIN_MASK     GPIOTE_CONFIG_PSEL_Msk
-#endif
-
-#ifdef NRF52810_XXAA
-#define HAL_GPIO_INDEX(pin)     (pin)
-#define HAL_GPIO_PORT(pin)      (NRF_P0)
-#define HAL_GPIO_MASK(pin)      (1 << pin)
-#define HAL_GPIOTE_PIN_MASK     GPIOTE_CONFIG_PSEL_Msk
-#endif
-
-#ifdef NRF52811_XXAA
+#if defined(NRF52832_XXAA) || defined(NRF52810_XXAA) || defined(NRF52811_XXAA)
 #define HAL_GPIO_INDEX(pin)     (pin)
 #define HAL_GPIO_PORT(pin)      (NRF_P0)
 #define HAL_GPIO_MASK(pin)      (1 << pin)
diff --git a/hw/mcu/nordic/nrf52xxx/src/hal_gpio.c b/hw/mcu/nordic/nrf52xxx/src/hal_gpio.c
index 57d31f1..1831a9d 100644
--- a/hw/mcu/nordic/nrf52xxx/src/hal_gpio.c
+++ b/hw/mcu/nordic/nrf52xxx/src/hal_gpio.c
@@ -32,35 +32,6 @@
  *
  */
 
-/*
- * GPIO pin mapping
- *
- * The logical GPIO pin numbers (0 to N) are mapped to ports in the following
- * manner:
- *  pins 0 - 31: Port 0
- *  pins 32 - 48: Port 1.
- *
- *  The nrf52832 has only one port with 32 pins. The nrf52840 has 48 pins and
- *  uses two ports.
- *
- *  NOTE: in order to save code space, there is no checking done to see if the
- *  user specifies a pin that is not used by the processor. If an invalid pin
- *  number is used unexpected and/or erroneous behavior will result.
- */
-#if defined(NRF52832_XXAA) || defined(NRF52810_XXAA) || defined(NRF52811_XXAA)
-#define HAL_GPIO_INDEX(pin)     (pin)
-#define HAL_GPIO_PORT(pin)      (NRF_P0)
-#define HAL_GPIO_MASK(pin)      (1 << pin)
-#define HAL_GPIOTE_PIN_MASK     GPIOTE_CONFIG_PSEL_Msk
-#endif
-
-#ifdef NRF52840_XXAA
-#define HAL_GPIO_INDEX(pin)     ((pin) & 0x1F)
-#define HAL_GPIO_PORT(pin)      ((pin) > 31 ? NRF_P1 : NRF_P0)
-#define HAL_GPIO_MASK(pin)      (1 << HAL_GPIO_INDEX(pin))
-#define HAL_GPIOTE_PIN_MASK     (0x3FUL << GPIOTE_CONFIG_PSEL_Pos)
-#endif
-
 /* GPIO interrupts */
 #define HAL_GPIO_MAX_IRQ        8