Fix missing ADC4 dma mapping for F3.
commit5fbb0674c505d88fe49d4e8fc074e08ae6b25557
authorDominic Clifton <dominic.clifton@cleanflight.com>
Wed, 28 Aug 2019 20:58:24 +0000 (28 22:58 +0200)
committermikeller <github@ike.ch>
Mon, 21 Oct 2019 07:10:50 +0000 (21 20:10 +1300)
tree4cdb2e3923e6dc19a57e391814223dfef2bd2fc3
parent692bf9c56eb70ae2a2b8940df8c25a396af48107
Fix missing ADC4 dma mapping for F3.

Fix incorrect count of dma options for F3.

Value was hardcoded to 3, but the F3 has 4 ADCs.

Fix dmaPeripheralMapping for F3.

The dmaPeripheralMapping table was using index numbers and not device
numbers.

This meant all the dma mappings were out by one, eg.

```

```

ADC 1 is on DMA1, channel 1, but the output from dma ADC 2 list shows
the possibilities for ADC 1, not ADC 2 and shows no possibilities for
dma ADC 1 list

Ensure there are defaults for ADC4 on F3.

Always use 4 ADC instances for the ADC PG.

* PG should not be target dependant.
* Add a static assert which will fail if anything is changed.

Fix dmaopt in ADC PG, it should be a int8_t, not uint8_t

Fix occurrences of -1 that should be `DMA_OPT_UNUSED`.

Fixing this meant that dma_reqmap.h needed to be included in a few
places.  When this was done there were errors because dma_reqmap.h was
included more than once and it's `#pragma once` was commented out.

Including dma_reqmap.h from every PG that uses `dmaopt` also caused
other compilation issues, fixed by this commit.
src/main/drivers/dma_reqmap.c
src/main/drivers/dma_reqmap.h
src/main/drivers/timer.h
src/main/pg/adc.c
src/main/pg/adc.h
src/main/pg/bus_spi.h
src/main/pg/sdio.h
src/main/pg/serial_uart.h
src/main/pg/timerio.h
src/main/pg/timerup.h
src/main/target/common_defaults_post.h