With the new beta boards, for those users who don't need an SDCard for
their project, it would be great to allow them to use the 6 IO pins
associated with the SDCARD for other purposes. This would probably
require a cheap adapter, but these are nice signals to be able to be
used. They include:
SPI1: SCK, MISO, MOSI, CS0-2
Serail2: TX/RX
Serial4: TX/RX
I2C1: SCL/SDA
This change adds support for GPIO, SPI, Serial2 and Serial4
PulseIn may fail on LC as it is using *reg to test the value for on or
off, but on LC register is a bitmask associated with several IO pins.
So split off for LC to use the MASK value for the pin to test high and
low.
Warning did not update timings for this, which may be necessary as adds
an & in the loop. However when I tried TLC for 5000us timeout, it timed
out with 5138us, if I decremented the PULSEIN_LOOPS_PER_USEC by one,
then it timed out at 4398... This was at 49mhz.
In case the desired frequency is too low to be obtained with F_TIMER
because prescale and mod were at their limits, switch automatically to
the alternative clock source (31250Hz) before determining prescale and
mod with the same algorithm as before.