summaryrefslogtreecommitdiffstats
path: root/platforms
diff options
context:
space:
mode:
authorPurdea Andrei <andrei@purdea.ro>2023-04-04 02:07:36 +0300
committerGitHub <noreply@github.com>2023-04-04 09:07:36 +1000
commit368fee9655b8c0611808212b680674b5acd4349c (patch)
tree74b63fb9620ac296306c47ecfadae6540ce0429a /platforms
parentd783536e0d115771e160280a62dc3227000e13ad (diff)
rp2040: *_PAL_MODE overridable for this platform too (#20314)
Co-authored-by: Sergey Vlasov <sigprof@gmail.com>
Diffstat (limited to 'platforms')
-rw-r--r--platforms/chibios/chibios_config.h28
1 files 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