summaryrefslogtreecommitdiff
path: root/quantum/audio/driver_chibios_pwm.h
diff options
context:
space:
mode:
authorNick Brassel <nick@tzarc.org>2021-02-28 07:22:21 +1100
committerNick Brassel <nick@tzarc.org>2021-02-28 07:22:21 +1100
commit1a5f6b54aff179732e3f4f4eb79e47454f0a1eb5 (patch)
treeebf645f55cb0442899c894765b1af4344fb734db /quantum/audio/driver_chibios_pwm.h
parent804d5c1c5d59d9a12c1d793289ccbd59cb650ec2 (diff)
parent624359b725c9bfe8176cf72cdc2c8bbb7513949f (diff)
downloadqmk_firmware-1a5f6b54aff179732e3f4f4eb79e47454f0a1eb5.tar.gz
qmk_firmware-1a5f6b54aff179732e3f4f4eb79e47454f0a1eb5.zip
2021 February 27 Breaking Changes Update (#12040)
Diffstat (limited to 'quantum/audio/driver_chibios_pwm.h')
-rw-r--r--quantum/audio/driver_chibios_pwm.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/quantum/audio/driver_chibios_pwm.h b/quantum/audio/driver_chibios_pwm.h
new file mode 100644
index 0000000000..86cab916e1
--- /dev/null
+++ b/quantum/audio/driver_chibios_pwm.h
@@ -0,0 +1,40 @@
+/* Copyright 2020 Jack Humbert
+ * Copyright 2020 JohSchneider
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+#pragma once
+
+#if !defined(AUDIO_PWM_DRIVER)
+// NOTE: Timer2 seems to be used otherwise in QMK, otherwise we could default to A5 (= TIM2_CH1, with PWMD2 and alternate-function(1))
+# define AUDIO_PWM_DRIVER PWMD1
+#endif
+
+#if !defined(AUDIO_PWM_CHANNEL)
+// NOTE: sticking to the STM data-sheet numbering: TIMxCH1 to TIMxCH4
+// default: STM32F303CC PA8+TIM1_CH1 -> 1
+# define AUDIO_PWM_CHANNEL 1
+#endif
+
+#if !defined(AUDIO_PWM_PAL_MODE)
+// pin-alternate function: see the data-sheet for which pin needs what AF to connect to TIMx_CHy
+// default: STM32F303CC PA8+TIM1_CH1 -> 6
+# define AUDIO_PWM_PAL_MODE 6
+#endif
+
+#if !defined(AUDIO_STATE_TIMER)
+// timer used to trigger updates in the audio-system, configured/enabled in chibios mcuconf.
+// Tim6 is the default for "larger" STMs, smaller ones might not have this one (enabled) and need to switch to a different one (e.g.: STM32F103 has only Tim1-Tim4)
+# define AUDIO_STATE_TIMER GPTD6
+#endif