The nrfx pwm supports a number of events for a callback:/** @brief PWM driver event type. */typedef enum{ NRFX_PWM_EVT_FINISHED, ///< Sequence playback finished. NRFX_PWM_EVT_END_SEQ0, /**< End of sequence 0 reached. Its data can be safely modified now. */ NRFX_PWM_EVT_END_SEQ1, /**< End of sequence 1 reached. Its data can be safely modified now. */ NRFX_PWM_EVT_STOPPED, ///< The PWM peripheral has been stopped.} nrfx_pwm_evt_type_t;
The underlying peripheral seems to support other events including EVENTS_PWMPERIODEND
/** @brief PWM events. */typedef enum{ NRF_PWM_EVENT_STOPPED = offsetof(NRF_PWM_Type, EVENTS_STOPPED), ///< Response to STOP task, emitted when PWM pulses are no longer generated. NRF_PWM_EVENT_SEQSTARTED0 = offsetof(NRF_PWM_Type, EVENTS_SEQSTARTED[0]), ///< First PWM period started on sequence 0. NRF_PWM_EVENT_SEQSTARTED1 = offsetof(NRF_PWM_Type, EVENTS_SEQSTARTED[1]), ///< First PWM period started on sequence 1. NRF_PWM_EVENT_SEQEND0 = offsetof(NRF_PWM_Type, EVENTS_SEQEND[0]), ///< Emitted at the end of every sequence 0 when its last value has been read from RAM. NRF_PWM_EVENT_SEQEND1 = offsetof(NRF_PWM_Type, EVENTS_SEQEND[1]), ///< Emitted at the end of every sequence 1 when its last value has been read from RAM. NRF_PWM_EVENT_PWMPERIODEND = offsetof(NRF_PWM_Type, EVENTS_PWMPERIODEND), ///< Emitted at the end of each PWM period. NRF_PWM_EVENT_LOOPSDONE = offsetof(NRF_PWM_Type, EVENTS_LOOPSDONE) ///< Concatenated sequences have been played the specified number of times.} nrf_pwm_event_t;I'm in SDK2.7.0 on nrf52840