1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-12 19:10:32 +03:00

PICO: IO tag changes, updated pins.

This commit is contained in:
Matthew Selby 2025-05-28 16:31:39 +01:00
parent 7969451f7c
commit 9c8543ac35
7 changed files with 474 additions and 386 deletions

View file

@ -60,33 +60,33 @@ const spiHardware_t spiHardware[] = {
.device = SPIDEV_0,
.reg = SPI0,
.sckPins = {
{ DEFIO_TAG_E(P2) },
{ DEFIO_TAG_E(P6) },
{ DEFIO_TAG_E(P18) },
{ DEFIO_TAG_E(P22) },
{ DEFIO_TAG_E(PA2) },
{ DEFIO_TAG_E(PA6) },
{ DEFIO_TAG_E(PA18) },
{ DEFIO_TAG_E(PA22) },
#ifdef RP2350B
{ DEFIO_TAG_E(P34) },
{ DEFIO_TAG_E(P38) },
{ DEFIO_TAG_E(PA34) },
{ DEFIO_TAG_E(PA38) },
#endif
},
.misoPins = {
{ DEFIO_TAG_E(P0) },
{ DEFIO_TAG_E(P4) },
{ DEFIO_TAG_E(P16) },
{ DEFIO_TAG_E(P20) },
{ DEFIO_TAG_E(PA0) },
{ DEFIO_TAG_E(PA4) },
{ DEFIO_TAG_E(PA16) },
{ DEFIO_TAG_E(PA20) },
#ifdef RP2350B
{ DEFIO_TAG_E(P32) },
{ DEFIO_TAG_E(P36) },
{ DEFIO_TAG_E(PA32) },
{ DEFIO_TAG_E(PA36) },
#endif
},
.mosiPins = {
{ DEFIO_TAG_E(P3) },
{ DEFIO_TAG_E(P7) },
{ DEFIO_TAG_E(P19) },
{ DEFIO_TAG_E(P23) },
{ DEFIO_TAG_E(PA3) },
{ DEFIO_TAG_E(PA7) },
{ DEFIO_TAG_E(PA19) },
{ DEFIO_TAG_E(PA23) },
#ifdef RP2350B
{ DEFIO_TAG_E(P35) },
{ DEFIO_TAG_E(P39) },
{ DEFIO_TAG_E(PA35) },
{ DEFIO_TAG_E(PA39) },
#endif
},
},
@ -94,33 +94,33 @@ const spiHardware_t spiHardware[] = {
.device = SPIDEV_1,
.reg = SPI1,
.sckPins = {
{ DEFIO_TAG_E(P10) },
{ DEFIO_TAG_E(P14) },
{ DEFIO_TAG_E(P26) },
{ DEFIO_TAG_E(PA10) },
{ DEFIO_TAG_E(PA14) },
{ DEFIO_TAG_E(PA26) },
#ifdef RP2350B
{ DEFIO_TAG_E(P30) },
{ DEFIO_TAG_E(P42) },
{ DEFIO_TAG_E(P46) },
{ DEFIO_TAG_E(PA30) },
{ DEFIO_TAG_E(PA42) },
{ DEFIO_TAG_E(PA46) },
#endif
},
.misoPins = {
{ DEFIO_TAG_E(P8) },
{ DEFIO_TAG_E(P12) },
{ DEFIO_TAG_E(P24) },
{ DEFIO_TAG_E(P28) },
{ DEFIO_TAG_E(PA8) },
{ DEFIO_TAG_E(PA12) },
{ DEFIO_TAG_E(PA24) },
{ DEFIO_TAG_E(PA28) },
#ifdef RP2350B
{ DEFIO_TAG_E(P40) },
{ DEFIO_TAG_E(P44) },
{ DEFIO_TAG_E(PA40) },
{ DEFIO_TAG_E(PA44) },
#endif
},
.mosiPins = {
{ DEFIO_TAG_E(P11) },
{ DEFIO_TAG_E(P15) },
{ DEFIO_TAG_E(P27) },
{ DEFIO_TAG_E(PA11) },
{ DEFIO_TAG_E(PA15) },
{ DEFIO_TAG_E(PA27) },
#ifdef RP2350B
{ DEFIO_TAG_E(P31) },
{ DEFIO_TAG_E(P43) },
{ DEFIO_TAG_E(P47) },
{ DEFIO_TAG_E(PA31) },
{ DEFIO_TAG_E(PA43) },
{ DEFIO_TAG_E(PA47) },
#endif
},
},
@ -230,6 +230,11 @@ void spiInitDevice(SPIDevice device)
return;
}
// Set owners
IOInit(IOGetByTag(spi->sck), OWNER_SPI_SCK, RESOURCE_INDEX(device));
IOInit(IOGetByTag(spi->miso), OWNER_SPI_SDI, RESOURCE_INDEX(device));
IOInit(IOGetByTag(spi->mosi), OWNER_SPI_SDO, RESOURCE_INDEX(device));
spi_init(SPI_INST(spi->dev), SPI_SPEED_20MHZ);
gpio_set_function(IO_PINBYTAG(spi->miso), GPIO_FUNC_SPI);
@ -260,6 +265,10 @@ bool spiInternalReadWriteBufPolled(SPI_TypeDef *instance, const uint8_t *txData,
// Initialise DMA before first segment transfer
void spiInternalInitStream(const extDevice_t *dev, bool preInit)
{
#ifndef USE_DMA
UNUSED(dev);
UNUSED(preInit);
#else
UNUSED(preInit);
int dma_tx = dma_claim_unused_channel(true);
@ -282,17 +291,22 @@ void spiInternalInitStream(const extDevice_t *dev, bool preInit)
channel_config_set_dreq(&config, spi_get_dreq(SPI_INST(spi->dev), false));
dma_channel_configure(dma_rx, &config, dev->rxBuf, &spi_get_hw(SPI_INST(spi->dev))->dr, 0, false);
#endif
}
// Start DMA transfer for the current segment
void spiInternalStartDMA(const extDevice_t *dev)
{
#ifndef USE_DMA
UNUSED(dev);
#else
// TODO check correct, was len + 1 now len
dma_channel_set_trans_count(dev->bus->dmaTx->channel, dev->bus->curSegment->len, false);
dma_channel_set_trans_count(dev->bus->dmaRx->channel, dev->bus->curSegment->len, false);
dma_channel_start(dev->bus->dmaTx->channel);
dma_channel_start(dev->bus->dmaRx->channel);
#endif
}
// DMA transfer setup and start

View file

@ -32,193 +32,179 @@
#error "Unsupported target MCU type for PICO"
#endif
#undef DEFIO_TAG_MAKE
#define DEFIO_TAG_MAKE(pin) ((ioTag_t)(((1) << DEFIO_PORT_BITSHIFT) | (pin)))
// GPIOID for potential different banks ("ports") of GPIO pins - for RP2350 there's only one
#undef DEFIO_TAG_GPIOID
#define DEFIO_TAG_GPIOID(tag) (((tag) >> DEFIO_PORT_BITSHIFT) - 1)
#undef DEFIO_TAG_PIN
#define DEFIO_TAG_PIN(tag) ((tag) & DEFIO_PIN_BITMASK)
// DEFIO_TAG__P<port><pin> will expand to TAG if defined for target, error is triggered otherwise
// DEFIO_TAG_E__P<port><pin> will expand to TAG if defined, to NONE otherwise (usefull for tables that are CPU-specific)
// DEFIO_REC__P<port><pin> will expand to ioRec* (using DEFIO_REC_INDEX(idx))
#define DEFIO_TAG__P0 DEFIO_TAG_MAKE(0)
#define DEFIO_TAG__P1 DEFIO_TAG_MAKE(1)
#define DEFIO_TAG__P2 DEFIO_TAG_MAKE(2)
#define DEFIO_TAG__P3 DEFIO_TAG_MAKE(3)
#define DEFIO_TAG__P4 DEFIO_TAG_MAKE(4)
#define DEFIO_TAG__P5 DEFIO_TAG_MAKE(5)
#define DEFIO_TAG__P6 DEFIO_TAG_MAKE(6)
#define DEFIO_TAG__P7 DEFIO_TAG_MAKE(7)
#define DEFIO_TAG__P8 DEFIO_TAG_MAKE(8)
#define DEFIO_TAG__P9 DEFIO_TAG_MAKE(9)
#define DEFIO_TAG__P10 DEFIO_TAG_MAKE(10)
#define DEFIO_TAG__P11 DEFIO_TAG_MAKE(11)
#define DEFIO_TAG__P12 DEFIO_TAG_MAKE(12)
#define DEFIO_TAG__P13 DEFIO_TAG_MAKE(13)
#define DEFIO_TAG__P14 DEFIO_TAG_MAKE(14)
#define DEFIO_TAG__P15 DEFIO_TAG_MAKE(15)
#define DEFIO_TAG__P16 DEFIO_TAG_MAKE(16)
#define DEFIO_TAG__P17 DEFIO_TAG_MAKE(17)
#define DEFIO_TAG__P18 DEFIO_TAG_MAKE(18)
#define DEFIO_TAG__P19 DEFIO_TAG_MAKE(19)
#define DEFIO_TAG__P20 DEFIO_TAG_MAKE(20)
#define DEFIO_TAG__P21 DEFIO_TAG_MAKE(21)
#define DEFIO_TAG__P22 DEFIO_TAG_MAKE(22)
#define DEFIO_TAG__P23 DEFIO_TAG_MAKE(23)
#define DEFIO_TAG__P24 DEFIO_TAG_MAKE(24)
#define DEFIO_TAG__P25 DEFIO_TAG_MAKE(25)
#define DEFIO_TAG__P26 DEFIO_TAG_MAKE(26)
#define DEFIO_TAG__P27 DEFIO_TAG_MAKE(27)
#define DEFIO_TAG__P28 DEFIO_TAG_MAKE(28)
#define DEFIO_TAG__P29 DEFIO_TAG_MAKE(29)
#define DEFIO_TAG__PA0 DEFIO_TAG_MAKE(0,0)
#define DEFIO_TAG__PA1 DEFIO_TAG_MAKE(0,1)
#define DEFIO_TAG__PA2 DEFIO_TAG_MAKE(0,2)
#define DEFIO_TAG__PA3 DEFIO_TAG_MAKE(0,3)
#define DEFIO_TAG__PA4 DEFIO_TAG_MAKE(0,4)
#define DEFIO_TAG__PA5 DEFIO_TAG_MAKE(0,5)
#define DEFIO_TAG__PA6 DEFIO_TAG_MAKE(0,6)
#define DEFIO_TAG__PA7 DEFIO_TAG_MAKE(0,7)
#define DEFIO_TAG__PA8 DEFIO_TAG_MAKE(0,8)
#define DEFIO_TAG__PA9 DEFIO_TAG_MAKE(0,9)
#define DEFIO_TAG__PA10 DEFIO_TAG_MAKE(0,10)
#define DEFIO_TAG__PA11 DEFIO_TAG_MAKE(0,11)
#define DEFIO_TAG__PA12 DEFIO_TAG_MAKE(0,12)
#define DEFIO_TAG__PA13 DEFIO_TAG_MAKE(0,13)
#define DEFIO_TAG__PA14 DEFIO_TAG_MAKE(0,14)
#define DEFIO_TAG__PA15 DEFIO_TAG_MAKE(0,15)
#define DEFIO_TAG__PA16 DEFIO_TAG_MAKE(0,16)
#define DEFIO_TAG__PA17 DEFIO_TAG_MAKE(0,17)
#define DEFIO_TAG__PA18 DEFIO_TAG_MAKE(0,18)
#define DEFIO_TAG__PA19 DEFIO_TAG_MAKE(0,19)
#define DEFIO_TAG__PA20 DEFIO_TAG_MAKE(0,20)
#define DEFIO_TAG__PA21 DEFIO_TAG_MAKE(0,21)
#define DEFIO_TAG__PA22 DEFIO_TAG_MAKE(0,22)
#define DEFIO_TAG__PA23 DEFIO_TAG_MAKE(0,23)
#define DEFIO_TAG__PA24 DEFIO_TAG_MAKE(0,24)
#define DEFIO_TAG__PA25 DEFIO_TAG_MAKE(0,25)
#define DEFIO_TAG__PA26 DEFIO_TAG_MAKE(0,26)
#define DEFIO_TAG__PA27 DEFIO_TAG_MAKE(0,27)
#define DEFIO_TAG__PA28 DEFIO_TAG_MAKE(0,28)
#define DEFIO_TAG__PA29 DEFIO_TAG_MAKE(0,29)
#if defined(RP2350B)
#define DEFIO_TAG__P30 DEFIO_TAG_MAKE(30)
#define DEFIO_TAG__P31 DEFIO_TAG_MAKE(31)
#define DEFIO_TAG__P32 DEFIO_TAG_MAKE(32)
#define DEFIO_TAG__P33 DEFIO_TAG_MAKE(33)
#define DEFIO_TAG__P34 DEFIO_TAG_MAKE(34)
#define DEFIO_TAG__P35 DEFIO_TAG_MAKE(35)
#define DEFIO_TAG__P36 DEFIO_TAG_MAKE(36)
#define DEFIO_TAG__P37 DEFIO_TAG_MAKE(37)
#define DEFIO_TAG__P38 DEFIO_TAG_MAKE(38)
#define DEFIO_TAG__P39 DEFIO_TAG_MAKE(39)
#define DEFIO_TAG__P40 DEFIO_TAG_MAKE(40)
#define DEFIO_TAG__P41 DEFIO_TAG_MAKE(41)
#define DEFIO_TAG__P42 DEFIO_TAG_MAKE(42)
#define DEFIO_TAG__P43 DEFIO_TAG_MAKE(43)
#define DEFIO_TAG__P44 DEFIO_TAG_MAKE(44)
#define DEFIO_TAG__P45 DEFIO_TAG_MAKE(45)
#define DEFIO_TAG__P46 DEFIO_TAG_MAKE(46)
#define DEFIO_TAG__P47 DEFIO_TAG_MAKE(47)
#define DEFIO_TAG__PA30 DEFIO_TAG_MAKE(0,30)
#define DEFIO_TAG__PA31 DEFIO_TAG_MAKE(0,31)
#define DEFIO_TAG__PA32 DEFIO_TAG_MAKE(0,32)
#define DEFIO_TAG__PA33 DEFIO_TAG_MAKE(0,33)
#define DEFIO_TAG__PA34 DEFIO_TAG_MAKE(0,34)
#define DEFIO_TAG__PA35 DEFIO_TAG_MAKE(0,35)
#define DEFIO_TAG__PA36 DEFIO_TAG_MAKE(0,36)
#define DEFIO_TAG__PA37 DEFIO_TAG_MAKE(0,37)
#define DEFIO_TAG__PA38 DEFIO_TAG_MAKE(0,38)
#define DEFIO_TAG__PA39 DEFIO_TAG_MAKE(0,39)
#define DEFIO_TAG__PA40 DEFIO_TAG_MAKE(0,40)
#define DEFIO_TAG__PA41 DEFIO_TAG_MAKE(0,41)
#define DEFIO_TAG__PA42 DEFIO_TAG_MAKE(0,42)
#define DEFIO_TAG__PA43 DEFIO_TAG_MAKE(0,43)
#define DEFIO_TAG__PA44 DEFIO_TAG_MAKE(0,44)
#define DEFIO_TAG__PA45 DEFIO_TAG_MAKE(0,45)
#define DEFIO_TAG__PA46 DEFIO_TAG_MAKE(0,46)
#define DEFIO_TAG__PA47 DEFIO_TAG_MAKE(0,47)
#endif
#define DEFIO_TAG_E__P0 DEFIO_TAG__P0
#define DEFIO_TAG_E__P1 DEFIO_TAG__P1
#define DEFIO_TAG_E__P2 DEFIO_TAG__P2
#define DEFIO_TAG_E__P3 DEFIO_TAG__P3
#define DEFIO_TAG_E__P4 DEFIO_TAG__P4
#define DEFIO_TAG_E__P5 DEFIO_TAG__P5
#define DEFIO_TAG_E__P6 DEFIO_TAG__P6
#define DEFIO_TAG_E__P7 DEFIO_TAG__P7
#define DEFIO_TAG_E__P8 DEFIO_TAG__P8
#define DEFIO_TAG_E__P9 DEFIO_TAG__P9
#define DEFIO_TAG_E__P10 DEFIO_TAG__P10
#define DEFIO_TAG_E__P11 DEFIO_TAG__P11
#define DEFIO_TAG_E__P12 DEFIO_TAG__P12
#define DEFIO_TAG_E__P13 DEFIO_TAG__P13
#define DEFIO_TAG_E__P14 DEFIO_TAG__P14
#define DEFIO_TAG_E__P15 DEFIO_TAG__P15
#define DEFIO_TAG_E__P16 DEFIO_TAG__P16
#define DEFIO_TAG_E__P17 DEFIO_TAG__P17
#define DEFIO_TAG_E__P18 DEFIO_TAG__P18
#define DEFIO_TAG_E__P19 DEFIO_TAG__P19
#define DEFIO_TAG_E__P20 DEFIO_TAG__P20
#define DEFIO_TAG_E__P21 DEFIO_TAG__P21
#define DEFIO_TAG_E__P22 DEFIO_TAG__P22
#define DEFIO_TAG_E__P23 DEFIO_TAG__P23
#define DEFIO_TAG_E__P24 DEFIO_TAG__P24
#define DEFIO_TAG_E__P25 DEFIO_TAG__P25
#define DEFIO_TAG_E__P26 DEFIO_TAG__P26
#define DEFIO_TAG_E__P27 DEFIO_TAG__P27
#define DEFIO_TAG_E__P28 DEFIO_TAG__P28
#define DEFIO_TAG_E__P29 DEFIO_TAG__P29
#define DEFIO_TAG_E__PA0 DEFIO_TAG__PA0
#define DEFIO_TAG_E__PA1 DEFIO_TAG__PA1
#define DEFIO_TAG_E__PA2 DEFIO_TAG__PA2
#define DEFIO_TAG_E__PA3 DEFIO_TAG__PA3
#define DEFIO_TAG_E__PA4 DEFIO_TAG__PA4
#define DEFIO_TAG_E__PA5 DEFIO_TAG__PA5
#define DEFIO_TAG_E__PA6 DEFIO_TAG__PA6
#define DEFIO_TAG_E__PA7 DEFIO_TAG__PA7
#define DEFIO_TAG_E__PA8 DEFIO_TAG__PA8
#define DEFIO_TAG_E__PA9 DEFIO_TAG__PA9
#define DEFIO_TAG_E__PA10 DEFIO_TAG__PA10
#define DEFIO_TAG_E__PA11 DEFIO_TAG__PA11
#define DEFIO_TAG_E__PA12 DEFIO_TAG__PA12
#define DEFIO_TAG_E__PA13 DEFIO_TAG__PA13
#define DEFIO_TAG_E__PA14 DEFIO_TAG__PA14
#define DEFIO_TAG_E__PA15 DEFIO_TAG__PA15
#define DEFIO_TAG_E__PA16 DEFIO_TAG__PA16
#define DEFIO_TAG_E__PA17 DEFIO_TAG__PA17
#define DEFIO_TAG_E__PA18 DEFIO_TAG__PA18
#define DEFIO_TAG_E__PA19 DEFIO_TAG__PA19
#define DEFIO_TAG_E__PA20 DEFIO_TAG__PA20
#define DEFIO_TAG_E__PA21 DEFIO_TAG__PA21
#define DEFIO_TAG_E__PA22 DEFIO_TAG__PA22
#define DEFIO_TAG_E__PA23 DEFIO_TAG__PA23
#define DEFIO_TAG_E__PA24 DEFIO_TAG__PA24
#define DEFIO_TAG_E__PA25 DEFIO_TAG__PA25
#define DEFIO_TAG_E__PA26 DEFIO_TAG__PA26
#define DEFIO_TAG_E__PA27 DEFIO_TAG__PA27
#define DEFIO_TAG_E__PA28 DEFIO_TAG__PA28
#define DEFIO_TAG_E__PA29 DEFIO_TAG__PA29
#if defined(RP2350B)
#define DEFIO_TAG_E__P30 DEFIO_TAG__P30
#define DEFIO_TAG_E__P31 DEFIO_TAG__P31
#define DEFIO_TAG_E__P32 DEFIO_TAG__P32
#define DEFIO_TAG_E__P33 DEFIO_TAG__P33
#define DEFIO_TAG_E__P34 DEFIO_TAG__P34
#define DEFIO_TAG_E__P35 DEFIO_TAG__P35
#define DEFIO_TAG_E__P36 DEFIO_TAG__P36
#define DEFIO_TAG_E__P37 DEFIO_TAG__P37
#define DEFIO_TAG_E__P38 DEFIO_TAG__P38
#define DEFIO_TAG_E__P39 DEFIO_TAG__P39
#define DEFIO_TAG_E__P40 DEFIO_TAG__P40
#define DEFIO_TAG_E__P41 DEFIO_TAG__P41
#define DEFIO_TAG_E__P42 DEFIO_TAG__P42
#define DEFIO_TAG_E__P43 DEFIO_TAG__P43
#define DEFIO_TAG_E__P44 DEFIO_TAG__P44
#define DEFIO_TAG_E__P45 DEFIO_TAG__P45
#define DEFIO_TAG_E__P46 DEFIO_TAG__P46
#define DEFIO_TAG_E__P47 DEFIO_TAG__P47
#define DEFIO_TAG_E__PA30 DEFIO_TAG__PA30
#define DEFIO_TAG_E__PA31 DEFIO_TAG__PA31
#define DEFIO_TAG_E__PA32 DEFIO_TAG__PA32
#define DEFIO_TAG_E__PA33 DEFIO_TAG__PA33
#define DEFIO_TAG_E__PA34 DEFIO_TAG__PA34
#define DEFIO_TAG_E__PA35 DEFIO_TAG__PA35
#define DEFIO_TAG_E__PA36 DEFIO_TAG__PA36
#define DEFIO_TAG_E__PA37 DEFIO_TAG__PA37
#define DEFIO_TAG_E__PA38 DEFIO_TAG__PA38
#define DEFIO_TAG_E__PA39 DEFIO_TAG__PA39
#define DEFIO_TAG_E__PA40 DEFIO_TAG__PA40
#define DEFIO_TAG_E__PA41 DEFIO_TAG__PA41
#define DEFIO_TAG_E__PA42 DEFIO_TAG__PA42
#define DEFIO_TAG_E__PA43 DEFIO_TAG__PA43
#define DEFIO_TAG_E__PA44 DEFIO_TAG__PA44
#define DEFIO_TAG_E__PA45 DEFIO_TAG__PA45
#define DEFIO_TAG_E__PA46 DEFIO_TAG__PA46
#define DEFIO_TAG_E__PA47 DEFIO_TAG__PA47
#else
#define DEFIO_TAG_E__P30 DEFIO_TAG__NONE
#define DEFIO_TAG_E__P31 DEFIO_TAG__NONE
#define DEFIO_TAG_E__P32 DEFIO_TAG__NONE
#define DEFIO_TAG_E__P33 DEFIO_TAG__NONE
#define DEFIO_TAG_E__P34 DEFIO_TAG__NONE
#define DEFIO_TAG_E__P35 DEFIO_TAG__NONE
#define DEFIO_TAG_E__P36 DEFIO_TAG__NONE
#define DEFIO_TAG_E__P37 DEFIO_TAG__NONE
#define DEFIO_TAG_E__P38 DEFIO_TAG__NONE
#define DEFIO_TAG_E__P39 DEFIO_TAG__NONE
#define DEFIO_TAG_E__P40 DEFIO_TAG__NONE
#define DEFIO_TAG_E__P41 DEFIO_TAG__NONE
#define DEFIO_TAG_E__P42 DEFIO_TAG__NONE
#define DEFIO_TAG_E__P43 DEFIO_TAG__NONE
#define DEFIO_TAG_E__P44 DEFIO_TAG__NONE
#define DEFIO_TAG_E__P45 DEFIO_TAG__NONE
#define DEFIO_TAG_E__P46 DEFIO_TAG__NONE
#define DEFIO_TAG_E__P47 DEFIO_TAG__NONE
#define DEFIO_TAG_E__PA30 DEFIO_TAG__NONE
#define DEFIO_TAG_E__PA31 DEFIO_TAG__NONE
#define DEFIO_TAG_E__PA32 DEFIO_TAG__NONE
#define DEFIO_TAG_E__PA33 DEFIO_TAG__NONE
#define DEFIO_TAG_E__PA34 DEFIO_TAG__NONE
#define DEFIO_TAG_E__PA35 DEFIO_TAG__NONE
#define DEFIO_TAG_E__PA36 DEFIO_TAG__NONE
#define DEFIO_TAG_E__PA37 DEFIO_TAG__NONE
#define DEFIO_TAG_E__PA38 DEFIO_TAG__NONE
#define DEFIO_TAG_E__PA39 DEFIO_TAG__NONE
#define DEFIO_TAG_E__PA40 DEFIO_TAG__NONE
#define DEFIO_TAG_E__PA41 DEFIO_TAG__NONE
#define DEFIO_TAG_E__PA42 DEFIO_TAG__NONE
#define DEFIO_TAG_E__PA43 DEFIO_TAG__NONE
#define DEFIO_TAG_E__PA44 DEFIO_TAG__NONE
#define DEFIO_TAG_E__PA45 DEFIO_TAG__NONE
#define DEFIO_TAG_E__PA46 DEFIO_TAG__NONE
#define DEFIO_TAG_E__PA47 DEFIO_TAG__NONE
#endif
#define DEFIO_REC__P0 DEFIO_REC_INDEXED(0)
#define DEFIO_REC__P1 DEFIO_REC_INDEXED(1)
#define DEFIO_REC__P2 DEFIO_REC_INDEXED(2)
#define DEFIO_REC__P3 DEFIO_REC_INDEXED(3)
#define DEFIO_REC__P4 DEFIO_REC_INDEXED(4)
#define DEFIO_REC__P5 DEFIO_REC_INDEXED(5)
#define DEFIO_REC__P6 DEFIO_REC_INDEXED(6)
#define DEFIO_REC__P7 DEFIO_REC_INDEXED(7)
#define DEFIO_REC__P8 DEFIO_REC_INDEXED(8)
#define DEFIO_REC__P9 DEFIO_REC_INDEXED(9)
#define DEFIO_REC__P10 DEFIO_REC_INDEXED(10)
#define DEFIO_REC__P11 DEFIO_REC_INDEXED(11)
#define DEFIO_REC__P12 DEFIO_REC_INDEXED(12)
#define DEFIO_REC__P13 DEFIO_REC_INDEXED(13)
#define DEFIO_REC__P14 DEFIO_REC_INDEXED(14)
#define DEFIO_REC__P15 DEFIO_REC_INDEXED(15)
#define DEFIO_REC__P16 DEFIO_REC_INDEXED(16)
#define DEFIO_REC__P17 DEFIO_REC_INDEXED(17)
#define DEFIO_REC__P18 DEFIO_REC_INDEXED(18)
#define DEFIO_REC__P19 DEFIO_REC_INDEXED(19)
#define DEFIO_REC__P20 DEFIO_REC_INDEXED(20)
#define DEFIO_REC__P21 DEFIO_REC_INDEXED(21)
#define DEFIO_REC__P22 DEFIO_REC_INDEXED(22)
#define DEFIO_REC__P23 DEFIO_REC_INDEXED(23)
#define DEFIO_REC__P24 DEFIO_REC_INDEXED(24)
#define DEFIO_REC__P25 DEFIO_REC_INDEXED(25)
#define DEFIO_REC__P26 DEFIO_REC_INDEXED(26)
#define DEFIO_REC__P27 DEFIO_REC_INDEXED(27)
#define DEFIO_REC__P28 DEFIO_REC_INDEXED(28)
#define DEFIO_REC__P29 DEFIO_REC_INDEXED(29)
#define DEFIO_REC__PA0 DEFIO_REC_INDEXED(0)
#define DEFIO_REC__PA1 DEFIO_REC_INDEXED(1)
#define DEFIO_REC__PA2 DEFIO_REC_INDEXED(2)
#define DEFIO_REC__PA3 DEFIO_REC_INDEXED(3)
#define DEFIO_REC__PA4 DEFIO_REC_INDEXED(4)
#define DEFIO_REC__PA5 DEFIO_REC_INDEXED(5)
#define DEFIO_REC__PA6 DEFIO_REC_INDEXED(6)
#define DEFIO_REC__PA7 DEFIO_REC_INDEXED(7)
#define DEFIO_REC__PA8 DEFIO_REC_INDEXED(8)
#define DEFIO_REC__PA9 DEFIO_REC_INDEXED(9)
#define DEFIO_REC__PA10 DEFIO_REC_INDEXED(10)
#define DEFIO_REC__PA11 DEFIO_REC_INDEXED(11)
#define DEFIO_REC__PA12 DEFIO_REC_INDEXED(12)
#define DEFIO_REC__PA13 DEFIO_REC_INDEXED(13)
#define DEFIO_REC__PA14 DEFIO_REC_INDEXED(14)
#define DEFIO_REC__PA15 DEFIO_REC_INDEXED(15)
#define DEFIO_REC__PA16 DEFIO_REC_INDEXED(16)
#define DEFIO_REC__PA17 DEFIO_REC_INDEXED(17)
#define DEFIO_REC__PA18 DEFIO_REC_INDEXED(18)
#define DEFIO_REC__PA19 DEFIO_REC_INDEXED(19)
#define DEFIO_REC__PA20 DEFIO_REC_INDEXED(20)
#define DEFIO_REC__PA21 DEFIO_REC_INDEXED(21)
#define DEFIO_REC__PA22 DEFIO_REC_INDEXED(22)
#define DEFIO_REC__PA23 DEFIO_REC_INDEXED(23)
#define DEFIO_REC__PA24 DEFIO_REC_INDEXED(24)
#define DEFIO_REC__PA25 DEFIO_REC_INDEXED(25)
#define DEFIO_REC__PA26 DEFIO_REC_INDEXED(26)
#define DEFIO_REC__PA27 DEFIO_REC_INDEXED(27)
#define DEFIO_REC__PA28 DEFIO_REC_INDEXED(28)
#define DEFIO_REC__PA29 DEFIO_REC_INDEXED(29)
#if defined(RP2350B)
#define DEFIO_REC__P30 DEFIO_REC_INDEXED(30)
#define DEFIO_REC__P31 DEFIO_REC_INDEXED(31)
#define DEFIO_REC__P32 DEFIO_REC_INDEXED(32)
#define DEFIO_REC__P33 DEFIO_REC_INDEXED(33)
#define DEFIO_REC__P34 DEFIO_REC_INDEXED(34)
#define DEFIO_REC__P35 DEFIO_REC_INDEXED(35)
#define DEFIO_REC__P36 DEFIO_REC_INDEXED(36)
#define DEFIO_REC__P37 DEFIO_REC_INDEXED(37)
#define DEFIO_REC__P38 DEFIO_REC_INDEXED(38)
#define DEFIO_REC__P39 DEFIO_REC_INDEXED(39)
#define DEFIO_REC__P40 DEFIO_REC_INDEXED(40)
#define DEFIO_REC__P41 DEFIO_REC_INDEXED(41)
#define DEFIO_REC__P42 DEFIO_REC_INDEXED(42)
#define DEFIO_REC__P43 DEFIO_REC_INDEXED(43)
#define DEFIO_REC__P44 DEFIO_REC_INDEXED(44)
#define DEFIO_REC__P45 DEFIO_REC_INDEXED(45)
#define DEFIO_REC__P46 DEFIO_REC_INDEXED(46)
#define DEFIO_REC__P47 DEFIO_REC_INDEXED(47)
#define DEFIO_REC__PA30 DEFIO_REC_INDEXED(30)
#define DEFIO_REC__PA31 DEFIO_REC_INDEXED(31)
#define DEFIO_REC__PA32 DEFIO_REC_INDEXED(32)
#define DEFIO_REC__PA33 DEFIO_REC_INDEXED(33)
#define DEFIO_REC__PA34 DEFIO_REC_INDEXED(34)
#define DEFIO_REC__PA35 DEFIO_REC_INDEXED(35)
#define DEFIO_REC__PA36 DEFIO_REC_INDEXED(36)
#define DEFIO_REC__PA37 DEFIO_REC_INDEXED(37)
#define DEFIO_REC__PA38 DEFIO_REC_INDEXED(38)
#define DEFIO_REC__PA39 DEFIO_REC_INDEXED(39)
#define DEFIO_REC__PA40 DEFIO_REC_INDEXED(40)
#define DEFIO_REC__PA41 DEFIO_REC_INDEXED(41)
#define DEFIO_REC__PA42 DEFIO_REC_INDEXED(42)
#define DEFIO_REC__PA43 DEFIO_REC_INDEXED(43)
#define DEFIO_REC__PA44 DEFIO_REC_INDEXED(44)
#define DEFIO_REC__PA45 DEFIO_REC_INDEXED(45)
#define DEFIO_REC__PA46 DEFIO_REC_INDEXED(46)
#define DEFIO_REC__PA47 DEFIO_REC_INDEXED(47)
#endif
// DEFIO_IO_USED_COUNT is number of io pins supported on target
@ -231,6 +217,7 @@
// DEFIO_PORT_USED_LIST - comma separated list of bitmask for all used ports.
// DEFIO_PORT_OFFSET_LIST - comma separated list of port offsets (count of pins before this port)
// unused ports on end of list are skipped
// NB the following are not required in src/main
#define DEFIO_PORT_USED_COUNT 1
#define DEFIO_PORT_USED_LIST
#define DEFIO_PORT_OFFSET_LIST 0

View file

@ -27,8 +27,12 @@
#include "common/utils.h"
#include "hardware/gpio.h"
// initialize all ioRec_t structures from ROM
// currently only bitmask is used, this may change in future
#if DEFIO_PORT_USED_COUNT > 1
#error PICO code currently based on a single io port
#endif
// Initialize all ioRec_t structures.
// PICO (single port) doesn't use the gpio field.
void IOInitGlobal(void)
{
ioRec_t *ioRec = ioRecs;
@ -37,6 +41,15 @@ void IOInitGlobal(void)
ioRec->pin = pin;
ioRec++;
}
#ifdef PICO_TRACE
#ifdef PICO_DEFAULT_UART_TX_PIN
ioRecs[PICO_DEFAULT_UART_TX_PIN].owner = OWNER_SYSTEM;
#endif
#ifdef PICO_DEFAULT_UART_RX_PIN
ioRecs[PICO_DEFAULT_UART_RX_PIN].owner = OWNER_SYSTEM;
#endif
#endif
}
uint32_t IO_EXTI_Line(IO_t io)
@ -105,7 +118,9 @@ SPI_IO_CS_HIGH_CFG (as defined)
}
uint16_t ioPin = IO_Pin(io);
if (gpio_get_function(ioPin) == GPIO_FUNC_NULL) {
gpio_init(ioPin);
}
gpio_set_dir(ioPin, (cfg & 0x01)); // 0 = in, 1 = out
}
@ -124,3 +139,30 @@ IO_t IOGetByTag(ioTag_t tag)
return &ioRecs[pinIdx];
}
int IO_GPIOPortIdx(IO_t io)
{
if (!io) {
return -1;
}
return 0; // Single port
}
int IO_GPIO_PortSource(IO_t io)
{
return IO_GPIOPortIdx(io);
}
// zero based pin index
int IO_GPIOPinIdx(IO_t io)
{
if (!io) {
return -1;
}
return IO_Pin(io);
}
int IO_GPIO_PinSource(IO_t io)
{
return IO_GPIOPinIdx(io);
}

View file

@ -29,6 +29,9 @@
#include "hardware/dma.h"
#include "hardware/flash.h"
// Allow for single port, up to 128 GPIO pins, in ioTag_t.
#define DEFIO_PORT_PINS 128
#define NVIC_PriorityGroup_2 0x500
#define PLATFORM_NO_LIBC 0
#define DEFIO_PORT_PINS 64
@ -75,7 +78,15 @@ typedef enum {DISABLE = 0, ENABLE = !DISABLE} FunctionalState;
#define FAST_IRQ_HANDLER
#define DEFAULT_CPU_OVERCLOCK 0
#ifdef TEST_SLOW_SCHEDULE
// (testing) allow time for more / all tasks
#define TASK_GYROPID_DESIRED_PERIOD 30000 // 1000 // 50000 // 125 // 125us = 8kHz
#else
#define TASK_GYROPID_DESIRED_PERIOD 125 // 125us = 8kHz
#endif
#define SCHEDULER_DELAY_LIMIT 10
#define IO_CONFIG(mode, speed, pupd) ((mode) | ((speed) << 2) | ((pupd) << 5))
@ -94,7 +105,7 @@ typedef enum {DISABLE = 0, ENABLE = !DISABLE} FunctionalState;
#define SPI_IO_AF_SCK_CFG_HIGH 0
#define SPI_IO_AF_SCK_CFG_LOW 0
#define SPI_IO_AF_SDI_CFG 0
#define SPI_IO_CS_CFG 0
#define SPI_IO_CS_CFG IO_CONFIG(GPIO_OUT, 0, 0) // todo pullup/down etc.
#define SERIAL_UART_FIRST_INDEX 0

View file

@ -45,35 +45,35 @@ const uartHardware_t uartHardware[UARTDEV_COUNT] = {
.identifier = SERIAL_PORT_UART0,
.reg = uart0,
.rxPins = {
{ DEFIO_TAG_E(P1) },
{ DEFIO_TAG_E(P3) },
{ DEFIO_TAG_E(P13) },
{ DEFIO_TAG_E(P15) },
{ DEFIO_TAG_E(P17) },
{ DEFIO_TAG_E(P19) },
{ DEFIO_TAG_E(P29) },
{ DEFIO_TAG_E(PA1) },
{ DEFIO_TAG_E(PA3) },
{ DEFIO_TAG_E(PA13) },
{ DEFIO_TAG_E(PA15) },
{ DEFIO_TAG_E(PA17) },
{ DEFIO_TAG_E(PA19) },
{ DEFIO_TAG_E(PA29) },
#ifdef RP2350B
{ DEFIO_TAG_E(P31) },
{ DEFIO_TAG_E(P33) },
{ DEFIO_TAG_E(P35) },
{ DEFIO_TAG_E(P45) },
{ DEFIO_TAG_E(P47) },
{ DEFIO_TAG_E(PA31) },
{ DEFIO_TAG_E(PA33) },
{ DEFIO_TAG_E(PA35) },
{ DEFIO_TAG_E(PA45) },
{ DEFIO_TAG_E(PA47) },
#endif
},
.txPins = {
{ DEFIO_TAG_E(P0) },
{ DEFIO_TAG_E(P2) },
{ DEFIO_TAG_E(P12) },
{ DEFIO_TAG_E(P14) },
{ DEFIO_TAG_E(P16) },
{ DEFIO_TAG_E(P18) },
{ DEFIO_TAG_E(P28) },
{ DEFIO_TAG_E(PA0) },
{ DEFIO_TAG_E(PA2) },
{ DEFIO_TAG_E(PA12) },
{ DEFIO_TAG_E(PA14) },
{ DEFIO_TAG_E(PA16) },
{ DEFIO_TAG_E(PA18) },
{ DEFIO_TAG_E(PA28) },
#ifdef RP2350B
{ DEFIO_TAG_E(P30) },
{ DEFIO_TAG_E(P32) },
{ DEFIO_TAG_E(P34) },
{ DEFIO_TAG_E(P44) },
{ DEFIO_TAG_E(P46) },
{ DEFIO_TAG_E(PA30) },
{ DEFIO_TAG_E(PA32) },
{ DEFIO_TAG_E(PA34) },
{ DEFIO_TAG_E(PA44) },
{ DEFIO_TAG_E(PA46) },
#endif
},
.irqn = UART0_IRQ,
@ -89,35 +89,35 @@ const uartHardware_t uartHardware[UARTDEV_COUNT] = {
.identifier = SERIAL_PORT_UART1,
.reg = uart1,
.rxPins = {
{ DEFIO_TAG_E(P5) },
{ DEFIO_TAG_E(P7) },
{ DEFIO_TAG_E(P9) },
{ DEFIO_TAG_E(P11) },
{ DEFIO_TAG_E(P21) },
{ DEFIO_TAG_E(P23) },
{ DEFIO_TAG_E(P25) },
{ DEFIO_TAG_E(P27) },
{ DEFIO_TAG_E(PA5) },
{ DEFIO_TAG_E(PA7) },
{ DEFIO_TAG_E(PA9) },
{ DEFIO_TAG_E(PA11) },
{ DEFIO_TAG_E(PA21) },
{ DEFIO_TAG_E(PA23) },
{ DEFIO_TAG_E(PA25) },
{ DEFIO_TAG_E(PA27) },
#ifdef RP2350B
{ DEFIO_TAG_E(P37) },
{ DEFIO_TAG_E(P39) },
{ DEFIO_TAG_E(P41) },
{ DEFIO_TAG_E(P43) },
{ DEFIO_TAG_E(PA37) },
{ DEFIO_TAG_E(PA39) },
{ DEFIO_TAG_E(PA41) },
{ DEFIO_TAG_E(PA43) },
#endif
},
.txPins = {
{ DEFIO_TAG_E(P4) },
{ DEFIO_TAG_E(P6) },
{ DEFIO_TAG_E(P8) },
{ DEFIO_TAG_E(P10) },
{ DEFIO_TAG_E(P20) },
{ DEFIO_TAG_E(P22) },
{ DEFIO_TAG_E(P24) },
{ DEFIO_TAG_E(P26) },
{ DEFIO_TAG_E(PA4) },
{ DEFIO_TAG_E(PA6) },
{ DEFIO_TAG_E(PA8) },
{ DEFIO_TAG_E(PA10) },
{ DEFIO_TAG_E(PA20) },
{ DEFIO_TAG_E(PA22) },
{ DEFIO_TAG_E(PA24) },
{ DEFIO_TAG_E(PA26) },
#ifdef RP2350B
{ DEFIO_TAG_E(P36) },
{ DEFIO_TAG_E(P38) },
{ DEFIO_TAG_E(P40) },
{ DEFIO_TAG_E(P42) },
{ DEFIO_TAG_E(PA36) },
{ DEFIO_TAG_E(PA38) },
{ DEFIO_TAG_E(PA40) },
{ DEFIO_TAG_E(PA42) },
#endif
},
.irqn = UART1_IRQ,
@ -195,7 +195,7 @@ uartPort_t *serialUART(uartDevice_t *uartdev, uint32_t baudRate, portMode_e mode
const resourceOwner_e ownerTxRx = serialOwnerTxRx(identifier); // rx is always +1
IOInit(txIO, ownerTxRx, ownerIndex);
IOInit(txIO, ownerTxRx, ownerIndex);
IOInit(rxIO, ownerTxRx, ownerIndex);
uart_init(hardware->reg, baudRate);

View file

@ -21,10 +21,12 @@
#pragma once
#ifdef PICO_STDIO_TEST
void _bprintf(const char * format, ...);
#ifdef PICO_TRACE
//void _bprintf(const char * format, ...);
//#define bprintf(fmt,...) _bprintf(fmt, ## __VA_ARGS__)
#define bprintf(fmt,...) do {stdio_printf(fmt, ## __VA_ARGS__); stdio_printf("\n"); } while (0)
//#define bprintf(fmt,...) do {stdio_printf(fmt, ## __VA_ARGS__); stdio_printf("\n"); } while (0)
#include "pico_trace.h"
#define bprintf tprintf
//int __wrap_printf(const char * fmt, ...);
//#define bprintf __wrap_printf
#else
@ -149,30 +151,30 @@ void _bprintf(const char * format, ...);
/* to be moved to a config file once target if working
defaults as per Laurel board for now */
#define LED0_PIN P25
#define LED0_PIN PA25
#undef LED1_PIN
#undef LED2_PIN
// These pin selections are currently fairly arbitrary for RP2350A
#define SPI0_SCK_PIN P2
#define SPI0_SDI_PIN P4
#define SPI0_SDO_PIN P3
#define SPI0_SCK_PIN PA2
#define SPI0_SDI_PIN PA4
#define SPI0_SDO_PIN PA3
#define SPI1_SCK_PIN P26
#define SPI1_SDI_PIN P24
#define SPI1_SDO_PIN P27
#define SPI1_SCK_PIN PA26
#define SPI1_SDI_PIN PA24
#define SPI1_SDO_PIN PA27
#define SDCARD_CS_PIN P25
#define FLASH_CS_PIN P25
#define MAX7456_SPI_CS_PIN P17
#define SDCARD_CS_PIN PA25
#define FLASH_CS_PIN PA25
#define MAX7456_SPI_CS_PIN PA17
#define GYRO_1_CS_PIN P1
#define GYRO_1_CS_PIN PA1
#define GYRO_2_CS_PIN NONE
#define MOTOR1_PIN P18
#define MOTOR2_PIN P19
#define MOTOR3_PIN P20
#define MOTOR4_PIN P21
#define MOTOR1_PIN PA18
#define MOTOR2_PIN PA19
#define MOTOR3_PIN PA20
#define MOTOR4_PIN PA21
#define MAX7456_SPI_INSTANCE SPI1
#define SDCARD_SPI_INSTANCE SPI1
@ -188,58 +190,58 @@ void _bprintf(const char * format, ...);
/*
SPI0_CS P1
SPI0_SCLK P2
SPI0_COPI P3
SPI0_CIPO P4
BUZZER P5
LED0 P6
LED1 P7
UART1_TX P8
UART1_RX P9
I2C1_SDA P10
I2C1_SCL P11
UART0_TX P12
UART0_RX P13
SPI0_CS PA1
SPI0_SCLK PA2
SPI0_COPI PA3
SPI0_CIPO PA4
BUZZER PA5
LED0 PA6
LED1 PA7
UART1_TX PA8
UART1_RX PA9
I2C1_SDA PA10
I2C1_SCL PA11
UART0_TX PA12
UART0_RX PA13
OSD_CS P17
OSD_CS PA17
UART2_TX P20
UART2_RX P21
UART2_TX PA20
UART2_RX PA21
GYRO_INT P22
GYRO_INT PA22
GYRO_CLK P23
GYRO_CLK PA23
SPI1_CIPO P24
SPI1_CS P25
SPI1_SCLK P26
SPI1_COPI P27
SPI1_CIPO PA24
SPI1_CS PA25
SPI1_SCLK PA26
SPI1_COPI PA27
MOTOR1 P28
MOTOR2 P29
MOTOR3 P30
MOTOR4 P31
MOTOR1 PA28
MOTOR2 PA29
MOTOR3 PA30
MOTOR4 PA31
SPARE1 P32
SPARE2 P33
SPARE1 PA32
SPARE2 PA33
UART3_TX P34
UART3_RX P35
UART3_TX PA34
UART3_RX PA35
DVTX_SBUS_RX P36
TELEM_RX P37
LED_STRIP P38
RGB_LED P39
DVTX_SBUS_RX PA36
TELEM_RX PA37
LED_STRIP PA38
RGB_LED PA39
VBAT_SENSE P40
CURR_SENSE P41
ADC_SPARE P42
VBAT_SENSE PA40
CURR_SENSE PA41
ADC_SPARE PA42
I2C0_SDA P44
I2C0_SCL P45
I2C0_SDA PA44
I2C0_SCL PA45
SPARE3 P47
SPARE3 PA47
*/

View file

@ -21,17 +21,18 @@
#pragma once
#ifdef PICO_STDIO_TEST
void _bprintf(const char * format, ...);
#ifdef PICO_TRACE
//void _bprintf(const char * format, ...);
//#define bprintf(fmt,...) _bprintf(fmt, ## __VA_ARGS__)
#define bprintf(fmt,...) do {stdio_printf(fmt, ## __VA_ARGS__); stdio_printf("\n"); } while (0)
//#define bprintf(fmt,...) do {stdio_printf(fmt, ## __VA_ARGS__); stdio_printf("\n"); } while (0)
#include "pico_trace.h"
#define bprintf tprintf
//int __wrap_printf(const char * fmt, ...);
//#define bprintf __wrap_printf
#else
#define bprintf(fmt,...)
#endif
#ifndef RP2350B
#define RP2350B
#endif
@ -69,7 +70,7 @@ void _bprintf(const char * format, ...);
#undef USE_TIMER
#undef USE_I2C
#undef USE_RCC
#undef USE_CLI
#undef USE_RX_PWM
#undef USE_RX_PPM
#undef USE_RX_SPI
@ -96,9 +97,21 @@ void _bprintf(const char * format, ...);
#undef USE_OSD
#undef USE_SPEKTRUM
#undef USE_SPEKTRUM_BIND
#undef USE_MSP
// #undef USE_CLI
#undef USE_SERIAL_PASSTHROUGH
// #undef USE_MSP
#undef USE_MSP_UART
#undef USE_MSP_DISPLAYPORT
#undef USE_DMA
#undef USE_DMA_SPEC
#undef USE_DSHOT_TELEMETRY
#undef USE_PWM_OUTPUT
#undef USE_GPS
#undef USE_GPS_UBLOX
#undef USE_GPS_MTK
@ -134,7 +147,6 @@ void _bprintf(const char * format, ...);
#undef USE_OSD_SD
#undef USE_OSD_HD
#undef USE_OSD_QUICK_MENU
#undef USE_GPS
#undef USE_POSITION_HOLD
//#define FLASH_PAGE_SIZE 0x1
@ -147,28 +159,36 @@ void _bprintf(const char * format, ...);
/* to be moved to a config file once target if working
defaults as per Laurel board for now */
#define LED0_PIN P6
#define LED1_PIN P7
#define LED0_PIN PA6
#define LED1_PIN PA7
#define SPI0_SCK_PIN P2
#define SPI0_SDI_PIN P4
#define SPI0_SDO_PIN P3
#define SPI0_SCK_PIN PA2
#define SPI0_SDI_PIN PA4
#define SPI0_SDO_PIN PA3
#define SPI1_SCK_PIN P26
#define SPI1_SDI_PIN P24
#define SPI1_SDO_PIN P27
#define SPI1_SCK_PIN PA26
#define SPI1_SDI_PIN PA24
#define SPI1_SDO_PIN PA27
#define SDCARD_CS_PIN P25
#define FLASH_CS_PIN P25
#define MAX7456_SPI_CS_PIN P17
#define SDCARD_CS_PIN PA25
#define FLASH_CS_PIN PA25
#define MAX7456_SPI_CS_PIN PA17
#define GYRO_1_CS_PIN P1
#define GYRO_1_CS_PIN PA1
#define GYRO_2_CS_PIN NONE
#define MOTOR1_PIN P28
#define MOTOR2_PIN P29
#define MOTOR3_PIN P30
#define MOTOR4_PIN P31
#if 0 // def TEST_DSHOT_ETC
// testing motor1 and motor2 pins -> GPIO_SPARE1, GPIO_SPARE2
#define MOTOR1_PIN PA32
#define MOTOR2_PIN PA33
#define MOTOR3_PIN PA30
#define MOTOR4_PIN PA31
#else
#define MOTOR1_PIN PA28
#define MOTOR2_PIN PA29
#define MOTOR3_PIN PA30
#define MOTOR4_PIN PA31
#endif
#define MAX7456_SPI_INSTANCE SPI1
#define SDCARD_SPI_INSTANCE SPI1
@ -178,64 +198,76 @@ void _bprintf(const char * format, ...);
#define USE_GYRO_SPI_ICM42688P
#define USE_ACC
#define USE_ACC_SPI_ICM42688P
#ifdef GYRO_ONLY_ICM42688
#undef USE_ACCGYRO_LSM6DSV16X
#undef USE_GYRO_SPI_ICM20689
#undef USE_GYRO_SPI_MPU6000
#undef USE_GYRO_SPI_MPU6500
#undef USE_GYRO_SPI_MPU9250
#undef USE_ACCGYRO_LSM6DSO
#undef USE_ACCGYRO_BMI160
#undef USE_ACCGYRO_BMI270
#endif
//#define USE_FLASH
//#define USE_FLASH_W25Q128FV
//#define USE_MAX7456
/*
SPI0_CS P1
SPI0_SCLK P2
SPI0_COPI P3
SPI0_CIPO P4
BUZZER P5
LED0 P6
LED1 P7
UART1_TX P8
UART1_RX P9
I2C1_SDA P10
I2C1_SCL P11
UART0_TX P12
UART0_RX P13
SPI0_CS PA1
SPI0_SCLK PA2
SPI0_COPI PA3
SPI0_CIPO PA4
BUZZER PA5
LED0 PA6
LED1 PA7
UART1_TX PA8
UART1_RX PA9
I2C1_SDA PA10
I2C1_SCL PA11
UART0_TX PA12
UART0_RX PA13
OSD_CS P17
OSD_CS PA17
UART2_TX P20
UART2_RX P21
UART2_TX PA20
UART2_RX PA21
GYRO_INT P22
GYRO_INT PA22
GYRO_CLK P23
GYRO_CLK PA23
SPI1_CIPO P24
SPI1_CS P25
SPI1_SCLK P26
SPI1_COPI P27
SPI1_CIPO PA24
SPI1_CS PA25
SPI1_SCLK PA26
SPI1_COPI PA27
MOTOR1 P28
MOTOR2 P29
MOTOR3 P30
MOTOR4 P31
MOTOR1 PA28
MOTOR2 PA29
MOTOR3 PA30
MOTOR4 PA31
SPARE1 P32
SPARE2 P33
SPARE1 PA32
SPARE2 PA33
UART3_TX P34
UART3_RX P35
UART3_TX PA34
UART3_RX PA35
DVTX_SBUS_RX P36
TELEM_RX P37
LED_STRIP P38
RGB_LED P39
DVTX_SBUS_RX PA36
TELEM_RX PA37
LED_STRIP PA38
RGB_LED PA39
VBAT_SENSE P40
CURR_SENSE P41
ADC_SPARE P42
VBAT_SENSE PA40
CURR_SENSE PA41
ADC_SPARE PA42
I2C0_SDA P44
I2C0_SCL P45
I2C0_SDA PA44
I2C0_SCL PA45
SPARE3 P47
SPARE3 PA47
*/