TELEMETRY_MOD=14051 (by gerardv @ forum.turnigy9xr.com) makes USART0 available
by reallocating AIL and THR onto pins 14 and 15 of the 14051 multiplexer.
TELEMETRY_MOD=14051_SWAPPED is based on TELEMETRY_MOD=14051, but uses USART1
instead of USART0, freeing USART0 for other purposes (debugging, interfacing
via AVRISP port). USART1 is freed up by reallocating LVert Trim Dn/Up onto
14051's 12 and 1 pins respectively.
Additionally, this commit cleans a few things up:
* moves AVR ADC-related code to adc_driver.cpp,
* provides #defines to have a convenient way to access either USART0 or USART1
registers depending on static (build-time) configuration
* moves code related to this telemetry mod to board_stock
* replaces a few magic numbers with enums.
Thanks to Bernard Songis for review and suggestions!
* when telemetry is not streaming all logical switches that involve telemetry value evaluate to FALSE (same as before the change in above commit)
* the duration and delay processing is now enabled for such logical switches (new functionality that was not present before above commit)
* logical switches reset not called anymore when user selects "Reset Flight", but only after model load
* logical switches reset now includes a reset of switches state (set to false)
Timing for delay and duration is not as accurate as before, max error possible is +-100ms.
Worst case example: duration set at 0.1s will produce output pulse of width between 10ms (min mixer loop time) and 200ms.
But RAM saving is BIG, unfortunately only on ARM.
* order of logical switches calculaton now predicable: always from L1 to L64
* each flight mode has its own logical switches context (RAM usage multiplied by number of flight modes)
* resolved problem of non-reentrancy of getSwitch() function