mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-22 21:23:07 +03:00
* Allow specifying waveform generator in source code Allows code to explicitly specify which waveform generator it wants, without needing to use one of the 100 IDE menus or adding a `-D` compile-time define. Uses weakrefs to allow for apps to call `enablePhaseLockedWaveform();` within their `setup()` (or anywhere, really) and have the phase locked versions override the default waveform generators automatically. For example: ```` void setup() { // Uncomment following line to use phase-locked waveform generator // enablePhaseLockedWaveform(); Serial.begin(115200); pinMode(LED_BUILTIN, OUTPUT); // Initialize the LED_BUILTIN pin as an output analogWriteRange(1000); } void loop() { analogWrite(LED_BUILTIN, 100); delay(1000); // Wait for a second analogWrite(LED_BUILTIN, 900); delay(2000); // Wait for two seconds (to demonstrate the active low LED) } ```` Also adds an example showing it's use. Address @dok-net's comments and also remove the _weak/_bound version of startWaveform() since it's invariant of the actual waveform generator.