* Currently all Inputs run each time through the loop, which could be a
problem when an input is slow. It would be good if the @: operator could
also rate limit when Inputs occur.
Copilot does not let `extern` be limited, but the actual input operation
is done by ardino-copilot's readInput, and extern then just uses the
value it sets. So, make each Input add a trigger, that sets a flag
variable, and in readInput just check if the flag is set.
It should be possible to implement this w/o adding overhead when @: is
not used on an Input. Either, avoid checking the flag in this case,
or check that the C compiler can optimise away a check of a flag that
always succeeds.
* Naming could be more FRP-like. readfrom and readvoltage
are too imperative sounding. (Outputs were already fixed to be
FRP-style.)
A polymorphic read operation could work, assuming type inference is
able to usually determine what kind of value is wanted to be read.
a <- stream a1
pin1 := a
Looks like this would work: While the type of a could be Bool or Voltage,
going to a pin that only supports digital IO implies it must be a Bool.
(Need to check if the type checker is able to work this out!)
* analogReference()
Takes one of a set of defines, which vary depending on board,
so how to pass that through Copilot? Could write a C
switch statement, on an int, and have the boade modules define
effectively enums.
* readvoltage gets a raw ADC value; add a stream function to convert that
to a floating point actual voltage, given also a stream that contains
the reference voltage.
* delayMicroseconds
* pulses
* random numbers
* Wire library