node-rpio icon indicating copy to clipboard operation
node-rpio copied to clipboard

Feature Request: Reverse Clock Polarity on PWM

Open sbarwe opened this issue 8 years ago • 1 comments

Sometimes it is neccessary to create an orthogonal PWM signals which is not easy to solve at high frequencies with inverters.

The reverse clock polarity feature of the BCM would be great to use here. May you extend the PWM at this e.g. that a call to rpio.open(12,PWM, 1) with init = 1 means that the clock is reversed?

example:

void bcm2835_pwm_set_mode(uint8_t channel, uint8_t markspace, uint8_t enabled, uint8_t reversepolarity)
{

...

  if (channel == 0)
    {
     ...
     if (reversepolarity) 
         control |= BCM2835_PWM0_REVPOLAR;
     else
        control &= ~BCM2835_PWM0_REVPOLAR;
    }
  else if (channel == 1)
    {
 ...
     if (reversepolarity) 
         control |= BCM2835_PWM1_REVPOLAR;
     else
        control &= ~BCM2835_PWM1_REVPOLAR;
    }

sbarwe avatar Sep 20 '16 11:09 sbarwe

Sorry I haven't had the chance to look at this for a long time. I'll leave this open for now, maybe someone else can submit a PR for this?

jperkin avatar Nov 29 '18 10:11 jperkin