1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-13 19:40:31 +03:00

PICO: Comments on IOConfigGPIO

This commit is contained in:
Matthew Selby 2025-05-15 11:33:08 +01:00
parent 85a4fe8dcc
commit a305b8833b
2 changed files with 23 additions and 7 deletions

View file

@ -87,13 +87,26 @@ void IOToggle(IO_t io)
void IOConfigGPIO(IO_t io, ioConfig_t cfg) void IOConfigGPIO(IO_t io, ioConfig_t cfg)
{ {
/*
TODO: update to support the following
IOCFG_AF_PP
IOCFG_IN_FLOATING
IOCFG_IPD
IOCFG_IPU
IOCFG_OUT_OD
IOCFG_OUT_PP
IO_RESET_CFG
SPI_IO_CS_CFG (as defined)
SPI_IO_CS_HIGH_CFG (as defined)
*/
if (!io) { if (!io) {
return; return;
} }
uint16_t ioPin = IO_Pin(io); uint16_t ioPin = IO_Pin(io);
gpio_init(ioPin); gpio_init(ioPin);
gpio_set_dir(ioPin, (cfg & 0x01)); gpio_set_dir(ioPin, (cfg & 0x01)); // 0 = in, 1 = out
} }
IO_t IOGetByTag(ioTag_t tag) IO_t IOGetByTag(ioTag_t tag)

View file

@ -31,12 +31,6 @@
#define NVIC_PriorityGroup_2 0x500 #define NVIC_PriorityGroup_2 0x500
#define SPI_IO_AF_CFG 0
#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
#if defined(RP2350A) || defined(RP2350B) #if defined(RP2350A) || defined(RP2350B)
typedef enum {DISABLE = 0, ENABLE = !DISABLE} FunctionalState; typedef enum {DISABLE = 0, ENABLE = !DISABLE} FunctionalState;
@ -84,6 +78,7 @@ typedef enum {DISABLE = 0, ENABLE = !DISABLE} FunctionalState;
#define IO_CONFIG(mode, speed, pupd) ((mode) | ((speed) << 2) | ((pupd) << 5)) #define IO_CONFIG(mode, speed, pupd) ((mode) | ((speed) << 2) | ((pupd) << 5))
// TODO update these and IOConfigGPIO
#define IOCFG_OUT_PP IO_CONFIG(GPIO_OUT, 0, 0) #define IOCFG_OUT_PP IO_CONFIG(GPIO_OUT, 0, 0)
#define IOCFG_OUT_OD IO_CONFIG(GPIO_OUT, 0, 0) #define IOCFG_OUT_OD IO_CONFIG(GPIO_OUT, 0, 0)
#define IOCFG_AF_PP 0 #define IOCFG_AF_PP 0
@ -92,6 +87,14 @@ typedef enum {DISABLE = 0, ENABLE = !DISABLE} FunctionalState;
#define IOCFG_IPU IO_CONFIG(GPIO_IN, 0, 0) #define IOCFG_IPU IO_CONFIG(GPIO_IN, 0, 0)
#define IOCFG_IN_FLOATING IO_CONFIG(GPIO_IN, 0, 0) #define IOCFG_IN_FLOATING IO_CONFIG(GPIO_IN, 0, 0)
// TODO update these and IOConfigGPIO
#define SPI_IO_AF_CFG 0
#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 SERIAL_UART_FIRST_INDEX 0 #define SERIAL_UART_FIRST_INDEX 0
extern uint32_t systemUniqueId[3]; extern uint32_t systemUniqueId[3];