Developing the IWDG driver
In this section, we’ll use what we’ve learned so far in this chapter to develop the IWDG driver.
Let’s start by setting up the project.
Create a copy of your previous project in your IDE, following the steps outlined in earlier chapters. Rename this copied project to IWDG
. Next, create a new file named iwdg.c
in the Src
folder and another file named iwdg.h
in the Inc
folder.
The IWDG implementation file
Populate your iwdg.c
file with the following code:
#include "iwdg.h" #define IWDG_KEY_ENABLE 0x0000CCCCU #define IWDG_KEY_WR_ACCESS_ENABLE 0x00005555U #define IWDG_PRESCALER_4 0x00000000U #define IWDG_RELOAD_VAL &...