Let SleepHandler use the symbol counter

Instead of switching timer2 to asynchronous mode on every sleep, we now
configure the symbol counter to always run in asynchronous mode and use
that for wake up timers. It doesn't have a prescaler, but because it is
a 32-bit timer we can still sleep up to 9.5 hours, without a granularity
of 16μs.

Instead of passing the time-to-sleep around, now the target sleep
counter is passed around, which should also make things more accurate.

This breaks uptime.millis.sleep for now, since this counter is no longer
kept. We could calculate this from the total time and millis() counter,
except that they have different overflow ranges, making the subtraction
produce bogus results after the first overflow.

A side effect of this is that the frequency of timer2 drops from 250kHz
to 32kiHz. This affects the blue led only, but the PWM frequency is
still 128Hz which should be enough.
Do not accidentally disable all symbol counter interrupts

When enabling the CMP3 interrupt, all other interrupts would be
disabled. Now, a bitwise or is used to only touch the CMP3 bit and leave
other bits untouched.
Redo the uptime counters

There are now again three uptime counters: uptime.awake, uptime.sleep
and uptime (total uptime). Each of them has two subcounters: .seconds
that returns the number of seconds and .micros that returns the time
_within_ the current second in microseconds (so this rolls over at
1,000,000 microseconds).

All counters now have a precision of 16us. The seconds counter is
32-bits wide, so it will only overflow after 136 years - as good as
never.

This removes the uptime.minutes, uptime.hours, uptime.days and
uptime.millis scoutscript functions. The uptime.micros function is
changed - before it returned the total number of microseconds since
startup, overflowing only after 2^32 us (over an hour). Now, it rolls
over every second and should be used in conjunction with the seconds
counter to get the full value.

Additionally, the uptime report now contains the total uptime and sleep
time, in seconds instead of milliseconds.
Write the sleep end time to the compare register sooner

Instead of storing the sleep end time in a variable for a while and
writing it to the symbol counter compare register just before sleeping,
we now write it to the register right away. This makes it easier to
detect if the sleep time already passed while waiting for unfinished
business.
Since the hardware now keeps a flag for this, we no longer
have to check for overflow and we can again juse the full uin32_t range,
extending the maximum sleep time to 19 hours.
Fix lockup in SleepHandler::doSleep

After enabling the ADC after sleeping, a loop waited for VDD to be back
at the right level before continuing. However, the condition on the loop
was inverted, meaning the loop would wait _while_ the level was correct.

If the VDD level was ok before this loop was reached, this would lock up
the scout. In practice, it seems this didn't happen until wakeup
interrupts were added (which add some delay after sleep).
Add Pbbe::LogicalPin::in() method

This allows easily checking if a given pin is present in a given mask.
Support waking up on pin changes

Using the power.wakeup.pin("pin_name", [enable]) command, you can now
enable wakeup from sleep on changes to specific pins. The pin must be
configured to input (or input_pullup) before sleeping to make this work.

SleepHandler enables the corresponding interrupt handler for waking up
the scout, but nothing actually happens in the interrupt. After wakeup,
if the pin change holds on long enough, the normal event handlers are
triggered and can be used to react to events.

Not all pins are available, only the pins that have external interrupt
or pin change interrupts (which aren't a lot on 256rfr2 unfortunately).
Supported pins are: D2, D4, D5, D7, BATT_ALERT, SS, MOSI, MISO, SCK,
TX1, RX1, SDA, SCL.

Of these, pins D4, D5, D7 and BATT_ALERT only support waking up on a low
level, not on a change. This means that wakeup is enabled for one of
these pins and it is low when starting the sleep, the scout will
immediately wake up again, effectively preventing it from sleeping.

The pins shown above are the ones supported by SleepHandler, but the
power.wakeup.pins currently only allows passing D2, D4, D5 and D7, the
others are refused. This will probably change in the future.

Furthermore, due to a bug [1] in the Arduino core, for the SCL, SDA, RX1
and TX1 pins when a pin change happens while not sleeping, the next
sleep will be immediately interrupted because the interrupt flag remains
set and immediately triggers the interrupt.

[1]: https://github.com/arduino/Arduino/issues/510

Note that not a lot of effort is done to prevent race conditions: For
example, if the pin change occurs just before sleeping, then the
corresponding pin change handler might not be run, or only after
sleeping. If these race conditions are problematic, short response times
are needed or the pulses are very short, a custom sketch might still be
needed.
Add uptime.status command

This shows the various uptime counters in a human-readable format.

> uptime.status
Total: 0 days, 0 hours, 0 minutes, 7.282800 seconds
Awake: 0 days, 0 hours, 0 minutes, 7.284064 seconds
Asleep: 0 days, 0 hours, 0 minutes, 0.000000 seconds
> power.sleep(10000)
>�
> uptime.status
Total: 0 days, 0 hours, 0 minutes, 31.612544 seconds
Awake: 0 days, 0 hours, 0 minutes, 21.634176 seconds
Asleep: 0 days, 0 hours, 0 minutes, 9.979648 seconds
> uptime.status
Total: 0 days, 0 hours, 1 minutes, 12.919408 seconds
Awake: 0 days, 0 hours, 1 minutes, 2.941040 seconds
Asleep: 0 days, 0 hours, 0 minutes, 9.979648 seconds
Rename pin.list to pin.status

This is more consistent with other commands that show a human readable
status.
Show PWM and wakeup support in pin.status

> pin.status
Note: pin.status currently only works on Serial
---------------------------------
0   rx0     reserved        -
1   tx0     reserved        -
2   d2      input_pullup    1       supports PWM, supports wakeup, wakeup enabled
3   d3      unset           -       supports PWM
4   d4      unset           -       supports PWM, supports wakeup
5   d5      unset           -       supports PWM, supports wakeup
6   d6      unset           -
7   d7      unset           -       supports wakeup
8   d8      unset           -
9   ss      unset           -       supports wakeup
10  mosi    unset           -       supports wakeup
11  miso    unset           -       supports wakeup
12  sck     unset           -       supports wakeup
13  rx1     input_pullup    1       supports wakeup, wakeup enabled
14  tx1     unset           -       supports wakeup
15  scl     reserved        -       supports wakeup
16  sda     reserved        -       supports wakeup
17  vcc     reserved        -
18  batt    reserved        -       supports wakeup
19  bkpk    reserved        -
20  chg     reserved        -
21  ledb    reserved        -       supports PWM
22  ledr    reserved        -       supports PWM
23  ledg    reserved        -       supports PWM
24  a0      unset           -
25  a1      unset           -
26  a2      unset           -
27  a3      unset           -
28  a4      unset           -
29  a5      unset           -
30  a6      unset           -
31  a7      unset           -
Rename sleep to powerSleep (in C++)

This is more consistent with the other function names.
Let Shell.defined take a const char*

Inside, it still needs to be cast back to char* since bitlash is not
const-correct, but now at least our code is ok.
Stop supporting a full command as callback to power.sleep

Before, you could pass a full bitlash command as the callback for
power.sleep. In preparation of passing arguments to the callback, this
support is removed and only a plain function name can be passed now.

This commit only adds a single check and renames variables, it does not
otherwise modify any behaviour.
Don't do Scout.something inside the PinoccioScout class
Replace SleepHandler::pastScheduledEnd() by scheduledTicksLeft()

This returns the number of ticks left for sleeping. If it returns 0,
we're at or past the end of the sleep period, so it can still be used
wherever pastScheduledEnd() was used. This prepares for more changes in
the sleep handling next, but should not actually change behaviour.
Slightly restructure sleep handling in case the sleep time already passed

The scheduledTicksLeft method was now potentically called twice in short
succession. However, since it involves some 32-bit arithmetic, it's
better to just pass the "are we past the end" conclusion on into
doSleep, to prevent having to call it twice.
Pass the scheduled and remaining sleep time to the callback

This allows the callback to detect wether the sleep was completed or
interrupted.
Resume interrupted sleeps when the callback returns non-zero

Previously when a sleep was interrupted, the callback was ran and the
sleep ended. This is still the default, but if the callback returns a
non-zero value, the sleeping continues (until interrupted again or
finished, the callback is ran again in either case).

Note that before doing the actual sleeping, the loop functions run at
least once, possibly longer if they create unfinished business that the
sleep code waits for.
Do not strdup(NULL)
fix master merge conflict that wasn't really one