quasar_pwm.h

This module provides functions to control and configure PWM.

Copyright

Copyright (C) 2026 SPARK Microsystems International Inc. All rights reserved.

License

This source code is proprietary and subject to the SPARK Microsystems Software EULA found in this package in file EULA.txt.

Author

SPARK FW Team.

Typedefs

typedef enum quasar_pwm_channel quasar_pwm_channel_t

Available channel for a timer.

Note

Refer to the reference manual to ensure that the channel is available for the selected timer.

typedef struct quasar_pwm_config quasar_pwm_config_t

Configuration settings for a PWM.

Note

Refer to the reference manual to ensure that the timer can generate PWM.

Enums

enum quasar_pwm_channel

Available channel for a timer.

Note

Refer to the reference manual to ensure that the channel is available for the selected timer.

Values:

enumerator QUASAR_PWM_CHANNEL_1 = 1

Timer channel 1.

enumerator QUASAR_PWM_CHANNEL_2 = 2

Timer channel 2.

enumerator QUASAR_PWM_CHANNEL_3 = 3

Timer channel 3.

enumerator QUASAR_PWM_CHANNEL_4 = 4

Timer channel 4.

Functions

void quasar_pwm_init(quasar_pwm_config_t *pwm_config)

Initialize the GPIO and the timer linked to the PWM as well as the PWM itself.

Parameters:

pwm_config[in] Configuration of the PWM.

void quasar_pwm_deinit(quasar_pwm_config_t pwm_config)

Deinitialize the GPIO and the timer linked to the PWM as well as the PWM itself.

Parameters:

pwm_config[in] Configuration of the PWM.

void quasar_pwm_set_duty_cycle(quasar_pwm_config_t *pwm_config, uint8_t new_duty_cycle_percent)

Configure the duty cycle of the PWM.

Parameters:
  • pwm_config[in] Configuration of the PWM.

  • new_duty_cycle_percent[in] Duty cycle to set.

struct quasar_pwm_config
#include <quasar_pwm.h>

Configuration settings for a PWM.

Note

Refer to the reference manual to ensure that the timer can generate PWM.

Public Members

quasar_timer_config_t timer_config

Configuration of the timer used for PWM.

quasar_pwm_channel_t timer_channel

Timer channel used for the PWM output.

uint8_t duty_cycle

PWM output’s duty cycle percentage (0 - 100).

quasar_gpio_config_t gpio_config

GPIO used for the PWM output.