frac32.positive pwm ratio
None
static const PWMConfig pwmcfg = {400000, /* 400kHz PWM clock frequency. */
4096, /* PWM period is 128 cycles. */
NULL,
{{PWM_OUTPUT_ACTIVE_HIGH, NULL},
{PWM_OUTPUT_ACTIVE_HIGH, NULL},
{PWM_OUTPUT_ACTIVE_HIGH, NULL},
{PWM_OUTPUT_ACTIVE_HIGH, NULL}},
/* HW dependent part.*/
0};
pwmStart(&PWMD8, &pwmcfg);
palSetPadMode(GPIOA, 5, PAL_MODE_ALTERNATE(3));
PWMD8.tim->CCER |= STM32_TIM_CCER_CC1NE | STM32_TIM_CCER_CC1NP;
pwmEnableChannel(&PWMD8, 0, (pwmcnt_t)(inlet_pa5 >= 0 ? inlet_pa5 >> 15 : 0));
pwmStop(&PWMD8);