2-Pin PWM Opposite Polarity on nRF52840

Hi Guys,

I am trying to accomplish something like the well known ToneAC library does on the Adafruit Feather nRF52840. I've modified the Tone.cpp file in the NRF5 core folder to make it output the PWM signal on more than one pin, explicitly naming the pins that I am using in this application:

uint32_t pins[NRF_PWM_CHANNEL_COUNT] = {
        g_ADigitalPinMap[16],
        g_ADigitalPinMap[17],
        NRF_PWM_PIN_NOT_CONNECTED,
        NRF_PWM_PIN_NOT_CONNECTED
    }; 

I have read about how to modify the polarity using something like seq_values->channel_0 = duty_cycle | 0x8000; here:

Any idea how to integrate this solution into the Tone.cpp file or elsewhere? Or perhaps a different solution? I've got the signal on both pins, but just want to flip the polarity of one of them to increase the loudness of the resulting signal.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.