Totally get the limitation of 3 PWM channels.
Wondering if I can dynamically re-assign which 3 pins are tied to the PWM outputs.
At boot time, I call this function:
static void pwm_init(void) { nrf_pwm_config_t pwm_config = PWM_DEFAULT_CONFIG;
pwm_config.mode = PWM_MODE_MTR_255; pwm_config.num_channels = 3; pwm_config.gpio_num[0] = PWMA1; pwm_config.gpio_num[1] = PWMA2; pwm_config.gpio_num[2] = PWMB2;
// Initialize the PWM library nrf_pwm_init(&pwm_config); }
Then later on, I call a new function: static void pwm_init2(void) { nrf_pwm_config_t pwm_config = PWM_DEFAULT_CONFIG;
pwm_config.mode = PWM_MODE_MTR_255; pwm_config.num_channels = 3; pwm_config.gpio_num[0] = ANOTHER_PWM_A1; pwm_config.gpio_num[1] = ANOTHER_PWM_A2; pwm_config.gpio_num[2] = ANOTHER_PWM_B2;
// Initialize the PWM library nrf_pwm_init(&pwm_config); }
If not, are there other ways to accomplish this? Basically, at any given time, I just need 2 PWM signals. But I want to be able to dynamically assign those signals to any 2 of 4 pins…