Skip to content

More flexible Timer control #2586

Open
Open
@gfwilliams

Description

The internal timer system in Espruino is pretty powerful. Right now we have it exposed in a few different ways:

  • Waveform
  • analogWrite(..., {forceSoft})
  • digitalPulse
  • Pin.writeAtTime
  • Stepper
  • E.dumpTimers (for debug)

But there are some things it can do that we don't expose:

  • Synchronised PWM on up to 4 different pins (eg for positive+negative outputs of a square wave)
  • Output a value on up to 4 different pins as a set time
  • Executing a function from an interrupt: covered in Utility Timer native functions #476

... and probably more.

I'm not sure how to do this nicely, but it seems kind of crazy that we currently have (at least) 5 different APIs for using the same timer system. It might be nice to have a simple JS API that allows timers to be queried/updated and added programatically, and then we ditch E.dumpTimers and Pin.writeAtTime which nobody really uses

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions