mirror of
https://github.com/esp8266/Arduino.git
synced 2025-07-29 05:21:37 +03:00
Allow specifying waveform generator in source code (#7800)
* 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.
This commit is contained in:
committed by
GitHub
parent
a4b6003c2e
commit
f5fd5912fe
@ -70,8 +70,6 @@ function build_sketches()
|
||||
local sketches=$(find $srcpath -name *.ino | sort)
|
||||
print_size_info >size.log
|
||||
export ARDUINO_IDE_PATH=$arduino
|
||||
local pwm_phase=""
|
||||
[ $(( $build_rem % 2 )) -eq 0 ] && pwm_phase="--waveform_phase"
|
||||
local testcnt=0
|
||||
for sketch in $sketches; do
|
||||
testcnt=$(( ($testcnt + 1) % $build_mod ))
|
||||
@ -119,8 +117,8 @@ function build_sketches()
|
||||
export MSYS2_ARG_CONV_EXC="*"
|
||||
export MSYS_NO_PATHCONV=1
|
||||
fi
|
||||
echo "$build_cmd $pwm_phase $sketch"
|
||||
time ($build_cmd $pwm_phase $sketch >build.log)
|
||||
echo "$build_cmd $sketch"
|
||||
time ($build_cmd $sketch >build.log)
|
||||
local result=$?
|
||||
if [ $result -ne 0 ]; then
|
||||
echo "Build failed ($1)"
|
||||
|
Reference in New Issue
Block a user