driver_chibios_pwm.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /* Copyright 2020 Jack Humbert
  2. * Copyright 2020 JohSchneider
  3. *
  4. * This program is free software: you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation, either version 2 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. */
  17. #pragma once
  18. #if !defined(AUDIO_PWM_DRIVER)
  19. // NOTE: Timer2 seems to be used otherwise in QMK, otherwise we could default to A5 (= TIM2_CH1, with PWMD2 and alternate-function(1))
  20. # define AUDIO_PWM_DRIVER PWMD1
  21. #endif
  22. #if !defined(AUDIO_PWM_CHANNEL)
  23. // NOTE: sticking to the STM data-sheet numbering: TIMxCH1 to TIMxCH4
  24. // default: STM32F303CC PA8+TIM1_CH1 -> 1
  25. # define AUDIO_PWM_CHANNEL 1
  26. #endif
  27. #if !defined(AUDIO_PWM_PAL_MODE)
  28. // pin-alternate function: see the data-sheet for which pin needs what AF to connect to TIMx_CHy
  29. // default: STM32F303CC PA8+TIM1_CH1 -> 6
  30. # define AUDIO_PWM_PAL_MODE 6
  31. #endif
  32. #if !defined(AUDIO_STATE_TIMER)
  33. // timer used to trigger updates in the audio-system, configured/enabled in chibios mcuconf.
  34. // 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)
  35. # define AUDIO_STATE_TIMER GPTD6
  36. #endif