mirror of
				https://github.com/esp8266/Arduino.git
				synced 2025-11-03 14:33:37 +03:00 
			
		
		
		
	Remove implementations of WDT-related functions
which were not correct since 0.9.3 anyway
This commit is contained in:
		@@ -153,9 +153,7 @@ APIs related to deep sleep and watchdog timer are available in the ```ESP``` obj
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
```ESP.deepSleep(microseconds, mode)``` will put the chip into deep sleep. ```mode``` is one of ```WAKE_RF_DEFAULT```, ```WAKE_RFCAL```, ```WAKE_NO_RFCAL```, ```WAKE_RF_DISABLED```. (GPIO16 needs to be tied to RST to wake from deepSleep.)
 | 
					```ESP.deepSleep(microseconds, mode)``` will put the chip into deep sleep. ```mode``` is one of ```WAKE_RF_DEFAULT```, ```WAKE_RFCAL```, ```WAKE_NO_RFCAL```, ```WAKE_RF_DISABLED```. (GPIO16 needs to be tied to RST to wake from deepSleep.)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
```ESP.wdtEnable()```, ```ESP.wdtDisable()```, and ```ESP.wdtFeed()``` provide some control over the watchdog timer.
 | 
					```ESP.restart()``` restarts the CPU.
 | 
				
			||||||
 | 
					 | 
				
			||||||
```ESP.reset()``` resets the CPU.
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
```ESP.getFreeHeap()``` returns the free heap size.
 | 
					```ESP.getFreeHeap()``` returns the free heap size.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -32,12 +32,6 @@ extern struct rst_info resetInfo;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
// #define DEBUG_SERIAL Serial
 | 
					// #define DEBUG_SERIAL Serial
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//extern "C" void ets_wdt_init(uint32_t val);
 | 
					 | 
				
			||||||
extern "C" void ets_wdt_enable(void);
 | 
					 | 
				
			||||||
extern "C" void ets_wdt_disable(void);
 | 
					 | 
				
			||||||
extern "C" void wdt_feed(void) {
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * User-defined Literals
 | 
					 * User-defined Literals
 | 
				
			||||||
@@ -85,46 +79,42 @@ unsigned long long operator"" _GB(unsigned long long x) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
EspClass ESP;
 | 
					EspClass ESP;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
EspClass::EspClass()
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void EspClass::wdtEnable(uint32_t timeout_ms)
 | 
					void EspClass::wdtEnable(uint32_t timeout_ms)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    //todo find doku for ets_wdt_init may set the timeout
 | 
					 | 
				
			||||||
	ets_wdt_enable();
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void EspClass::wdtEnable(WDTO_t timeout_ms)
 | 
					void EspClass::wdtEnable(WDTO_t timeout_ms)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    wdtEnable((uint32_t) timeout_ms);
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void EspClass::wdtDisable(void)
 | 
					void EspClass::wdtDisable(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	ets_wdt_disable();
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void EspClass::wdtFeed(void)
 | 
					void EspClass::wdtFeed(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	wdt_feed();
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void EspClass::deepSleep(uint32_t time_us, WakeMode mode)
 | 
					void EspClass::deepSleep(uint32_t time_us, WakeMode mode)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	system_deep_sleep_set_option(static_cast<int>(mode));
 | 
					    system_deep_sleep_set_option(static_cast<int>(mode));
 | 
				
			||||||
 	system_deep_sleep(time_us);
 | 
					    system_deep_sleep(time_us);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					extern "C" void esp_yield();
 | 
				
			||||||
 | 
					extern "C" void __real_system_restart_local();
 | 
				
			||||||
void EspClass::reset(void)
 | 
					void EspClass::reset(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	((void (*)(void))0x40000080)();
 | 
					    __real_system_restart_local();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void EspClass::restart(void)
 | 
					void EspClass::restart(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    system_restart();
 | 
					    system_restart();
 | 
				
			||||||
 | 
					    esp_yield();
 | 
				
			||||||
 | 
					    // todo: provide an alternative code path if this was called
 | 
				
			||||||
 | 
					    // from system context, not from continuation
 | 
				
			||||||
 | 
					    // (implement esp_is_cont_ctx()?)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
uint16_t EspClass::getVcc(void)
 | 
					uint16_t EspClass::getVcc(void)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -71,8 +71,6 @@ typedef enum {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
class EspClass {
 | 
					class EspClass {
 | 
				
			||||||
    public:
 | 
					    public:
 | 
				
			||||||
        EspClass();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        // TODO: figure out how to set WDT timeout
 | 
					        // TODO: figure out how to set WDT timeout
 | 
				
			||||||
        void wdtEnable(uint32_t timeout_ms = 0);
 | 
					        void wdtEnable(uint32_t timeout_ms = 0);
 | 
				
			||||||
        // note: setting the timeout value is not implemented at the moment
 | 
					        // note: setting the timeout value is not implemented at the moment
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user