Hello,
I want to control 2 PWM with different frequencies and hence I am using two separate instances. I want to use only the hardware and not the PWM library. Initializing and everything works fine but when I call the PWM in main loop, the second PWM's duty cycle is fed into the first one as well.
Code's as below :
pwm1()
{
nrf_pwm_values_common_t seq_values[] = {100 - x};
nrf_pwm_sequence_t const seq =
{
.values.p_common = seq_values,
.length = NRF_PWM_VALUES_LENGTH(seq_values),
.repeats = 0,
.end_delay = 0
};
nrf_drv_pwm_simple_playback(&m_pwm0, &seq, 1, NRF_DRV_PWM_FLAG_LOOP);
}
pwm2()
{
nrf_pwm_values_common_t seq_values_2[] = {100 - count};
nrf_pwm_sequence_t const seq_2 =
{
.values.p_common = seq_values_2,
.length = NRF_PWM_VALUES_LENGTH(seq_values_2),
.repeats = 0,
.end_delay = 0
};
nrf_drv_pwm_simple_playback(&m_pwm1, &seq_2, 1, NRF_DRV_PWM_FLAG_LOOP);
}
void main()
{
// Initialise...
for (;;)
{
idle_state_handle();
pwm1();
pwm2();
}
}