feat(faderboard): initialize pwm channels

This commit is contained in:
Luca 2024-07-15 17:24:11 +02:00
parent da20d2bcc0
commit 3cac6c3e37
1 changed files with 16 additions and 8 deletions

View File

@ -12,6 +12,7 @@ use stm32f0xx_hal as hal;
use hal::adc::Adc; use hal::adc::Adc;
use hal::pac::Peripherals; use hal::pac::Peripherals;
use hal::prelude::*; use hal::prelude::*;
use hal::pwm;
use touch::Touch; use touch::Touch;
@ -45,7 +46,7 @@ fn main() -> ! {
mut adc6, // ADC_IN5 mut adc6, // ADC_IN5
mut adc5, // ADC_IN6 mut adc5, // ADC_IN6
mut adc4, // ADC_IN7 mut adc4, // ADC_IN7
pwm6, // TIM1_CH1 pwm6_pin, // TIM1_CH1
tx, // USART1_TX tx, // USART1_TX
rx, // USART1_RX rx, // USART1_RX
usb_dm, // USB_DM usb_dm, // USB_DM
@ -56,19 +57,19 @@ fn main() -> ! {
mut touch4, // PB0 mut touch4, // PB0
mut touch5, // PB1 mut touch5, // PB1
mut touch6, // PB2 mut touch6, // PB2
pwm5, // TIM2_CH2 pwm5_pin, // TIM2_CH2
pwm4, // TIM3_CH1 pwm4_pin, // TIM3_CH1
pwm3, // TIM3_CH2 pwm3_pin, // TIM3_CH2
mut dir2, // PB6 mut dir2, // PB6
mut dir1, // PB7 mut dir1, // PB7
pwm1, // TIM16_CH1 pwm1_pin, // TIM16_CH1
pwm2, // TIM17_CH1 pwm2_pin, // TIM17_CH1
mut touch7, // PB10 mut touch7, // PB10
mut touch8, // PB11 mut touch8, // PB11
mut dir8, // PB12 mut dir8, // PB12
mut dir7, // PB13 mut dir7, // PB13
pwm8, // TIM15_CH1 pwm8_pin, // TIM15_CH1
pwm7, // TIM15_CH2 pwm7_pin, // TIM15_CH2
mut touch1, // PC13 mut touch1, // PC13
mut touch2, // PC14 mut touch2, // PC14
mut touch3, // PC15 mut touch3, // PC15
@ -118,6 +119,13 @@ fn main() -> ! {
let mut _adc = Adc::new(p.ADC, &mut rcc); let mut _adc = Adc::new(p.ADC, &mut rcc);
let mut _pwm1 = pwm::tim16(p.TIM16, pwm1_pin, &mut rcc, 250.khz());
let mut _pwm2 = pwm::tim17(p.TIM17, pwm2_pin, &mut rcc, 250.khz());
let (mut _pwm4, mut _pwm3) = pwm::tim3(p.TIM3, (pwm4_pin, pwm3_pin), &mut rcc, 250.khz());
let mut _pwm5 = pwm::tim2(p.TIM2, pwm5_pin, &mut rcc, 250.khz());
let mut _pwm6 = pwm::tim1(p.TIM1, pwm6_pin, &mut rcc, 250.khz());
let (mut _pwm8, mut _pwm7) = pwm::tim15(p.TIM15, (pwm8_pin, pwm7_pin), &mut rcc, 250.khz());
touch.setup(); touch.setup();
loop {} loop {}