Hi,
Keywords: nrf52832, pwm_driver, two pwms, 6 channels, pwm in sequence
I have four LEDs: three mono white LEDs, one RGB LEDs(three color leds) that produce white color, so occupy six GPIOs.
I am using 2 pwms to control 6 channels for these three mono LEDs and three color LEDs.
I want the four LEDs burning from bottom to top one by one, which means RGB LEDs light up for 1s and then the rest of three mono LEDs controlled by another pwm light up one by one.
I am using while(wait) for RGB to finish its animation and then playback the second pwm otherwise they will play the animation at the same time, but I dont think it is a wise way to do so since it will block the system. Since they are 6 channels, I cannot just use one pwm and nrf_drv_pwm_complex_playback.
//Play RGB white fade in and out for 1s (void)nrf_drv_pwm_simple_playback(&m_pwm0, &seq0, 1, NRF_DRV_PWM_FLAG_STOP); //Wait for RGB animation finishing while(!nrfx_pwm_is_stopped(&m_pwm0)); //Play mono white fade in and out for 1s one by one (void)nrf_drv_pwm_simple_playback(&m_pwm1, &seq1, 1, NRF_DRV_PWM_FLAG_STOP); //Wait for mono white animation finishing while(!nrfx_pwm_is_stopped(&m_pwm1));
Any idea?
Thanks
/CJ