frac32.positive pwm ratio
frac32.positive pwm ratio
frac32.positive pwm ratio
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(&PWMD5, &pwmcfg);
palSetPadMode(GPIOA, 0, PAL_MODE_ALTERNATE(2));
palSetPadMode(GPIOA, 1, PAL_MODE_ALTERNATE(2));
palSetPadMode(GPIOA, 2, PAL_MODE_ALTERNATE(2));
palSetPadMode(GPIOA, 3, PAL_MODE_ALTERNATE(2));
pwmEnableChannel(&PWMD5, 0, (pwmcnt_t)(inlet_pa0 >= 0 ? inlet_pa0 >> 15 : 0));
pwmEnableChannel(&PWMD5, 1, (pwmcnt_t)(inlet_pa1 >= 0 ? inlet_pa1 >> 15 : 0));
pwmEnableChannel(&PWMD5, 2, (pwmcnt_t)(inlet_pa2 >= 0 ? inlet_pa2 >> 15 : 0));
pwmEnableChannel(&PWMD5, 3, (pwmcnt_t)(inlet_pa3 >= 0 ? inlet_pa3 >> 15 : 0));
pwmStop(&PWMD5);