Let's say I need four PWM outputs to drive four devices (RC servos). I can create the PWM config struct as follows:
Code: Select all
static PWMConfig pwmcfg = {
1000000,
20000,
NULL,
{
{PWM_OUTPUT_ACTIVE_HIGH, NULL},
{PWM_OUTPUT_ACTIVE_HIGH, NULL},
{PWM_OUTPUT_ACTIVE_HIGH, NULL},
{PWM_OUTPUT_ACTIVE_HIGH, NULL},
},
0
};
Now, that works well. But let's say I am writing a small driver/wrapper which does allow it to easily use servos with ChibiOS/RT. Therefore, I need to adjust the PWM channel configuration and add the new channel as soon as I create a new instance. How can this be done? The init function which does call the pwmStart() does know what channel needs to be enabled.
Maybe this is some very easy, basic C thing and I am just thinking to far. Also, maybe I don't explain the problem very well. I'd be thankful if anyone could try to help me.
Thanks in advance.
~ Tectu