wdt.h(3)

πŸ“¦ version 2.2.1, in fedora 43, fedora 44, opensuse-leap 16.0

πŸŽ€ 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 a wdr instruction 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 the value you hand to wdt_enable(). they go from WDTO_15MS = 0 all the way up to WDTO_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 those WDTO_* constants as value to set how long it waits. it's static, 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