When I init, uninit, and re-init a PWM with pin_polarity set to APP_PWM_POLARITY_ACTIVE_HIGH, the actual polarity of the signal is active low. This also happens when I init and enable, disable and uninit, then init and enable again, which is closer to my true use case.
I'm using nRF51_SDK 8.1.0, with the PWM driver from the devzone thread:
devzone.nordicsemi.com/.../
contained in the file:
pwm_20150806.7z
Example code (error handling removed):
APP_PWM_INSTANCE(PWM2_RG,2);
uint32_t m_blue_pin = 25;
void pwm_init_instance_b()
{
app_pwm_config_t pwm_cfg = APP_PWM_DEFAULT_CONFIG_1CH(1000L, m_blue_pin);
pwm_cfg.pin_polarity[0] = APP_PWM_POLARITY_ACTIVE_HIGH;
app_pwm_init(&PWM1_B, &pwm_cfg, pwm1_ready_callback);
app_pwm_uninit(&PWM1_B);
app_pwm_init(&PWM1_B, &pwm_cfg, pwm1_ready_callback);
app_pwm_enable(&PWM1_B);
while (app_pwm_channel_duty_set(&PWM1_B, 0, 10) == NRF_ERROR_BUSY);
}