aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal
diff options
context:
space:
mode:
authorStephane D'Alu <sdalu@sdalu.com>2016-07-08 21:12:12 +0200
committerStephane D'Alu <sdalu@sdalu.com>2016-07-08 21:12:12 +0200
commitf78e2ae7d49d47f848e427002dd4385579149493 (patch)
tree0c4a44ccf61748da302488ad427ce1fdacf7934c /os/hal
parent8306aabdfc13302edfa81c55a774ed7daefdc9c4 (diff)
downloadChibiOS-Contrib-f78e2ae7d49d47f848e427002dd4385579149493.tar.gz
ChibiOS-Contrib-f78e2ae7d49d47f848e427002dd4385579149493.tar.bz2
ChibiOS-Contrib-f78e2ae7d49d47f848e427002dd4385579149493.zip
use IOPORT1 instead of NRF_GPIO
Diffstat (limited to 'os/hal')
-rw-r--r--os/hal/ports/NRF5/NRF51822/hal_pal_lld.c12
-rw-r--r--os/hal/ports/NRF5/NRF51822/hal_pal_lld.h26
2 files changed, 19 insertions, 19 deletions
diff --git a/os/hal/ports/NRF5/NRF51822/hal_pal_lld.c b/os/hal/ports/NRF5/NRF51822/hal_pal_lld.c
index 69fc9fe..7bbeb49 100644
--- a/os/hal/ports/NRF5/NRF51822/hal_pal_lld.c
+++ b/os/hal/ports/NRF5/NRF51822/hal_pal_lld.c
@@ -51,7 +51,7 @@ void _pal_lld_setpadmode(ioportid_t port, uint8_t pad, iomode_t mode)
switch (mode) {
case PAL_MODE_RESET:
case PAL_MODE_UNCONNECTED:
- NRF_GPIO->PIN_CNF[pad] =
+ IOPORT1->PIN_CNF[pad] =
(GPIO_PIN_CNF_SENSE_Disabled << GPIO_PIN_CNF_SENSE_Pos) |
(GPIO_PIN_CNF_DRIVE_S0S1 << GPIO_PIN_CNF_DRIVE_Pos) |
(GPIO_PIN_CNF_PULL_Disabled << GPIO_PIN_CNF_PULL_Pos) |
@@ -60,7 +60,7 @@ void _pal_lld_setpadmode(ioportid_t port, uint8_t pad, iomode_t mode)
break;
case PAL_MODE_INPUT:
case PAL_MODE_INPUT_ANALOG:
- NRF_GPIO->PIN_CNF[pad] =
+ IOPORT1->PIN_CNF[pad] =
(GPIO_PIN_CNF_SENSE_Disabled << GPIO_PIN_CNF_SENSE_Pos) |
(GPIO_PIN_CNF_DRIVE_S0S1 << GPIO_PIN_CNF_DRIVE_Pos) |
(GPIO_PIN_CNF_PULL_Disabled << GPIO_PIN_CNF_PULL_Pos) |
@@ -68,7 +68,7 @@ void _pal_lld_setpadmode(ioportid_t port, uint8_t pad, iomode_t mode)
(GPIO_PIN_CNF_DIR_Input << GPIO_PIN_CNF_DIR_Pos);
break;
case PAL_MODE_INPUT_PULLUP:
- NRF_GPIO->PIN_CNF[pad] =
+ IOPORT1->PIN_CNF[pad] =
(GPIO_PIN_CNF_SENSE_Disabled << GPIO_PIN_CNF_SENSE_Pos) |
(GPIO_PIN_CNF_DRIVE_S0S1 << GPIO_PIN_CNF_DRIVE_Pos) |
(GPIO_PIN_CNF_PULL_Pullup << GPIO_PIN_CNF_PULL_Pos) |
@@ -76,7 +76,7 @@ void _pal_lld_setpadmode(ioportid_t port, uint8_t pad, iomode_t mode)
(GPIO_PIN_CNF_DIR_Input << GPIO_PIN_CNF_DIR_Pos);
break;
case PAL_MODE_INPUT_PULLDOWN:
- NRF_GPIO->PIN_CNF[pad] =
+ IOPORT1->PIN_CNF[pad] =
(GPIO_PIN_CNF_SENSE_Disabled << GPIO_PIN_CNF_SENSE_Pos) |
(GPIO_PIN_CNF_DRIVE_S0S1 << GPIO_PIN_CNF_DRIVE_Pos) |
(GPIO_PIN_CNF_PULL_Pulldown << GPIO_PIN_CNF_PULL_Pos) |
@@ -84,7 +84,7 @@ void _pal_lld_setpadmode(ioportid_t port, uint8_t pad, iomode_t mode)
(GPIO_PIN_CNF_DIR_Input << GPIO_PIN_CNF_DIR_Pos);
break;
case PAL_MODE_OUTPUT_PUSHPULL:
- NRF_GPIO->PIN_CNF[pad] =
+ IOPORT1->PIN_CNF[pad] =
(GPIO_PIN_CNF_SENSE_Disabled << GPIO_PIN_CNF_SENSE_Pos) |
(GPIO_PIN_CNF_DRIVE_S0S1 << GPIO_PIN_CNF_DRIVE_Pos) |
(GPIO_PIN_CNF_PULL_Disabled << GPIO_PIN_CNF_PULL_Pos) |
@@ -92,7 +92,7 @@ void _pal_lld_setpadmode(ioportid_t port, uint8_t pad, iomode_t mode)
(GPIO_PIN_CNF_DIR_Output << GPIO_PIN_CNF_DIR_Pos);
break;
case PAL_MODE_OUTPUT_OPENDRAIN:
- NRF_GPIO->PIN_CNF[pad] =
+ IOPORT1->PIN_CNF[pad] =
(GPIO_PIN_CNF_SENSE_Disabled << GPIO_PIN_CNF_SENSE_Pos) |
(GPIO_PIN_CNF_DRIVE_S0D1 << GPIO_PIN_CNF_DRIVE_Pos) |
(GPIO_PIN_CNF_PULL_Disabled << GPIO_PIN_CNF_PULL_Pos) |
diff --git a/os/hal/ports/NRF5/NRF51822/hal_pal_lld.h b/os/hal/ports/NRF5/NRF51822/hal_pal_lld.h
index 5032916..a48e8a7 100644
--- a/os/hal/ports/NRF5/NRF51822/hal_pal_lld.h
+++ b/os/hal/ports/NRF5/NRF51822/hal_pal_lld.h
@@ -152,7 +152,7 @@ typedef NRF_GPIO_Type *ioportid_t;
*
* @notapi
*/
-#define pal_lld_readport(port) (NRF_GPIO->IN)
+#define pal_lld_readport(port) (IOPORT1->IN)
/**
* @brief Reads the output latch.
@@ -164,7 +164,7 @@ typedef NRF_GPIO_Type *ioportid_t;
*
* @notapi
*/
-#define pal_lld_readlatch(port) (NRF_GPIO->OUT)
+#define pal_lld_readlatch(port) (IOPORT1->OUT)
/**
* @brief Writes a bits mask on a I/O port.
@@ -174,7 +174,7 @@ typedef NRF_GPIO_Type *ioportid_t;
*
* @notapi
*/
-#define pal_lld_writeport(port, bits) (NRF_GPIO->OUT = (bits))
+#define pal_lld_writeport(port, bits) (IOPORT1->OUT = (bits))
/**
* @brief Sets a bits mask on a I/O port.
@@ -187,7 +187,7 @@ typedef NRF_GPIO_Type *ioportid_t;
*
* @notapi
*/
-#define pal_lld_setport(port, bits) (NRF_GPIO->OUTSET = (bits))
+#define pal_lld_setport(port, bits) (IOPORT1->OUTSET = (bits))
/**
@@ -201,7 +201,7 @@ typedef NRF_GPIO_Type *ioportid_t;
*
* @notapi
*/
-#define pal_lld_clearport(port, bits) (NRF_GPIO->OUTCLR = (bits))
+#define pal_lld_clearport(port, bits) (IOPORT1->OUTCLR = (bits))
/**
* @brief Pads group mode setup.
@@ -234,7 +234,7 @@ typedef NRF_GPIO_Type *ioportid_t;
* @notapi
*/
#define pal_lld_readpad(port, pad) \
- ((NRF_GPIO->IN & ((uint32_t) 1 << pad)) ? PAL_HIGH : PAL_LOW)
+ ((IOPORT1->IN & ((uint32_t) 1 << pad)) ? PAL_HIGH : PAL_LOW)
/**
* @brief Writes a logical state on an output pad.
@@ -255,9 +255,9 @@ typedef NRF_GPIO_Type *ioportid_t;
do { \
(void)port; \
if (bit == PAL_HIGH) \
- NRF_GPIO->OUTSET = ((uint32_t) 1 << pad); \
+ IOPORT1->OUTSET = ((uint32_t) 1 << pad); \
else \
- NRF_GPIO->OUTCLR = ((uint32_t) 1 << pad); \
+ IOPORT1->OUTCLR = ((uint32_t) 1 << pad); \
} while (false)
/**
@@ -271,7 +271,7 @@ typedef NRF_GPIO_Type *ioportid_t;
*
* @notapi
*/
-#define pal_lld_setpad(port, pad) (NRF_GPIO->OUTSET = (uint32_t) 1 << (pad))
+#define pal_lld_setpad(port, pad) (IOPORT1->OUTSET = (uint32_t) 1 << (pad))
/**
* @brief Clears a pad logical state to @p PAL_LOW.
@@ -284,7 +284,7 @@ typedef NRF_GPIO_Type *ioportid_t;
*
* @notapi
*/
-#define pal_lld_clearpad(port, pad) (NRF_GPIO->OUTCLR = (uint32_t) 1 << (pad))
+#define pal_lld_clearpad(port, pad) (IOPORT1->OUTCLR = (uint32_t) 1 << (pad))
/**
* @brief Toggles a pad logical state.
@@ -299,11 +299,11 @@ typedef NRF_GPIO_Type *ioportid_t;
*/
#define pal_lld_togglepad(port, pad) \
do { \
- uint8_t bit = (NRF_GPIO->IN >> (pad)) & 1; \
+ uint8_t bit = (IOPORT1->IN >> (pad)) & 1; \
if (bit) \
- NRF_GPIO->OUTCLR = 1 << (pad); \
+ IOPORT1->OUTCLR = 1 << (pad); \
else \
- NRF_GPIO->OUTSET = 1 << (pad); \
+ IOPORT1->OUTSET = 1 << (pad); \
} while (0)
/**