Decoupled mpu6050 acc and gyro detection code.
This commit cleans up the #ifdef/#ifndef code which, due to the amount
of targets and variants, was starting to get a bit out of hand.
Now each acc & gyro is assumed to be used unless the respective
USE_ACC_* and USE_GYRO_* is #undef'd at the top of the file by a
particular target.
This commit also cleans up the mess of re-running all the mpu6050
detection code twice. Now the acc specific communication code is only
run once and only code that is actually needed to be run twice is run
twice, and the rest of the code is now only used once. This will
improve board startup time, albeit negligibly.
Sensor alignment is only known for the NAZE target so now the alignment
will be ALIGN_DEFAULT for all targets other than NAZE unless they are
known.
Finally, in the Makefile a file was included twice in the source list
for the STM32F3DISCOVERY target and now additional sensors are supported
for users that may want to try them on that board.
By decoupling everything the structures now only contain members they need. The mapping code is simplified. The calculation of timer periods is now where it belongs (with the output code, not with the mapping code). Also, since each motor output has it's own callback method it is technically possible to mix brushed and brushless motors if the brushed motors and brushless motors use different timers. Additional code would be required to fully support that.
Since it uses DMA to receive it means that serialRx is broken because
the RX callback function is only used when DMA is NOT used.
Currently only serialRx uses USART callbacks.
Attempting to disable RX DMA didn't work, the USART2 IRQ handler is
never called.
TIM8 correctly. Software serial conficted with parallel PWM input. Fixed
crash due to incorrect timerConfig index calculation code.
The crash occurred when capture compare interrupt handlers attempted to
call an invalid callback.
Note: the crash does not affect existing baseflight code since the
formula is OK when using a 2 dimensional array with equal dimensions.
Formula details here:
https://docs.google.com/spreadsheets/d/1UuxnC0VKiprvt1wt3KXffefEWJUb_-ILFLQuP377Anw
The STM32F3DISCOVERY board would crash when setting GPIOA Pin_13 or
Pin_14 to analog mode so they are excluded in the gpio initialisation.
The USART GPIO configuration did not work when using the F10x code. The
USART status and DMA registers are different too.