mirror of
https://github.com/esphome/esphome.git
synced 2026-02-22 09:25:42 -07:00
tweaks
This commit is contained in:
@@ -23,7 +23,7 @@ def require_waveform() -> None:
|
||||
to save ~580 bytes of RAM (wvfState 512B + pwmState 68B).
|
||||
|
||||
Example:
|
||||
from esphome.components.esp8266.const import require_waveform
|
||||
from .const import require_waveform
|
||||
|
||||
async def to_code(config):
|
||||
require_waveform()
|
||||
|
||||
@@ -6,21 +6,22 @@
|
||||
// we exclude core_esp8266_waveform_pwm.cpp from the build to save ~580 bytes
|
||||
// of RAM (wvfState 512B + pwmState 68B).
|
||||
//
|
||||
// However, digitalWrite() unconditionally calls stopWaveform() and _stopPWM()
|
||||
// to ensure any active waveform is stopped before changing pin state.
|
||||
// These stubs satisfy those calls when the real waveform code is excluded.
|
||||
// These stubs satisfy calls from the Arduino GPIO code when the real
|
||||
// waveform implementation is excluded.
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace esphome::esp8266 {
|
||||
|
||||
extern "C" {
|
||||
|
||||
// Called by digitalWrite() to stop any waveform on a pin
|
||||
// Called by Arduino GPIO code to stop any waveform on a pin
|
||||
int stopWaveform(uint8_t pin) {
|
||||
(void) pin;
|
||||
return 1; // Success (no waveform to stop)
|
||||
}
|
||||
|
||||
// Called by digitalWrite() to stop any PWM on a pin
|
||||
// Called by Arduino GPIO code to stop any PWM on a pin
|
||||
bool _stopPWM(uint8_t pin) {
|
||||
(void) pin;
|
||||
return false; // No PWM was running
|
||||
@@ -28,4 +29,6 @@ bool _stopPWM(uint8_t pin) {
|
||||
|
||||
} // extern "C"
|
||||
|
||||
} // namespace esphome::esp8266
|
||||
|
||||
#endif // USE_ESP8266_WAVEFORM_STUBS
|
||||
|
||||
Reference in New Issue
Block a user