Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow specifying waveform generator in source code #7800

Merged
merged 7 commits into from
Jan 17, 2021

Commits on Dec 31, 2020

  1. 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.
    earlephilhower committed Dec 31, 2020
    Configuration menu
    Copy the full SHA
    ee3bba5 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    e38c174 View commit details
    Browse the repository at this point in the history
  3. Clean up core, remove unneeded weak call

    Address @dok-net's comments and also remove the _weak/_bound version of
    startWaveform() since it's invariant of the actual waveform generator.
    earlephilhower committed Dec 31, 2020
    Configuration menu
    Copy the full SHA
    a7f9e1a View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    3125f70 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    2be4873 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    0482c33 View commit details
    Browse the repository at this point in the history

Commits on Jan 17, 2021

  1. Configuration menu
    Copy the full SHA
    843512a View commit details
    Browse the repository at this point in the history