The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.
Dependents: hello SerialTestv11 SerialTestv12 Sierpinski ... more
mbed 2
This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.
TARGET_TY51822R3/TOOLCHAIN_IAR/nrf_wdt.h@171:3a7713b1edbc, 2018-11-08 (annotated)
- Committer:
- AnnaBridge
- Date:
- Thu Nov 08 11:45:42 2018 +0000
- Revision:
- 171:3a7713b1edbc
- Parent:
- TARGET_VBLUNO51/TARGET_NORDIC/TARGET_NRF5x/TARGET_SDK_11/drivers_nrf/hal/nrf_wdt.h@169:a7c7b631e539
mbed library. Release version 164
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
AnnaBridge | 143:86740a56073b | 1 | /* |
AnnaBridge | 143:86740a56073b | 2 | * Copyright (c) 2015 Nordic Semiconductor ASA |
AnnaBridge | 143:86740a56073b | 3 | * All rights reserved. |
AnnaBridge | 143:86740a56073b | 4 | * |
AnnaBridge | 143:86740a56073b | 5 | * Redistribution and use in source and binary forms, with or without modification, |
AnnaBridge | 143:86740a56073b | 6 | * are permitted provided that the following conditions are met: |
AnnaBridge | 143:86740a56073b | 7 | * |
AnnaBridge | 143:86740a56073b | 8 | * 1. Redistributions of source code must retain the above copyright notice, this list |
AnnaBridge | 143:86740a56073b | 9 | * of conditions and the following disclaimer. |
AnnaBridge | 143:86740a56073b | 10 | * |
AnnaBridge | 143:86740a56073b | 11 | * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA |
AnnaBridge | 143:86740a56073b | 12 | * integrated circuit in a product or a software update for such product, must reproduce |
AnnaBridge | 143:86740a56073b | 13 | * the above copyright notice, this list of conditions and the following disclaimer in |
AnnaBridge | 143:86740a56073b | 14 | * the documentation and/or other materials provided with the distribution. |
AnnaBridge | 143:86740a56073b | 15 | * |
AnnaBridge | 143:86740a56073b | 16 | * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be |
AnnaBridge | 143:86740a56073b | 17 | * used to endorse or promote products derived from this software without specific prior |
AnnaBridge | 143:86740a56073b | 18 | * written permission. |
AnnaBridge | 143:86740a56073b | 19 | * |
AnnaBridge | 143:86740a56073b | 20 | * 4. This software, with or without modification, must only be used with a |
AnnaBridge | 143:86740a56073b | 21 | * Nordic Semiconductor ASA integrated circuit. |
AnnaBridge | 143:86740a56073b | 22 | * |
AnnaBridge | 143:86740a56073b | 23 | * 5. Any software provided in binary or object form under this license must not be reverse |
AnnaBridge | 143:86740a56073b | 24 | * engineered, decompiled, modified and/or disassembled. |
AnnaBridge | 143:86740a56073b | 25 | * |
AnnaBridge | 143:86740a56073b | 26 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
AnnaBridge | 143:86740a56073b | 27 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
AnnaBridge | 143:86740a56073b | 28 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
AnnaBridge | 143:86740a56073b | 29 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR |
AnnaBridge | 143:86740a56073b | 30 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
AnnaBridge | 143:86740a56073b | 31 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
AnnaBridge | 143:86740a56073b | 32 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON |
AnnaBridge | 143:86740a56073b | 33 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
AnnaBridge | 143:86740a56073b | 34 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
AnnaBridge | 143:86740a56073b | 35 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
AnnaBridge | 143:86740a56073b | 36 | * |
AnnaBridge | 143:86740a56073b | 37 | */ |
AnnaBridge | 143:86740a56073b | 38 | |
AnnaBridge | 143:86740a56073b | 39 | |
AnnaBridge | 143:86740a56073b | 40 | /** |
AnnaBridge | 143:86740a56073b | 41 | * @defgroup nrf_wdt_hal WDT HAL |
AnnaBridge | 143:86740a56073b | 42 | * @{ |
AnnaBridge | 143:86740a56073b | 43 | * @ingroup nrf_wdt |
AnnaBridge | 143:86740a56073b | 44 | * |
AnnaBridge | 143:86740a56073b | 45 | * @brief Hardware access layer for accessing the watchdog timer (WDT) peripheral. |
AnnaBridge | 143:86740a56073b | 46 | */ |
AnnaBridge | 143:86740a56073b | 47 | |
AnnaBridge | 143:86740a56073b | 48 | #ifndef NRF_WDT_H__ |
AnnaBridge | 143:86740a56073b | 49 | #define NRF_WDT_H__ |
AnnaBridge | 143:86740a56073b | 50 | |
AnnaBridge | 143:86740a56073b | 51 | #include <stddef.h> |
AnnaBridge | 143:86740a56073b | 52 | #include <stdbool.h> |
AnnaBridge | 143:86740a56073b | 53 | #include <stdint.h> |
AnnaBridge | 143:86740a56073b | 54 | |
AnnaBridge | 143:86740a56073b | 55 | #include "nrf.h" |
AnnaBridge | 143:86740a56073b | 56 | |
AnnaBridge | 143:86740a56073b | 57 | #define NRF_WDT_CHANNEL_NUMBER 0x8UL |
AnnaBridge | 143:86740a56073b | 58 | #define NRF_WDT_RR_VALUE 0x6E524635UL /* Fixed value, shouldn't be modified.*/ |
AnnaBridge | 143:86740a56073b | 59 | |
AnnaBridge | 143:86740a56073b | 60 | #define NRF_WDT_TASK_SET 1UL |
AnnaBridge | 143:86740a56073b | 61 | #define NRF_WDT_EVENT_CLEAR 0UL |
AnnaBridge | 143:86740a56073b | 62 | |
AnnaBridge | 143:86740a56073b | 63 | /** |
AnnaBridge | 143:86740a56073b | 64 | * @enum nrf_wdt_task_t |
AnnaBridge | 143:86740a56073b | 65 | * @brief WDT tasks. |
AnnaBridge | 143:86740a56073b | 66 | */ |
AnnaBridge | 143:86740a56073b | 67 | typedef enum |
AnnaBridge | 143:86740a56073b | 68 | { |
AnnaBridge | 143:86740a56073b | 69 | /*lint -save -e30 -esym(628,__INTADDR__)*/ |
AnnaBridge | 143:86740a56073b | 70 | NRF_WDT_TASK_START = offsetof(NRF_WDT_Type, TASKS_START), /**< Task for starting WDT. */ |
AnnaBridge | 143:86740a56073b | 71 | /*lint -restore*/ |
AnnaBridge | 143:86740a56073b | 72 | } nrf_wdt_task_t; |
AnnaBridge | 143:86740a56073b | 73 | |
AnnaBridge | 143:86740a56073b | 74 | /** |
AnnaBridge | 143:86740a56073b | 75 | * @enum nrf_wdt_event_t |
AnnaBridge | 143:86740a56073b | 76 | * @brief WDT events. |
AnnaBridge | 143:86740a56073b | 77 | */ |
AnnaBridge | 143:86740a56073b | 78 | typedef enum |
AnnaBridge | 143:86740a56073b | 79 | { |
AnnaBridge | 143:86740a56073b | 80 | /*lint -save -e30*/ |
AnnaBridge | 143:86740a56073b | 81 | NRF_WDT_EVENT_TIMEOUT = offsetof(NRF_WDT_Type, EVENTS_TIMEOUT), /**< Event from WDT time-out. */ |
AnnaBridge | 143:86740a56073b | 82 | /*lint -restore*/ |
AnnaBridge | 143:86740a56073b | 83 | } nrf_wdt_event_t; |
AnnaBridge | 143:86740a56073b | 84 | |
AnnaBridge | 143:86740a56073b | 85 | /** |
AnnaBridge | 143:86740a56073b | 86 | * @enum nrf_wdt_behaviour_t |
AnnaBridge | 143:86740a56073b | 87 | * @brief WDT behavior in CPU SLEEP or HALT mode. |
AnnaBridge | 143:86740a56073b | 88 | */ |
AnnaBridge | 143:86740a56073b | 89 | typedef enum |
AnnaBridge | 143:86740a56073b | 90 | { |
AnnaBridge | 143:86740a56073b | 91 | NRF_WDT_BEHAVIOUR_RUN_SLEEP = WDT_CONFIG_SLEEP_Msk, /**< WDT will run when CPU is in SLEEP mode. */ |
AnnaBridge | 143:86740a56073b | 92 | NRF_WDT_BEHAVIOUR_RUN_HALT = WDT_CONFIG_HALT_Msk, /**< WDT will run when CPU is in HALT mode. */ |
AnnaBridge | 143:86740a56073b | 93 | NRF_WDT_BEHAVIOUR_RUN_SLEEP_HALT = WDT_CONFIG_SLEEP_Msk | WDT_CONFIG_HALT_Msk, /**< WDT will run when CPU is in SLEEP or HALT mode. */ |
AnnaBridge | 143:86740a56073b | 94 | NRF_WDT_BEHAVIOUR_PAUSE_SLEEP_HALT = 0, /**< WDT will be paused when CPU is in SLEEP or HALT mode. */ |
AnnaBridge | 143:86740a56073b | 95 | } nrf_wdt_behaviour_t; |
AnnaBridge | 143:86740a56073b | 96 | |
AnnaBridge | 143:86740a56073b | 97 | /** |
AnnaBridge | 143:86740a56073b | 98 | * @enum nrf_wdt_rr_register_t |
AnnaBridge | 143:86740a56073b | 99 | * @brief WDT reload request registers. |
AnnaBridge | 143:86740a56073b | 100 | */ |
AnnaBridge | 143:86740a56073b | 101 | typedef enum |
AnnaBridge | 143:86740a56073b | 102 | { |
AnnaBridge | 143:86740a56073b | 103 | NRF_WDT_RR0 = 0, /**< Reload request register 0. */ |
AnnaBridge | 143:86740a56073b | 104 | NRF_WDT_RR1, /**< Reload request register 1. */ |
AnnaBridge | 143:86740a56073b | 105 | NRF_WDT_RR2, /**< Reload request register 2. */ |
AnnaBridge | 143:86740a56073b | 106 | NRF_WDT_RR3, /**< Reload request register 3. */ |
AnnaBridge | 143:86740a56073b | 107 | NRF_WDT_RR4, /**< Reload request register 4. */ |
AnnaBridge | 143:86740a56073b | 108 | NRF_WDT_RR5, /**< Reload request register 5. */ |
AnnaBridge | 143:86740a56073b | 109 | NRF_WDT_RR6, /**< Reload request register 6. */ |
AnnaBridge | 143:86740a56073b | 110 | NRF_WDT_RR7 /**< Reload request register 7. */ |
AnnaBridge | 143:86740a56073b | 111 | } nrf_wdt_rr_register_t; |
AnnaBridge | 143:86740a56073b | 112 | |
AnnaBridge | 143:86740a56073b | 113 | /** |
AnnaBridge | 143:86740a56073b | 114 | * @enum nrf_wdt_int_mask_t |
AnnaBridge | 143:86740a56073b | 115 | * @brief WDT interrupts. |
AnnaBridge | 143:86740a56073b | 116 | */ |
AnnaBridge | 143:86740a56073b | 117 | typedef enum |
AnnaBridge | 143:86740a56073b | 118 | { |
AnnaBridge | 143:86740a56073b | 119 | NRF_WDT_INT_TIMEOUT_MASK = WDT_INTENSET_TIMEOUT_Msk, /**< WDT interrupt from time-out event. */ |
AnnaBridge | 143:86740a56073b | 120 | } nrf_wdt_int_mask_t; |
AnnaBridge | 143:86740a56073b | 121 | |
AnnaBridge | 143:86740a56073b | 122 | /** |
AnnaBridge | 143:86740a56073b | 123 | * @brief Function for configuring the watchdog behavior when the CPU is sleeping or halted. |
AnnaBridge | 143:86740a56073b | 124 | * |
AnnaBridge | 143:86740a56073b | 125 | * @param behaviour Watchdog behavior when CPU is in SLEEP or HALT mode. |
AnnaBridge | 143:86740a56073b | 126 | */ |
AnnaBridge | 143:86740a56073b | 127 | __STATIC_INLINE void nrf_wdt_behaviour_set(nrf_wdt_behaviour_t behaviour) |
AnnaBridge | 143:86740a56073b | 128 | { |
AnnaBridge | 143:86740a56073b | 129 | NRF_WDT->CONFIG = behaviour; |
AnnaBridge | 143:86740a56073b | 130 | } |
AnnaBridge | 143:86740a56073b | 131 | |
AnnaBridge | 143:86740a56073b | 132 | |
AnnaBridge | 143:86740a56073b | 133 | /** |
AnnaBridge | 143:86740a56073b | 134 | * @brief Function for starting the watchdog. |
AnnaBridge | 143:86740a56073b | 135 | * |
AnnaBridge | 143:86740a56073b | 136 | * @param[in] task Task. |
AnnaBridge | 143:86740a56073b | 137 | */ |
AnnaBridge | 143:86740a56073b | 138 | __STATIC_INLINE void nrf_wdt_task_trigger(nrf_wdt_task_t task) |
AnnaBridge | 143:86740a56073b | 139 | { |
AnnaBridge | 143:86740a56073b | 140 | *((volatile uint32_t *)((uint8_t *)NRF_WDT + task)) = NRF_WDT_TASK_SET; |
AnnaBridge | 143:86740a56073b | 141 | } |
AnnaBridge | 143:86740a56073b | 142 | |
AnnaBridge | 143:86740a56073b | 143 | |
AnnaBridge | 143:86740a56073b | 144 | /** |
AnnaBridge | 143:86740a56073b | 145 | * @brief Function for clearing the WDT event. |
AnnaBridge | 143:86740a56073b | 146 | * |
AnnaBridge | 143:86740a56073b | 147 | * @param[in] event Event. |
AnnaBridge | 143:86740a56073b | 148 | */ |
AnnaBridge | 143:86740a56073b | 149 | __STATIC_INLINE void nrf_wdt_event_clear(nrf_wdt_event_t event) |
AnnaBridge | 143:86740a56073b | 150 | { |
AnnaBridge | 143:86740a56073b | 151 | *((volatile uint32_t *)((uint8_t *)NRF_WDT + (uint32_t)event)) = NRF_WDT_EVENT_CLEAR; |
AnnaBridge | 143:86740a56073b | 152 | } |
AnnaBridge | 143:86740a56073b | 153 | |
AnnaBridge | 143:86740a56073b | 154 | |
AnnaBridge | 143:86740a56073b | 155 | /** |
AnnaBridge | 143:86740a56073b | 156 | * @brief Function for retrieving the state of the WDT event. |
AnnaBridge | 143:86740a56073b | 157 | * |
AnnaBridge | 143:86740a56073b | 158 | * @param[in] event Event. |
AnnaBridge | 143:86740a56073b | 159 | * |
AnnaBridge | 143:86740a56073b | 160 | * @retval true If the event is set. |
AnnaBridge | 143:86740a56073b | 161 | * @retval false If the event is not set. |
AnnaBridge | 143:86740a56073b | 162 | */ |
AnnaBridge | 143:86740a56073b | 163 | __STATIC_INLINE bool nrf_wdt_event_check(nrf_wdt_event_t event) |
AnnaBridge | 143:86740a56073b | 164 | { |
AnnaBridge | 143:86740a56073b | 165 | return (bool)*((volatile uint32_t *)((uint8_t *)NRF_WDT + event)); |
AnnaBridge | 143:86740a56073b | 166 | } |
AnnaBridge | 143:86740a56073b | 167 | |
AnnaBridge | 143:86740a56073b | 168 | |
AnnaBridge | 143:86740a56073b | 169 | /** |
AnnaBridge | 143:86740a56073b | 170 | * @brief Function for enabling a specific interrupt. |
AnnaBridge | 143:86740a56073b | 171 | * |
AnnaBridge | 143:86740a56073b | 172 | * @param[in] int_mask Interrupt. |
AnnaBridge | 143:86740a56073b | 173 | */ |
AnnaBridge | 143:86740a56073b | 174 | __STATIC_INLINE void nrf_wdt_int_enable(uint32_t int_mask) |
AnnaBridge | 143:86740a56073b | 175 | { |
AnnaBridge | 143:86740a56073b | 176 | NRF_WDT->INTENSET = int_mask; |
AnnaBridge | 143:86740a56073b | 177 | } |
AnnaBridge | 143:86740a56073b | 178 | |
AnnaBridge | 143:86740a56073b | 179 | |
AnnaBridge | 143:86740a56073b | 180 | /** |
AnnaBridge | 143:86740a56073b | 181 | * @brief Function for retrieving the state of given interrupt. |
AnnaBridge | 143:86740a56073b | 182 | * |
AnnaBridge | 143:86740a56073b | 183 | * @param[in] int_mask Interrupt. |
AnnaBridge | 143:86740a56073b | 184 | * |
AnnaBridge | 143:86740a56073b | 185 | * @retval true Interrupt is enabled. |
AnnaBridge | 143:86740a56073b | 186 | * @retval false Interrupt is not enabled. |
AnnaBridge | 143:86740a56073b | 187 | */ |
AnnaBridge | 143:86740a56073b | 188 | __STATIC_INLINE bool nrf_wdt_int_enable_check(uint32_t int_mask) |
AnnaBridge | 143:86740a56073b | 189 | { |
AnnaBridge | 143:86740a56073b | 190 | return (bool)(NRF_WDT->INTENSET & int_mask); |
AnnaBridge | 143:86740a56073b | 191 | } |
AnnaBridge | 143:86740a56073b | 192 | |
AnnaBridge | 143:86740a56073b | 193 | |
AnnaBridge | 143:86740a56073b | 194 | /** |
AnnaBridge | 143:86740a56073b | 195 | * @brief Function for disabling a specific interrupt. |
AnnaBridge | 143:86740a56073b | 196 | * |
AnnaBridge | 143:86740a56073b | 197 | * @param[in] int_mask Interrupt. |
AnnaBridge | 143:86740a56073b | 198 | */ |
AnnaBridge | 143:86740a56073b | 199 | __STATIC_INLINE void nrf_wdt_int_disable(uint32_t int_mask) |
AnnaBridge | 143:86740a56073b | 200 | { |
AnnaBridge | 143:86740a56073b | 201 | NRF_WDT->INTENCLR = int_mask; |
AnnaBridge | 143:86740a56073b | 202 | } |
AnnaBridge | 143:86740a56073b | 203 | |
AnnaBridge | 143:86740a56073b | 204 | |
AnnaBridge | 143:86740a56073b | 205 | /** |
AnnaBridge | 143:86740a56073b | 206 | * @brief Function for returning the address of a specific WDT task register. |
AnnaBridge | 143:86740a56073b | 207 | * |
AnnaBridge | 143:86740a56073b | 208 | * @param[in] task Task. |
AnnaBridge | 143:86740a56073b | 209 | */ |
AnnaBridge | 143:86740a56073b | 210 | __STATIC_INLINE uint32_t nrf_wdt_task_address_get(nrf_wdt_task_t task) |
AnnaBridge | 143:86740a56073b | 211 | { |
AnnaBridge | 143:86740a56073b | 212 | return ((uint32_t)NRF_WDT + task); |
AnnaBridge | 143:86740a56073b | 213 | } |
AnnaBridge | 143:86740a56073b | 214 | |
AnnaBridge | 143:86740a56073b | 215 | |
AnnaBridge | 143:86740a56073b | 216 | /** |
AnnaBridge | 143:86740a56073b | 217 | * @brief Function for returning the address of a specific WDT event register. |
AnnaBridge | 143:86740a56073b | 218 | * |
AnnaBridge | 143:86740a56073b | 219 | * @param[in] event Event. |
AnnaBridge | 143:86740a56073b | 220 | * |
AnnaBridge | 143:86740a56073b | 221 | * @retval address of requested event register |
AnnaBridge | 143:86740a56073b | 222 | */ |
AnnaBridge | 143:86740a56073b | 223 | __STATIC_INLINE uint32_t nrf_wdt_event_address_get(nrf_wdt_event_t event) |
AnnaBridge | 143:86740a56073b | 224 | { |
AnnaBridge | 143:86740a56073b | 225 | return ((uint32_t)NRF_WDT + event); |
AnnaBridge | 143:86740a56073b | 226 | } |
AnnaBridge | 143:86740a56073b | 227 | |
AnnaBridge | 143:86740a56073b | 228 | |
AnnaBridge | 143:86740a56073b | 229 | /** |
AnnaBridge | 143:86740a56073b | 230 | * @brief Function for retrieving the watchdog status. |
AnnaBridge | 143:86740a56073b | 231 | * |
AnnaBridge | 143:86740a56073b | 232 | * @retval true If the watchdog is started. |
AnnaBridge | 143:86740a56073b | 233 | * @retval false If the watchdog is not started. |
AnnaBridge | 143:86740a56073b | 234 | */ |
AnnaBridge | 143:86740a56073b | 235 | __STATIC_INLINE bool nrf_wdt_started(void) |
AnnaBridge | 143:86740a56073b | 236 | { |
AnnaBridge | 143:86740a56073b | 237 | return (bool)(NRF_WDT->RUNSTATUS); |
AnnaBridge | 143:86740a56073b | 238 | } |
AnnaBridge | 143:86740a56073b | 239 | |
AnnaBridge | 143:86740a56073b | 240 | |
AnnaBridge | 143:86740a56073b | 241 | /** |
AnnaBridge | 143:86740a56073b | 242 | * @brief Function for retrieving the watchdog reload request status. |
AnnaBridge | 143:86740a56073b | 243 | * |
AnnaBridge | 143:86740a56073b | 244 | * @param[in] rr_register Reload request register to check. |
AnnaBridge | 143:86740a56073b | 245 | * |
AnnaBridge | 143:86740a56073b | 246 | * @retval true If a reload request is running. |
AnnaBridge | 143:86740a56073b | 247 | * @retval false If no reload request is running. |
AnnaBridge | 143:86740a56073b | 248 | */ |
AnnaBridge | 143:86740a56073b | 249 | __STATIC_INLINE bool nrf_wdt_request_status(nrf_wdt_rr_register_t rr_register) |
AnnaBridge | 143:86740a56073b | 250 | { |
AnnaBridge | 143:86740a56073b | 251 | return (bool)(((NRF_WDT->REQSTATUS) >> rr_register) & 0x1UL); |
AnnaBridge | 143:86740a56073b | 252 | } |
AnnaBridge | 143:86740a56073b | 253 | |
AnnaBridge | 143:86740a56073b | 254 | |
AnnaBridge | 143:86740a56073b | 255 | /** |
AnnaBridge | 143:86740a56073b | 256 | * @brief Function for setting the watchdog reload value. |
AnnaBridge | 143:86740a56073b | 257 | * |
AnnaBridge | 143:86740a56073b | 258 | * @param[in] reload_value Watchdog counter initial value. |
AnnaBridge | 143:86740a56073b | 259 | */ |
AnnaBridge | 143:86740a56073b | 260 | __STATIC_INLINE void nrf_wdt_reload_value_set(uint32_t reload_value) |
AnnaBridge | 143:86740a56073b | 261 | { |
AnnaBridge | 143:86740a56073b | 262 | NRF_WDT->CRV = reload_value; |
AnnaBridge | 143:86740a56073b | 263 | } |
AnnaBridge | 143:86740a56073b | 264 | |
AnnaBridge | 143:86740a56073b | 265 | |
AnnaBridge | 143:86740a56073b | 266 | /** |
AnnaBridge | 143:86740a56073b | 267 | * @brief Function for retrieving the watchdog reload value. |
AnnaBridge | 143:86740a56073b | 268 | * |
AnnaBridge | 143:86740a56073b | 269 | * @retval Reload value. |
AnnaBridge | 143:86740a56073b | 270 | */ |
AnnaBridge | 143:86740a56073b | 271 | __STATIC_INLINE uint32_t nrf_wdt_reload_value_get(void) |
AnnaBridge | 143:86740a56073b | 272 | { |
AnnaBridge | 143:86740a56073b | 273 | return (uint32_t)NRF_WDT->CRV; |
AnnaBridge | 143:86740a56073b | 274 | } |
AnnaBridge | 143:86740a56073b | 275 | |
AnnaBridge | 143:86740a56073b | 276 | |
AnnaBridge | 143:86740a56073b | 277 | /** |
AnnaBridge | 143:86740a56073b | 278 | * @brief Function for enabling a specific reload request register. |
AnnaBridge | 143:86740a56073b | 279 | * |
AnnaBridge | 143:86740a56073b | 280 | * @param[in] rr_register Reload request register to enable. |
AnnaBridge | 143:86740a56073b | 281 | */ |
AnnaBridge | 143:86740a56073b | 282 | __STATIC_INLINE void nrf_wdt_reload_request_enable(nrf_wdt_rr_register_t rr_register) |
AnnaBridge | 143:86740a56073b | 283 | { |
AnnaBridge | 143:86740a56073b | 284 | NRF_WDT->RREN |= 0x1UL << rr_register; |
AnnaBridge | 143:86740a56073b | 285 | } |
AnnaBridge | 143:86740a56073b | 286 | |
AnnaBridge | 143:86740a56073b | 287 | |
AnnaBridge | 143:86740a56073b | 288 | /** |
AnnaBridge | 143:86740a56073b | 289 | * @brief Function for disabling a specific reload request register. |
AnnaBridge | 143:86740a56073b | 290 | * |
AnnaBridge | 143:86740a56073b | 291 | * @param[in] rr_register Reload request register to disable. |
AnnaBridge | 143:86740a56073b | 292 | */ |
AnnaBridge | 143:86740a56073b | 293 | __STATIC_INLINE void nrf_wdt_reload_request_disable(nrf_wdt_rr_register_t rr_register) |
AnnaBridge | 143:86740a56073b | 294 | { |
AnnaBridge | 143:86740a56073b | 295 | NRF_WDT->RREN &= ~(0x1UL << rr_register); |
AnnaBridge | 143:86740a56073b | 296 | } |
AnnaBridge | 143:86740a56073b | 297 | |
AnnaBridge | 143:86740a56073b | 298 | |
AnnaBridge | 143:86740a56073b | 299 | /** |
AnnaBridge | 143:86740a56073b | 300 | * @brief Function for retrieving the status of a specific reload request register. |
AnnaBridge | 143:86740a56073b | 301 | * |
AnnaBridge | 143:86740a56073b | 302 | * @param[in] rr_register Reload request register to check. |
AnnaBridge | 143:86740a56073b | 303 | * |
AnnaBridge | 143:86740a56073b | 304 | * @retval true If the reload request register is enabled. |
AnnaBridge | 143:86740a56073b | 305 | * @retval false If the reload request register is not enabled. |
AnnaBridge | 143:86740a56073b | 306 | */ |
AnnaBridge | 143:86740a56073b | 307 | __STATIC_INLINE bool nrf_wdt_reload_request_is_enabled(nrf_wdt_rr_register_t rr_register) |
AnnaBridge | 143:86740a56073b | 308 | { |
AnnaBridge | 143:86740a56073b | 309 | return (bool)(NRF_WDT->RREN & (0x1UL << rr_register)); |
AnnaBridge | 143:86740a56073b | 310 | } |
AnnaBridge | 143:86740a56073b | 311 | |
AnnaBridge | 143:86740a56073b | 312 | |
AnnaBridge | 143:86740a56073b | 313 | /** |
AnnaBridge | 143:86740a56073b | 314 | * @brief Function for setting a specific reload request register. |
AnnaBridge | 143:86740a56073b | 315 | * |
AnnaBridge | 143:86740a56073b | 316 | * @param[in] rr_register Reload request register to set. |
AnnaBridge | 143:86740a56073b | 317 | */ |
AnnaBridge | 143:86740a56073b | 318 | __STATIC_INLINE void nrf_wdt_reload_request_set(nrf_wdt_rr_register_t rr_register) |
AnnaBridge | 143:86740a56073b | 319 | { |
AnnaBridge | 143:86740a56073b | 320 | NRF_WDT->RR[rr_register] = NRF_WDT_RR_VALUE; |
AnnaBridge | 143:86740a56073b | 321 | } |
AnnaBridge | 143:86740a56073b | 322 | |
AnnaBridge | 143:86740a56073b | 323 | |
AnnaBridge | 143:86740a56073b | 324 | #endif |
AnnaBridge | 143:86740a56073b | 325 | |
AnnaBridge | 143:86740a56073b | 326 | /** @} */ |