Skip to content

Commit 5ae26dd

Browse files
committed
[iwdg] Enable IWDG on STM32H7 devices
1 parent f58b42f commit 5ae26dd

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ Please [discover modm's peripheral drivers for your specific device][discover].
406406
<td align="center">✅</td>
407407
<td align="center">✅</td>
408408
<td align="center">✅</td>
409-
<td align="center"></td>
409+
<td align="center"></td>
410410
<td align="center">✅</td>
411411
<td align="center">✅</td>
412412
<td align="center">✅</td>

src/modm/platform/iwdg/stm32/iwdg.hpp renamed to src/modm/platform/iwdg/stm32/iwdg.hpp.in

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ class Iwdg : public ::modm::PeripheralDriver
5050
initialize(Prescaler prescaler, uint16_t reload)
5151
{
5252
writeKey(writeCommand);
53-
IWDG->PR = uint32_t(prescaler);
54-
IWDG->RLR = reload;
53+
IWDG{{core}}->PR = uint32_t(prescaler);
54+
IWDG{{core}}->RLR = reload;
5555
writeKey(0); // disable access to PR and RLR registers
5656
}
5757

@@ -82,14 +82,14 @@ class Iwdg : public ::modm::PeripheralDriver
8282
static inline Status
8383
getStatus()
8484
{
85-
return Status(IWDG->SR);
85+
return Status(IWDG{{core}}->SR);
8686
}
8787

8888
private:
8989
static inline void
9090
writeKey(uint16_t key)
9191
{
92-
IWDG->KR = key;
92+
IWDG{{core}}->KR = key;
9393
}
9494

9595
static constexpr uint16_t reloadCommand = 0xAAAA;

src/modm/platform/iwdg/stm32/module.lb

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,13 @@ def init(module):
1717

1818
def prepare(module, options):
1919
device = options[":target"]
20-
# STM32H7 is not yet supported with any IWDG implementation
21-
if device.identifier.family in ["h7"]:
22-
return False
2320

2421
module.depends(":cmsis:device", ":math:algorithm")
2522
return device.has_driver("iwdg:stm32")
2623

2724

2825
def build(env):
2926
env.outbasepath = "modm/src/modm/platform/iwdg"
30-
env.copy("iwdg.hpp")
27+
# FIXME: Use IWDG2 for second core on STM32H7x5
28+
env.substitutions = {"core": 1 if env[":target"].identifier.family in ["h7"] else ""}
29+
env.template("iwdg.hpp.in")

0 commit comments

Comments
 (0)