diff --git a/src/main/drivers/io_def.h b/src/main/drivers/io_def.h index 6566bd34fb..6f0a8cc07e 100644 --- a/src/main/drivers/io_def.h +++ b/src/main/drivers/io_def.h @@ -41,13 +41,23 @@ // get ioRec by index #define DEFIO_REC_INDEXED(idx) (ioRecs + (idx)) -// ioTag_t accessor macros -#define DEFIO_TAG_MAKE(gpioid, pin) ((ioTag_t)((((gpioid) + 1) << 4) | (pin))) -#define DEFIO_TAG_ISEMPTY(tag) (!(tag)) -#define DEFIO_TAG_GPIOID(tag) (((tag) >> 4) - 1) -#define DEFIO_TAG_PIN(tag) ((tag) & 0x0f) - // TARGET must define used pins #include "target.h" + +// TODO: hack for the minute +#ifndef DEFIO_PIN_BITMASK +#define DEFIO_PIN_BITMASK 0x0f +#endif + +#ifndef DEFIO_PORT_BITSHIFT +#define DEFIO_PORT_BITSHIFT 4 +#endif + +// ioTag_t accessor macros +#define DEFIO_TAG_MAKE(gpioid, pin) ((ioTag_t)((((gpioid) + 1) << DEFIO_PORT_BITSHIFT) | (pin))) +#define DEFIO_TAG_ISEMPTY(tag) (!(tag)) +#define DEFIO_TAG_GPIOID(tag) (((tag) >> DEFIO_PORT_BITSHIFT) - 1) +#define DEFIO_TAG_PIN(tag) ((tag) & DEFIO_PIN_BITMASK) + // include template-generated macros for IO pins #include "io_def_generated.h" diff --git a/src/platform/PICO/io_def_generated.h b/src/platform/PICO/io_def_generated.h index ad83e334a7..f30b689ea0 100644 --- a/src/platform/PICO/io_def_generated.h +++ b/src/platform/PICO/io_def_generated.h @@ -1,19 +1,20 @@ /* - * This file is part of Cleanflight and Betaflight. + * This file is part of Betaflight. * - * Cleanflight and Betaflight are free software. You can redistribute - * this software and/or modify this software under the terms of the - * GNU General Public License as published by the Free Software - * Foundation, either version 3 of the License, or (at your option) - * any later version. + * Betaflight is free software. You can redistribute this software + * and/or modify this software under the terms of the GNU General + * Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later + * version. + * + * Betaflight is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * Cleanflight and Betaflight are distributed in the hope that they - * will be useful, but WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this software. + * You should have received a copy of the GNU General Public + * License along with this software. * * If not, see . */ @@ -24,195 +25,193 @@ // DEFIO_PORT__USED_COUNT is count of used pins on target #if defined(RP2350A) -#define DEFIO_PORT_A_USED_COUNT 30 +#define DEFIO_USED_COUNT 30 #elif defined(RP2350B) -#define DEFIO_PORT_A_USED_COUNT 48 +#define DEFIO_USED_COUNT 48 #else #error "Unsupported target MCU type for PICO" #endif -#define DEFIO_PORT_A_OFFSET (0) - -// DEFIO_GPIOID__ maps to port index -#define DEFIO_GPIOID__A 0 +#undef DEFIO_TAG_MAKE +#define DEFIO_TAG_MAKE(pin) ((ioTag_t)(((1) << DEFIO_PORT_BITSHIFT) | (pin))) // DEFIO_TAG__P will expand to TAG if defined for target, error is triggered otherwise // DEFIO_TAG_E__P will expand to TAG if defined, to NONE otherwise (usefull for tables that are CPU-specific) // DEFIO_REC__P will expand to ioRec* (using DEFIO_REC_INDEX(idx)) -#define DEFIO_TAG__PA0 DEFIO_TAG_MAKE(DEFIO_GPIOID__A, 0) -#define DEFIO_TAG__PA1 DEFIO_TAG_MAKE(DEFIO_GPIOID__A, 1) -#define DEFIO_TAG__PA2 DEFIO_TAG_MAKE(DEFIO_GPIOID__A, 2) -#define DEFIO_TAG__PA3 DEFIO_TAG_MAKE(DEFIO_GPIOID__A, 3) -#define DEFIO_TAG__PA4 DEFIO_TAG_MAKE(DEFIO_GPIOID__A, 4) -#define DEFIO_TAG__PA5 DEFIO_TAG_MAKE(DEFIO_GPIOID__A, 5) -#define DEFIO_TAG__PA6 DEFIO_TAG_MAKE(DEFIO_GPIOID__A, 6) -#define DEFIO_TAG__PA7 DEFIO_TAG_MAKE(DEFIO_GPIOID__A, 7) -#define DEFIO_TAG__PA8 DEFIO_TAG_MAKE(DEFIO_GPIOID__A, 8) -#define DEFIO_TAG__PA9 DEFIO_TAG_MAKE(DEFIO_GPIOID__A, 9) -#define DEFIO_TAG__PA10 DEFIO_TAG_MAKE(DEFIO_GPIOID__A, 10) -#define DEFIO_TAG__PA11 DEFIO_TAG_MAKE(DEFIO_GPIOID__A, 11) -#define DEFIO_TAG__PA12 DEFIO_TAG_MAKE(DEFIO_GPIOID__A, 12) -#define DEFIO_TAG__PA13 DEFIO_TAG_MAKE(DEFIO_GPIOID__A, 13) -#define DEFIO_TAG__PA14 DEFIO_TAG_MAKE(DEFIO_GPIOID__A, 14) -#define DEFIO_TAG__PA15 DEFIO_TAG_MAKE(DEFIO_GPIOID__A, 15) -#define DEFIO_TAG__PA16 DEFIO_TAG_MAKE(DEFIO_GPIOID__A, 16) -#define DEFIO_TAG__PA17 DEFIO_TAG_MAKE(DEFIO_GPIOID__A, 17) -#define DEFIO_TAG__PA18 DEFIO_TAG_MAKE(DEFIO_GPIOID__A, 18) -#define DEFIO_TAG__PA19 DEFIO_TAG_MAKE(DEFIO_GPIOID__A, 19) -#define DEFIO_TAG__PA20 DEFIO_TAG_MAKE(DEFIO_GPIOID__A, 20) -#define DEFIO_TAG__PA21 DEFIO_TAG_MAKE(DEFIO_GPIOID__A, 21) -#define DEFIO_TAG__PA22 DEFIO_TAG_MAKE(DEFIO_GPIOID__A, 22) -#define DEFIO_TAG__PA23 DEFIO_TAG_MAKE(DEFIO_GPIOID__A, 23) -#define DEFIO_TAG__PA24 DEFIO_TAG_MAKE(DEFIO_GPIOID__A, 24) -#define DEFIO_TAG__PA25 DEFIO_TAG_MAKE(DEFIO_GPIOID__A, 25) -#define DEFIO_TAG__PA26 DEFIO_TAG_MAKE(DEFIO_GPIOID__A, 26) -#define DEFIO_TAG__PA27 DEFIO_TAG_MAKE(DEFIO_GPIOID__A, 27) -#define DEFIO_TAG__PA28 DEFIO_TAG_MAKE(DEFIO_GPIOID__A, 28) -#define DEFIO_TAG__PA29 DEFIO_TAG_MAKE(DEFIO_GPIOID__A, 29) +#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) #if defined(RP2350B) -#define DEFIO_TAG__PA30 DEFIO_TAG_MAKE(DEFIO_GPIOID__A, 30) -#define DEFIO_TAG__PA31 DEFIO_TAG_MAKE(DEFIO_GPIOID__A, 31) -#define DEFIO_TAG__PA32 DEFIO_TAG_MAKE(DEFIO_GPIOID__A, 32) -#define DEFIO_TAG__PA33 DEFIO_TAG_MAKE(DEFIO_GPIOID__A, 33) -#define DEFIO_TAG__PA34 DEFIO_TAG_MAKE(DEFIO_GPIOID__A, 34) -#define DEFIO_TAG__PA35 DEFIO_TAG_MAKE(DEFIO_GPIOID__A, 35) -#define DEFIO_TAG__PA36 DEFIO_TAG_MAKE(DEFIO_GPIOID__A, 36) -#define DEFIO_TAG__PA37 DEFIO_TAG_MAKE(DEFIO_GPIOID__A, 37) -#define DEFIO_TAG__PA38 DEFIO_TAG_MAKE(DEFIO_GPIOID__A, 38) -#define DEFIO_TAG__PA39 DEFIO_TAG_MAKE(DEFIO_GPIOID__A, 39) -#define DEFIO_TAG__PA40 DEFIO_TAG_MAKE(DEFIO_GPIOID__A, 40) -#define DEFIO_TAG__PA41 DEFIO_TAG_MAKE(DEFIO_GPIOID__A, 41) -#define DEFIO_TAG__PA42 DEFIO_TAG_MAKE(DEFIO_GPIOID__A, 42) -#define DEFIO_TAG__PA43 DEFIO_TAG_MAKE(DEFIO_GPIOID__A, 43) -#define DEFIO_TAG__PA44 DEFIO_TAG_MAKE(DEFIO_GPIOID__A, 44) -#define DEFIO_TAG__PA45 DEFIO_TAG_MAKE(DEFIO_GPIOID__A, 45) -#define DEFIO_TAG__PA46 DEFIO_TAG_MAKE(DEFIO_GPIOID__A, 46) -#define DEFIO_TAG__PA47 DEFIO_TAG_MAKE(DEFIO_GPIOID__A, 47) +#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) #endif -#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 +#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 #if defined(RP2350B) -#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 +#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 #else -#define DEFIO_TAG_E__PA30 DEFIO_TAG_A__NONE -#define DEFIO_TAG_E__PA31 DEFIO_TAG_A__NONE -#define DEFIO_TAG_E__PA32 DEFIO_TAG_A__NONE -#define DEFIO_TAG_E__PA33 DEFIO_TAG_A__NONE -#define DEFIO_TAG_E__PA34 DEFIO_TAG_A__NONE -#define DEFIO_TAG_E__PA35 DEFIO_TAG_A__NONE -#define DEFIO_TAG_E__PA36 DEFIO_TAG_A__NONE -#define DEFIO_TAG_E__PA37 DEFIO_TAG_A__NONE -#define DEFIO_TAG_E__PA38 DEFIO_TAG_A__NONE -#define DEFIO_TAG_E__PA39 DEFIO_TAG_A__NONE -#define DEFIO_TAG_E__PA40 DEFIO_TAG_A__NONE -#define DEFIO_TAG_E__PA41 DEFIO_TAG_A__NONE -#define DEFIO_TAG_E__PA42 DEFIO_TAG_A__NONE -#define DEFIO_TAG_E__PA43 DEFIO_TAG_A__NONE -#define DEFIO_TAG_E__PA44 DEFIO_TAG_A__NONE -#define DEFIO_TAG_E__PA45 DEFIO_TAG_A__NONE -#define DEFIO_TAG_E__PA46 DEFIO_TAG_A__NONE -#define DEFIO_TAG_E__PA47 DEFIO_TAG_A__NONE +#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 #endif -#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) +#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) #if defined(RP2350B) -#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) +#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) #endif // DEFIO_IO_USED_COUNT is number of io pins supported on target @@ -226,6 +225,6 @@ // DEFIO_PORT_OFFSET_LIST - comma separated list of port offsets (count of pins before this port) // unused ports on end of list are skipped #define DEFIO_PORT_USED_COUNT 1 -#define DEFIO_PORT_USED_LIST DEFIO_PORT_A_USED_MASK -#define DEFIO_PORT_OFFSET_LIST DEFIO_PORT_A_OFFSET -#define DEFIO_PIN_USED_COUNT DEFIO_PORT_A_USED_COUNT +#define DEFIO_PORT_USED_LIST +#define DEFIO_PORT_OFFSET_LIST 0 +#define DEFIO_PIN_USED_COUNT DEFIO_USED_COUNT diff --git a/src/platform/PICO/serial_uart_pico.c b/src/platform/PICO/serial_uart_pico.c index 83626791e5..da1002062f 100644 --- a/src/platform/PICO/serial_uart_pico.c +++ b/src/platform/PICO/serial_uart_pico.c @@ -43,12 +43,12 @@ const uartHardware_t uartHardware[UARTDEV_COUNT] = { .identifier = SERIAL_PORT_UART0, .reg = uart0, .rxPins = { - { DEFIO_TAG_E(PA1) }, - { DEFIO_TAG_E(PA17) }, + { DEFIO_TAG_E(P1) }, + { DEFIO_TAG_E(P17) }, }, .txPins = { - { DEFIO_TAG_E(PA0) }, - { DEFIO_TAG_E(PA16) }, + { DEFIO_TAG_E(P0) }, + { DEFIO_TAG_E(P16) }, }, .irqn = UART0_IRQ, .txBuffer = uart0TxBuffer, @@ -63,14 +63,14 @@ const uartHardware_t uartHardware[UARTDEV_COUNT] = { .identifier = SERIAL_PORT_UART1, .reg = uart1, .rxPins = { - { DEFIO_TAG_E(PA5) }, - { DEFIO_TAG_E(PA9) }, - { DEFIO_TAG_E(PA25) }, + { DEFIO_TAG_E(P5) }, + { DEFIO_TAG_E(P9) }, + { DEFIO_TAG_E(P25) }, }, .txPins = { - { DEFIO_TAG_E(PA4) }, - { DEFIO_TAG_E(PA20) }, - { DEFIO_TAG_E(PA24) }, + { DEFIO_TAG_E(P4) }, + { DEFIO_TAG_E(P20) }, + { DEFIO_TAG_E(P24) }, }, .irqn = UART1_IRQ, .txBuffer = uart1TxBuffer, diff --git a/src/platform/PICO/target/RP2350B/target.h b/src/platform/PICO/target/RP2350B/target.h index 1d06711a30..c77ef7696c 100644 --- a/src/platform/PICO/target/RP2350B/target.h +++ b/src/platform/PICO/target/RP2350B/target.h @@ -122,22 +122,22 @@ #define FLASH_CONFIG_BUFFER_ALIGN_TYPE uint32_t /* to be moved to a config file once target if working */ -#define LED0_PIN PA6 -#define LED1_PIN PA7 +#define LED0_PIN P6 +#define LED1_PIN P7 -#define SPI0_SCK_PIN PA5 -#define SPI0_SDI_PIN PA6 -#define SPI0_SDO_PIN PA7 +#define SPI0_SCK_PIN P5 +#define SPI0_SDI_PIN P6 +#define SPI0_SDO_PIN P7 -#define SPI1_SCK_PIN PA26 -#define SPI1_SDI_PIN PA24 -#define SPI1_SDO_PIN PA27 +#define SPI1_SCK_PIN P26 +#define SPI1_SDI_PIN P24 +#define SPI1_SDO_PIN P27 -#define SDCARD_CS_PIN PA25 -#define FLASH_CS_PIN PA25 -#define MAX7456_SPI_CS_PIN PA17 +#define SDCARD_CS_PIN P25 +#define FLASH_CS_PIN P25 +#define MAX7456_SPI_CS_PIN P17 -#define GYRO_1_CS_PIN PA1 +#define GYRO_1_CS_PIN P1 #define GYRO_2_CS_PIN NONE #define MAX7456_SPI_INSTANCE SPI1 @@ -152,6 +152,9 @@ //#define USE_FLASH_W25Q128FV //#define USE_MAX7456 +#define DEFIO_PIN_BITMASK 0x7f +#define DEFIO_PORT_BITSHIFT 7 + /* SPI0_CS P1