Fix capitalize folder and file name ignored

This commit is contained in:
Phat Nguyen
2024-02-17 17:28:51 +07:00
parent 781fb51c6f
commit 6cdbb8a0a3
24 changed files with 1469 additions and 0 deletions
+74
View File
@@ -0,0 +1,74 @@
#include "HardwareWatchdog.h"
HardwareWatchdog::HardwareWatchdog(BoardType type) : boardType(type) {}
#if defined(ESP8266)
void HardwareWatchdog::begin(Stream &debugStream) {
this->_debugStream = &debugStream;
this->begin();
}
#else
#endif
/**
* @brief Initialize external watchdog
*
*/
void HardwareWatchdog::begin(void) {
if (this->_isInit) {
return;
}
/** Get BSP */
this->bsp = getBoardDef(this->boardType);
if ((this->bsp == nullptr) || (this->bsp->WDG.supported == false)) {
AgLog("Board not supported Watchdog");
return;
}
/** Init GPIO and first feed external watchdog */
pinMode(this->bsp->WDG.resetPin, OUTPUT);
this->_feed();
this->_isInit = true;
AgLog("Inittialized");
}
/**
* @brief Reset Watchdog
*
*/
void HardwareWatchdog::reset(void) {
if (this->isInitInvalid()) {
return;
}
this->_feed();
}
/**
* @brief Wathdog timeout
*
* @return int Millisecionds
*/
int HardwareWatchdog::getTimeout(void) { return 5 * 1000 * 60; }
bool HardwareWatchdog::isInitInvalid(void) {
if (this->_isInit == false) {
AgLog("No-initialized");
return true;
}
return false;
}
/**
* @brief Reset external watchdog
*
*/
void HardwareWatchdog::_feed(void) {
digitalWrite(this->bsp->WDG.resetPin, HIGH);
delay(25);
digitalWrite(this->bsp->WDG.resetPin, LOW);
AgLog("Reset");
}