This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

PWM on port 1

How do I use PWM on a GPIO on port 1 on SDK 15.2? The PWM library examples only sends in the pin number and seems to assume port 0. This answer seemed a bit complex and I'm not sure if it is outdated https://devzone.nordicsemi.com/f/nordic-q-a/22983/how-do-i-change-pwm-port-to-1-on-example-low_power_pwm

static void pwm_init(void)
{
    ret_code_t err_code;

    enum { PERIOD_US = 20L};
    /* 1-channel PWM, 50 kHz, output on DK LED pins. */
    app_pwm_config_t pwm0_cfg = APP_PWM_DEFAULT_CONFIG_1CH(PERIOD_US, BSP_LED_2);
$
    /* Initialize and enable PWM. */
    err_code = app_pwm_init(&PWM0, &pwm0_cfg, NULL);
    APP_ERROR_CHECK(err_code);
}

Parents Reply Children
Related