SPI works, may say it's over

This commit is contained in:
Edward Emelianov
2026-03-18 23:49:29 +03:00
parent c80f0884f5
commit e2a20a046a
12 changed files with 515 additions and 52 deletions

View File

@@ -126,6 +126,8 @@ int startPWM(uint8_t port, uint8_t pin){
volatile TIM_TypeDef *timer = timers[idx];
uint8_t chidx = timer_map[port][pin].chidx;
uint32_t chen = TIM_CCER_CC1E << (chidx<<2);
volatile uint32_t *CCR = &timers[idx]->CCR1 + timer_map[port][pin].chidx;
*CCR = 0; // set initial value to zero
if(0 == (timer->CCER & chen)){
if(0 == channel_counter[idx]++) timer->CR1 |= TIM_CR1_CEN; // start timer if need
timer->CCER |= chen; // enable channel