ESPHome 2026.1.4
Loading...
Searching...
No Matches
waveform_stubs.cpp
Go to the documentation of this file.
1#ifdef USE_ESP8266_WAVEFORM_STUBS
2
3// Stub implementations for Arduino waveform/PWM functions.
4//
5// When the waveform generator is not needed (no esp8266_pwm component),
6// we exclude core_esp8266_waveform_pwm.cpp from the build to save ~596 bytes
7// of RAM and 464 bytes of flash.
8//
9// These stubs satisfy calls from the Arduino GPIO code when the real
10// waveform implementation is excluded. They must be in the global namespace
11// with C linkage to match the Arduino core function declarations.
12
13#include <cstdint>
14
15// Empty namespace to satisfy linter - actual stubs must be at global scope
16namespace esphome::esp8266 {} // namespace esphome::esp8266
17
18extern "C" {
19
20// Called by Arduino GPIO code to stop any waveform on a pin
21int stopWaveform(uint8_t pin) {
22 (void) pin;
23 return 1; // Success (no waveform to stop)
24}
25
26// Called by Arduino GPIO code to stop any PWM on a pin
27bool _stopPWM(uint8_t pin) {
28 (void) pin;
29 return false; // No PWM was running
30}
31
32} // extern "C"
33
34#endif // USE_ESP8266_WAVEFORM_STUBS
int stopWaveform(uint8_t pin)
bool _stopPWM(uint8_t pin)