-
Notifications
You must be signed in to change notification settings - Fork 39
Description
Hi folks,
When @oclyke rewrote the RTC library for v.2.0.x, he adopted an approach of instantiating the RTC class from directly within the library:
Arduino_Apollo3/libraries/RTC/src/RTC.h
Line 59 in fbb2eac
extern Apollo3RTC RTC; |
I've rewritten the WDT library for v2.0.x, however, if I instantiate the class using extern Apollo3WDT WDT;
, there are conflicts when writing directly to the WDT registers. Two examples of such functions are shown below:
// Set number of watchdog timer ticks allowed before a watchdog interrupt event is generated
void Apollo3WDT::setInterrupt(uint8_t interrupt)
{
WDT->CFG_b.INTVAL = interrupt;
}
// Set number of watchdog timer ticks allowed before the watchdog will issue a system reset
void Apollo3WDT::setReset(uint8_t reset)
{
WDT->CFG_b.RESVAL = reset;
}
Is there a particular reason for instantiating the class from within the library? I'm unfamiliar if this is a standard Mbed OS approach.
One solution could be to simply rename the instantiated object to "wdt" instead of "WDT", but then I'd likely also want to rename "RTC" to "rtc" to have greater consistency on the Core.
Cheers,
Adam