mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-28 05:36:37 +00:00
Add is_system_pin
This commit is contained in:
parent
e97d7459f4
commit
c5204b48d5
@ -77,6 +77,10 @@ class BaseDevice {
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
virtual bool is_system_pin(uint8_t pin)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace dev
|
||||
|
@ -122,6 +122,16 @@ uint16_t Esp32Device::get_cpu_frequency()
|
||||
return ESP.getCpuFreqMHz();
|
||||
}
|
||||
|
||||
bool Esp32Device::is_system_pin(uint8_t pin)
|
||||
{
|
||||
if((pin >= 6) && (pin <= 11)) return true; // integrated SPI flash
|
||||
if((pin == 37) || (pin == 38)) return true; // unavailable
|
||||
if(psramFound()) {
|
||||
if((pin == 16) || (pin == 17)) return true; // PSRAM
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace dev
|
||||
|
||||
#if defined(LANBONL8)
|
||||
|
@ -39,6 +39,8 @@ class Esp32Device : public BaseDevice {
|
||||
uint8_t get_heap_fragmentation() override;
|
||||
uint16_t get_cpu_frequency() override;
|
||||
|
||||
bool is_system_pin(uint8_t pin) override;
|
||||
|
||||
private:
|
||||
std::string _hostname;
|
||||
|
||||
|
@ -109,6 +109,13 @@ uint16_t Esp8266Device::get_cpu_frequency()
|
||||
return ESP.getCpuFreqMHz();
|
||||
}
|
||||
|
||||
bool Esp8266Device::is_system_pin(uint8_t pin)
|
||||
{
|
||||
if((pin >= 6) && (pin <= 11)) return true; // integrated SPI flash
|
||||
if((pin >= 12) && (pin <= 14)) return true; // HSPI
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace dev
|
||||
|
||||
dev::Esp8266Device haspDevice;
|
||||
|
@ -41,6 +41,8 @@ class Esp8266Device : public BaseDevice {
|
||||
uint8_t get_heap_fragmentation() override;
|
||||
uint16_t get_cpu_frequency() override;
|
||||
|
||||
bool is_system_pin(uint8_t pin) override;
|
||||
|
||||
private:
|
||||
std::string _hostname;
|
||||
|
||||
|
@ -119,6 +119,11 @@ uint16_t Win32Device::get_cpu_frequency()
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool Win32Device::is_system_pin(uint8_t pin)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace dev
|
||||
|
||||
dev::Win32Device haspDevice;
|
||||
|
@ -59,6 +59,8 @@ class Win32Device : public BaseDevice {
|
||||
uint8_t get_heap_fragmentation();
|
||||
uint16_t get_cpu_frequency();
|
||||
|
||||
bool is_system_pin(uint8_t pin) override;
|
||||
|
||||
private:
|
||||
std::string _hostname;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user