From 368fee9655b8c0611808212b680674b5acd4349c Mon Sep 17 00:00:00 2001 From: Purdea Andrei Date: Tue, 4 Apr 2023 02:07:36 +0300 Subject: [PATCH] rp2040: *_PAL_MODE overridable for this platform too (#20314) Co-authored-by: Sergey Vlasov --- platforms/chibios/chibios_config.h | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/platforms/chibios/chibios_config.h b/platforms/chibios/chibios_config.h index 4c8333f07b..52632a051e 100644 --- a/platforms/chibios/chibios_config.h +++ b/platforms/chibios/chibios_config.h @@ -33,26 +33,40 @@ # define RP2040_PWM_CHANNEL_A 1U # define RP2040_PWM_CHANNEL_B 2U -# define BACKLIGHT_PAL_MODE (PAL_MODE_ALTERNATE_PWM | PAL_RP_PAD_DRIVE12 | PAL_RP_GPIO_OE) +# ifndef BACKLIGHT_PAL_MODE +# define BACKLIGHT_PAL_MODE (PAL_MODE_ALTERNATE_PWM | PAL_RP_PAD_DRIVE12 | PAL_RP_GPIO_OE) +# endif # define BACKLIGHT_PWM_COUNTER_FREQUENCY 1000000 # define BACKLIGHT_PWM_PERIOD BACKLIGHT_PWM_COUNTER_FREQUENCY / 2048 -# define AUDIO_PWM_PAL_MODE (PAL_MODE_ALTERNATE_PWM | PAL_RP_PAD_DRIVE12 | PAL_RP_GPIO_OE) +# ifndef AUDIO_PWM_PAL_MODE +# define AUDIO_PWM_PAL_MODE (PAL_MODE_ALTERNATE_PWM | PAL_RP_PAD_DRIVE12 | PAL_RP_GPIO_OE) +# endif # define AUDIO_PWM_COUNTER_FREQUENCY 500000 # define usb_lld_endpoint_fields -# define I2C1_SCL_PAL_MODE (PAL_MODE_ALTERNATE_I2C | PAL_RP_PAD_SLEWFAST | PAL_RP_PAD_PUE | PAL_RP_PAD_DRIVE4) -# define I2C1_SDA_PAL_MODE I2C1_SCL_PAL_MODE +# ifndef I2C1_SCL_PAL_MODE +# define I2C1_SCL_PAL_MODE (PAL_MODE_ALTERNATE_I2C | PAL_RP_PAD_SLEWFAST | PAL_RP_PAD_PUE | PAL_RP_PAD_DRIVE4) +# endif +# ifndef I2C1_SDA_PAL_MODE +# define I2C1_SDA_PAL_MODE (PAL_MODE_ALTERNATE_I2C | PAL_RP_PAD_SLEWFAST | PAL_RP_PAD_PUE | PAL_RP_PAD_DRIVE4) +# endif # define USE_I2CV1_CONTRIB # if !defined(I2C1_CLOCK_SPEED) # define I2C1_CLOCK_SPEED 400000 # endif -# define SPI_SCK_PAL_MODE (PAL_MODE_ALTERNATE_SPI | PAL_RP_PAD_SLEWFAST | PAL_RP_PAD_DRIVE4) -# define SPI_MOSI_PAL_MODE SPI_SCK_PAL_MODE -# define SPI_MISO_PAL_MODE SPI_SCK_PAL_MODE +# ifndef SPI_SCK_PAL_MODE +# define SPI_SCK_PAL_MODE (PAL_MODE_ALTERNATE_SPI | PAL_RP_PAD_SLEWFAST | PAL_RP_PAD_DRIVE4) +# endif +# ifndef SPI_MOSI_PAL_MODE +# define SPI_MOSI_PAL_MODE (PAL_MODE_ALTERNATE_SPI | PAL_RP_PAD_SLEWFAST | PAL_RP_PAD_DRIVE4) +# endif +# ifndef SPI_MISO_PAL_MODE +# define SPI_MISO_PAL_MODE (PAL_MODE_ALTERNATE_SPI | PAL_RP_PAD_SLEWFAST | PAL_RP_PAD_DRIVE4) +# endif #endif // STM32 compatibility