Skip to content

Instantly share code, notes, and snippets.

@hlord2000
Created March 11, 2025 18:16
Show Gist options
  • Save hlord2000/2606e2932c30125ee9c92c076da233ee to your computer and use it in GitHub Desktop.
Save hlord2000/2606e2932c30125ee9c92c076da233ee to your computer and use it in GitHub Desktop.
#include <zephyr/kernel.h>
#include <hal/nrf_grtc.h>
/* To use the nRF54L15's GRTC PWM output (P0.03 only)
*
* Requires enabling:
* CONFIG_NRFX_GRTC=y
*/
int main(void)
{
while (true) {
for (int i = 1; i < UINT8_MAX; i++) {
nrf_grtc_pwm_compare_set(NRF_GRTC, i);
nrf_grtc_task_trigger(NRF_GRTC, NRF_GRTC_TASK_PWM_START);
k_msleep(10);
nrf_grtc_task_trigger(NRF_GRTC, NRF_GRTC_TASK_PWM_STOP);
k_msleep(10);
}
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment