wdt.h(3)
π wdt.h β the watchdog timer header, bestie π
okay so this is wdt.h, one of the headers from avr-libc, and it's the one that handles your watchdog timer on AVR. yes, the watchdog. the lil guy that resets your chip if your code ghosts it. main character energy fr fr. πβ¨
β¨ NAME β¨
wdt.h β that's it, that's the name, no notes π
πΈ SYNOPSIS πΈ
π§ Macros
#define wdt_reset() __asm__ __volatile__ ('wdr')
#define WDTO_15MS 0
#define WDTO_30MS 1
#define WDTO_60MS 2
#define WDTO_120MS 3
#define WDTO_250MS 4
#define WDTO_500MS 5
#define WDTO_1S 6
#define WDTO_2S 7
#define WDTO_4S 8
#define WDTO_8S 9
π¦ Functions
static __inline__ __attribute__ ((__always_inline__)) void
wdt_enable(const uint8_t value)
π DESCRIPTION π
lowkey the whole point of this header is two things: poking the watchdog so it knows you're still alive, and setting how long it waits before it decides you're not. π
wdt_reset()β this is the "hey bestie I'm still here!!" macro. it drops awdrinstruction straight into your code via inline asm, and that tells the watchdog timer to restart its countdown. call it regularly or the watchdog will absolutely come for you. no cap. π- the
WDTO_*macros β these are your timeout values, each one a plain integer constant, and they're thevalueyou hand towdt_enable(). they go fromWDTO_15MS=0all the way up toWDTO_8S=9. pick your vibe, pick your patience level. π°οΈ
not me reminding you that if your code stops resetting the watchdog before the timeout hits, the chip just... resets. that's the whole bit. that's the deal. it's giving consequences. π
π OPTIONS π
π Macros
wdt_reset()β expands to__asm__ __volatile__ ('wdr'), which kicks the watchdog timer back to the start of its countdown. your "still alive" button. periodt. π«ΆWDTO_15MSβ0, the shortest timeout in the lineup.WDTO_30MSβ1.WDTO_60MSβ2.WDTO_120MSβ3.WDTO_250MSβ4.WDTO_500MSβ5.WDTO_1Sβ6, one whole second of patience.WDTO_2Sβ7.WDTO_4Sβ8.WDTO_8Sβ9, the chillest of the bunch. longest leash. π
β Functions
static __inline__ __attribute__ ((__always_inline__)) void wdt_enable(const uint8_t value)β this is the one that actually turns the watchdog on, and you pass it one of thoseWDTO_*constants asvalueto set how long it waits. it'sstatic, it's__inline__, and it's marked__always_inline__, so yeah β it's getting inlined whether you like it or not. iconic behavior honestly. β¨
π AUTHOR π
Generated automatically by Doxygen for avr-libc from the source code. so like, not a human, a robot wrote this. slay, I guess. π€π
Version 2.1.0 πΈ Sat Jan 29 2022 β that's the version and the date this page was born, and that's a wrap bestie, go reset your watchdog before it resets you ππ¦π
π¦ where this page comes from
- fedora 43: avr-libc 2.2.1-3.fc43 Β· BSD-3-Clause
- fedora 44: avr-libc 2.2.1-5.fc44 Β· BSD-3-Clause
- opensuse-leap 16.0: avr-libc 2.1.0-bp160.1.33 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms