summaryrefslogtreecommitdiffstats
path: root/platforms
diff options
context:
space:
mode:
authorStefan Kerkmann <karlk90@pm.me>2022-10-04 23:10:24 +0200
committerGitHub <noreply@github.com>2022-10-04 23:10:24 +0200
commit996a9006d3f101dc5c48b58339e2e7323040fd59 (patch)
tree56bb76db42e23e3a1bc343ee7d35ee307e08a0a0 /platforms
parentb6ea8837e4c81f364d30bdc74bf2cdccb2a1a185 (diff)
[Core] PWM Backlight for RP2040 (#17706)
Diffstat (limited to 'platforms')
-rw-r--r--platforms/chibios/boards/GENERIC_PROMICRO_RP2040/configs/mcuconf.h13
-rw-r--r--platforms/chibios/boards/GENERIC_RP_RP2040/configs/mcuconf.h13
-rw-r--r--platforms/chibios/boards/QMK_PM2040/configs/mcuconf.h13
-rw-r--r--platforms/chibios/chibios_config.h4
-rw-r--r--platforms/chibios/vendors/RP/_pin_defs.h5
5 files changed, 48 insertions, 0 deletions
diff --git a/platforms/chibios/boards/GENERIC_PROMICRO_RP2040/configs/mcuconf.h b/platforms/chibios/boards/GENERIC_PROMICRO_RP2040/configs/mcuconf.h
index 8348e5312f..5c0859901e 100644
--- a/platforms/chibios/boards/GENERIC_PROMICRO_RP2040/configs/mcuconf.h
+++ b/platforms/chibios/boards/GENERIC_PROMICRO_RP2040/configs/mcuconf.h
@@ -79,6 +79,19 @@
#define RP_SPI_DMA_ERROR_HOOK(spip)
/*
+ * PWM driver system settings.
+ */
+#define RP_PWM_USE_PWM0 FALSE
+#define RP_PWM_USE_PWM1 FALSE
+#define RP_PWM_USE_PWM2 FALSE
+#define RP_PWM_USE_PWM3 FALSE
+#define RP_PWM_USE_PWM4 FALSE
+#define RP_PWM_USE_PWM5 FALSE
+#define RP_PWM_USE_PWM6 FALSE
+#define RP_PWM_USE_PWM7 FALSE
+#define RP_PWM_IRQ_WRAP_NUMBER_PRIORITY 3
+
+/*
* I2C driver system settings.
*/
#define RP_I2C_USE_I2C0 FALSE
diff --git a/platforms/chibios/boards/GENERIC_RP_RP2040/configs/mcuconf.h b/platforms/chibios/boards/GENERIC_RP_RP2040/configs/mcuconf.h
index 9d8dc61aac..f7a66c6ab9 100644
--- a/platforms/chibios/boards/GENERIC_RP_RP2040/configs/mcuconf.h
+++ b/platforms/chibios/boards/GENERIC_RP_RP2040/configs/mcuconf.h
@@ -79,6 +79,19 @@
#define RP_SPI_DMA_ERROR_HOOK(spip)
/*
+ * PWM driver system settings.
+ */
+#define RP_PWM_USE_PWM0 FALSE
+#define RP_PWM_USE_PWM1 FALSE
+#define RP_PWM_USE_PWM2 FALSE
+#define RP_PWM_USE_PWM3 FALSE
+#define RP_PWM_USE_PWM4 FALSE
+#define RP_PWM_USE_PWM5 FALSE
+#define RP_PWM_USE_PWM6 FALSE
+#define RP_PWM_USE_PWM7 FALSE
+#define RP_PWM_IRQ_WRAP_NUMBER_PRIORITY 3
+
+/*
* I2C driver system settings.
*/
#define RP_I2C_USE_I2C0 FALSE
diff --git a/platforms/chibios/boards/QMK_PM2040/configs/mcuconf.h b/platforms/chibios/boards/QMK_PM2040/configs/mcuconf.h
index a737b36c1c..e33d6d785f 100644
--- a/platforms/chibios/boards/QMK_PM2040/configs/mcuconf.h
+++ b/platforms/chibios/boards/QMK_PM2040/configs/mcuconf.h
@@ -79,6 +79,19 @@
#define RP_SPI_DMA_ERROR_HOOK(spip)
/*
+ * PWM driver system settings.
+ */
+#define RP_PWM_USE_PWM0 FALSE
+#define RP_PWM_USE_PWM1 FALSE
+#define RP_PWM_USE_PWM2 FALSE
+#define RP_PWM_USE_PWM3 FALSE
+#define RP_PWM_USE_PWM4 FALSE
+#define RP_PWM_USE_PWM5 FALSE
+#define RP_PWM_USE_PWM6 FALSE
+#define RP_PWM_USE_PWM7 FALSE
+#define RP_PWM_IRQ_WRAP_NUMBER_PRIORITY 3
+
+/*
* I2C driver system settings.
*/
#define RP_I2C_USE_I2C0 FALSE
diff --git a/platforms/chibios/chibios_config.h b/platforms/chibios/chibios_config.h
index 8dcc23727f..38d3a40f6b 100644
--- a/platforms/chibios/chibios_config.h
+++ b/platforms/chibios/chibios_config.h
@@ -28,6 +28,10 @@
# define USE_GPIOV1
# define PAL_OUTPUT_TYPE_OPENDRAIN _Static_assert(0, "RP2040 has no Open Drain GPIO configuration, setting this is not possible");
+# 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 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)
diff --git a/platforms/chibios/vendors/RP/_pin_defs.h b/platforms/chibios/vendors/RP/_pin_defs.h
index 4241845369..b56ab31406 100644
--- a/platforms/chibios/vendors/RP/_pin_defs.h
+++ b/platforms/chibios/vendors/RP/_pin_defs.h
@@ -35,3 +35,8 @@
#define GP28 28U
#define GP29 29U
#define GP30 30U
+
+/* 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