aboutsummaryrefslogtreecommitdiffstats
path: root/source/libmaple/api
diff options
context:
space:
mode:
authorMarti Bolivar <mbolivar@leaflabs.com>2012-05-10 16:50:51 -0400
committerMarti Bolivar <mbolivar@leaflabs.com>2012-05-16 13:23:39 -0400
commitce8ac32dd07523be46d977105729e3717b7fbdec (patch)
treecddaf19b08b266d5495459e8e4d1829280bd96f2 /source/libmaple/api
parent2e7b11af18a0dc7ef1a392bda43ba8fefc173056 (diff)
downloadlibrambutan-ce8ac32dd07523be46d977105729e3717b7fbdec.tar.gz
librambutan-ce8ac32dd07523be46d977105729e3717b7fbdec.zip
Update <libmaple/iwdg.h> page.
No new APIs, but keep the format up to date. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
Diffstat (limited to 'source/libmaple/api')
-rw-r--r--source/libmaple/api/iwdg.rst83
1 files changed, 47 insertions, 36 deletions
diff --git a/source/libmaple/api/iwdg.rst b/source/libmaple/api/iwdg.rst
index 06691f8..172c7ec 100644
--- a/source/libmaple/api/iwdg.rst
+++ b/source/libmaple/api/iwdg.rst
@@ -1,10 +1,11 @@
.. highlight:: c
.. _libmaple-iwdg:
-``iwdg.h``
-==========
+``<libmaple/iwdg.h>``
+=====================
-Independent Watchdog (IWDG) support.
+Independent Watchdog (IWDG) support. The IWDG peripheral is common
+across supported targets, so everything documented here is portable.
.. contents:: Contents
:local:
@@ -12,20 +13,15 @@ Independent Watchdog (IWDG) support.
Usage Note
----------
-To use the independent watchdog, first call :c:func:`iwdg_init()` with
-the appropriate prescaler and IWDG counter reload values for your
-application. Afterwards, you must periodically call
-:c:func:`iwdg_feed()` before the IWDG counter reaches 0 to reset the
-counter to its reload value. If you do not, the chip will reset.
+To use the independent watchdog, first call :ref:`iwdg_init()
+<libmaple-iwdg-iwdg_init>` with the appropriate prescaler and IWDG
+counter reload values for your application. Afterwards, you must
+periodically call :ref:`iwdg_feed() <libmaple-iwdg-iwdg_feed>` before
+the IWDG counter reaches zero to reset the counter to its reload
+value. If you do not, the chip will reset.
Once started, the independent watchdog cannot be turned off.
-Types
------
-
-.. doxygenstruct:: iwdg_reg_map
-.. doxygenenum:: iwdg_prescaler
-
Devices
-------
@@ -34,40 +30,55 @@ None at this time.
Functions
---------
+.. _libmaple-iwdg-iwdg_init:
.. doxygenfunction:: iwdg_init
+.. _libmaple-iwdg-iwdg_feed:
.. doxygenfunction:: iwdg_feed
-Register Map Base Pointers
---------------------------
+Types
+-----
+
+.. doxygenenum:: iwdg_prescaler
+
+
+Register Maps
+-------------
+
+The register map is common on all supported targets. The base pointer
+is ``IWDG_BASE``.
.. doxygendefine:: IWDG_BASE
+.. doxygenstruct:: iwdg_reg_map
+
Register Bit Definitions
------------------------
-Key register
-~~~~~~~~~~~~
+Register bit definitions are common on all supported targets. They are
+given as source code.
+
+::
+
+ /* Key register */
-.. doxygendefine:: IWDG_KR_UNLOCK
-.. doxygendefine:: IWDG_KR_FEED
-.. doxygendefine:: IWDG_KR_START
+ #define IWDG_KR_UNLOCK 0x5555
+ #define IWDG_KR_FEED 0xAAAA
+ #define IWDG_KR_START 0xCCCC
-Prescaler register
-~~~~~~~~~~~~~~~~~~
+ /* Prescaler register */
-.. doxygendefine:: IWDG_PR_DIV_4
-.. doxygendefine:: IWDG_PR_DIV_8
-.. doxygendefine:: IWDG_PR_DIV_16
-.. doxygendefine:: IWDG_PR_DIV_32
-.. doxygendefine:: IWDG_PR_DIV_64
-.. doxygendefine:: IWDG_PR_DIV_128
-.. doxygendefine:: IWDG_PR_DIV_256
+ #define IWDG_PR_DIV_4 0x0
+ #define IWDG_PR_DIV_8 0x1
+ #define IWDG_PR_DIV_16 0x2
+ #define IWDG_PR_DIV_32 0x3
+ #define IWDG_PR_DIV_64 0x4
+ #define IWDG_PR_DIV_128 0x5
+ #define IWDG_PR_DIV_256 0x6
-Status register
-~~~~~~~~~~~~~~~
+ /* Status register */
-.. doxygendefine:: IWDG_SR_RVU_BIT
-.. doxygendefine:: IWDG_SR_PVU_BIT
+ #define IWDG_SR_RVU_BIT 1
+ #define IWDG_SR_PVU_BIT 0
-.. doxygendefine:: IWDG_SR_RVU
-.. doxygendefine:: IWDG_SR_PVU
+ #define IWDG_SR_RVU (1U << IWDG_SR_RVU_BIT)
+ #define IWDG_SR_PVU (1U << IWDG_SR_PVU_BIT)