summaryrefslogtreecommitdiffstats
path: root/platforms/chibios/chibios_config.h
diff options
context:
space:
mode:
authorStefan Kerkmann <karlk90@pm.me>2022-10-27 19:26:16 +0200
committerGitHub <noreply@github.com>2022-10-27 19:26:16 +0200
commit19145704e4a7a8a7609d697585a6423b67dc5371 (patch)
treefb690df5c8ee842f5ffc73827c563450594ff35c /platforms/chibios/chibios_config.h
parentefe520645ec8b67d306eb63f54b0a52380269596 (diff)
[Core] Adjust PWM hardware audio driver for RP2040 (#17723)
Diffstat (limited to 'platforms/chibios/chibios_config.h')
-rw-r--r--platforms/chibios/chibios_config.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/platforms/chibios/chibios_config.h b/platforms/chibios/chibios_config.h
index 38d3a40f6b..4c8333f07b 100644
--- a/platforms/chibios/chibios_config.h
+++ b/platforms/chibios/chibios_config.h
@@ -28,10 +28,18 @@
# define USE_GPIOV1
# define PAL_OUTPUT_TYPE_OPENDRAIN _Static_assert(0, "RP2040 has no Open Drain GPIO configuration, setting this is not possible");
+/* Aliases for GPIO PWM channels - every pin has at least one PWM channel
+ * assigned */
+# 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)
# 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)
+# 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)
@@ -55,6 +63,7 @@
# define USE_GPIOV1
# define PAL_MODE_ALTERNATE_OPENDRAIN PAL_MODE_STM32_ALTERNATE_OPENDRAIN
# define PAL_MODE_ALTERNATE_PUSHPULL PAL_MODE_STM32_ALTERNATE_PUSHPULL
+# define AUDIO_PWM_PAL_MODE PAL_MODE_ALTERNATE_PUSHPULL
# else
# define PAL_OUTPUT_TYPE_OPENDRAIN PAL_STM32_OTYPE_OPENDRAIN
# define PAL_OUTPUT_TYPE_PUSHPULL PAL_STM32_OTYPE_PUSHPULL
@@ -76,6 +85,7 @@
# define USE_I2CV1
# define PAL_MODE_ALTERNATE_OPENDRAIN PAL_MODE_GD32_ALTERNATE_OPENDRAIN
# define PAL_MODE_ALTERNATE_PUSHPULL PAL_MODE_GD32_ALTERNATE_PUSHPULL
+# define AUDIO_PWM_PAL_MODE PAL_MODE_GD32_ALTERNATE_PUSHPULL
# endif
#endif