@@ -149,6 +149,14 @@ extern "C" {
149
149
#define NRF_GPIO_HAS_RETENTION 0
150
150
#endif
151
151
152
+ #if (defined(GPIO_RETAINSET_ResetValue ) && defined(GPIO_RETAINCLR_ResetValue )) || \
153
+ defined(__NRFX_DOXYGEN__ )
154
+ /** @brief Presence of register retention set/clear. */
155
+ #define NRF_GPIO_HAS_RETENTION_SETCLEAR 1
156
+ #else
157
+ #define NRF_GPIO_HAS_RETENTION_SETCLEAR 0
158
+ #endif
159
+
152
160
#if defined(GPIO_DETECTMODE_DETECTMODE_Msk ) || defined(__NRFX_DOXYGEN__ )
153
161
/** @brief Presence of detect mode. */
154
162
#define NRF_GPIO_HAS_DETECT_MODE 1
@@ -750,6 +758,25 @@ NRF_STATIC_INLINE void nrf_gpio_port_retain_set(NRF_GPIO_Type * p_reg, uint32_t
750
758
NRF_STATIC_INLINE uint32_t nrf_gpio_port_retain_get (NRF_GPIO_Type const * p_reg );
751
759
#endif
752
760
761
+ #if NRF_GPIO_HAS_RETENTION_SETCLEAR
762
+ /**
763
+ * @brief Function for enabling the retention of the registers.
764
+ *
765
+ * @param p_reg Pointer to the structure of registers of the peripheral.
766
+ * @param mask Mask of pins to have retention enabled, created using @ref nrf_gpio_retain_mask_t.
767
+ */
768
+ NRF_STATIC_INLINE void nrf_gpio_port_retain_enable (NRF_GPIO_Type * p_reg , uint32_t mask );
769
+
770
+ /**
771
+ * @brief Function for disabling the retention of the registers.
772
+ *
773
+ * @param p_reg Pointer to the structure of registers of the peripheral.
774
+ * @param mask Mask of pins to have retention be disabled, created using @ref nrf_gpio_retain_mask_t.
775
+ */
776
+ NRF_STATIC_INLINE void nrf_gpio_port_retain_disable (NRF_GPIO_Type * p_reg , uint32_t mask );
777
+ #endif
778
+
779
+
753
780
#if NRF_GPIO_HAS_DETECT_MODE
754
781
/**
755
782
* @brief Function for setting the latched detect behaviour.
@@ -1319,6 +1346,18 @@ NRF_STATIC_INLINE uint32_t nrf_gpio_port_retain_get(NRF_GPIO_Type const * p_reg)
1319
1346
}
1320
1347
#endif
1321
1348
1349
+ #if NRF_GPIO_HAS_RETENTION_SETCLEAR
1350
+ NRF_STATIC_INLINE void nrf_gpio_port_retain_enable (NRF_GPIO_Type * p_reg , uint32_t mask )
1351
+ {
1352
+ p_reg -> RETAINSET = mask ;
1353
+ }
1354
+
1355
+ NRF_STATIC_INLINE void nrf_gpio_port_retain_disable (NRF_GPIO_Type * p_reg , uint32_t mask )
1356
+ {
1357
+ p_reg -> RETAINCLR = mask ;
1358
+ }
1359
+ #endif
1360
+
1322
1361
#if NRF_GPIO_HAS_DETECT_MODE
1323
1362
NRF_STATIC_INLINE void nrf_gpio_port_detect_latch_set (NRF_GPIO_Type * p_reg , bool enable )
1324
1363
{
0 commit comments