25.8.4.1.2 Code

Add to the main application source file, before any functions:
#define CONF_PWM_MODULE      LED_0_PWM4CTRL_MODULE

#define CONF_PWM_CHANNEL     LED_0_PWM4CTRL_CHANNEL

#define CONF_PWM_OUTPUT      LED_0_PWM4CTRL_OUTPUT

#define CONF_PWM_OUT_PIN     LED_0_PWM4CTRL_PIN

#define CONF_PWM_OUT_MUX     LED_0_PWM4CTRL_MUX
Add to the main application source file, outside of any functions:
struct tcc_module tcc_instance;
Copy-paste the following callback function code to your user application:
static void tcc_callback_to_change_duty_cycle(
        struct tcc_module *const module_inst)
{
    static uint32_t delay = 10;
    static uint32_t i = 0;

    if (--delay) {
        return;
    }
    delay = 10;
    i = (i + 0x0800) & 0xFFFF;
    tcc_set_compare_value(module_inst,
            (enum tcc_match_capture_channel)
                    (TCC_MATCH_CAPTURE_CHANNEL_0 + CONF_PWM_CHANNEL),
            i + 1);
}
Copy-paste the following setup code to your user application:
static void configure_tcc(void)
{
    struct tcc_config config_tcc;
    tcc_get_config_defaults(&config_tcc, CONF_PWM_MODULE);

    config_tcc.counter.period = 0xFFFF;
    config_tcc.compare.wave_generation = TCC_WAVE_GENERATION_SINGLE_SLOPE_PWM;
    config_tcc.compare.match[CONF_PWM_CHANNEL] = 0xFFFF;

    config_tcc.pins.enable_wave_out_pin[CONF_PWM_OUTPUT] = true;
    config_tcc.pins.wave_out_pin[CONF_PWM_OUTPUT]        = CONF_PWM_OUT_PIN;
    config_tcc.pins.wave_out_pin_mux[CONF_PWM_OUTPUT]    = CONF_PWM_OUT_MUX;

    tcc_init(&tcc_instance, CONF_PWM_MODULE, &config_tcc);

    tcc_enable(&tcc_instance);
}

static void configure_tcc_callbacks(void)
{
    tcc_register_callback(
            &tcc_instance,
            tcc_callback_to_change_duty_cycle,
            (enum tcc_callback)(TCC_CALLBACK_CHANNEL_0 + CONF_PWM_CHANNEL));

    tcc_enable_callback(&tcc_instance,
            (enum tcc_callback)(TCC_CALLBACK_CHANNEL_0 + CONF_PWM_CHANNEL));
}
Add to user application initialization (typically the start of main()):
configure_tcc();
configure_tcc_callbacks();