Skip to content

File syn_hrpwm.c

FileList > drivers > syn_hrpwm.c

Go to the source code of this file

High-Resolution Power & Motion Control Driver implementation.

  • #include "../util/syn_assert.h"
  • #include "syn_hrpwm.h"

Public Functions

Type Name
SYN_Status syn_hrpwm_bind_fault (const SYN_HRPWM * hrpwm, uint8_t fault_id)
Bind hardware emergency fault trip protection.
SYN_Status syn_hrpwm_enable (SYN_HRPWM * hrpwm, bool enable)
Enable or disable complementary HRPWM gate drivers.
SYN_Status syn_hrpwm_init (SYN_HRPWM * hrpwm, uint8_t channel, uint32_t freq_hz)
Initialize a High-Resolution PWM driver channel.
SYN_Status syn_hrpwm_set_deadtime_ns (SYN_HRPWM * hrpwm, uint16_t rise_ns, uint16_t fall_ns)
Configure complementary dead-time insertion.
SYN_Status syn_hrpwm_set_duty_float (const SYN_HRPWM * hrpwm, float duty_float)
Set high-resolution duty cycle ratio using float (0.0 to 1.0).
SYN_Status syn_hrpwm_set_duty_q16 (const SYN_HRPWM * hrpwm, int32_t duty_q16)
Set high-resolution duty cycle ratio using Q16.16 fixed-point format.
SYN_Status syn_hrpwm_set_phase_deg (SYN_HRPWM * hrpwm, uint16_t phase_deg)
Set channel phase shift offset in degrees.

Public Functions Documentation

function syn_hrpwm_bind_fault

Bind hardware emergency fault trip protection.

SYN_Status syn_hrpwm_bind_fault (
    const SYN_HRPWM * hrpwm,
    uint8_t fault_id
) 

Parameters:

  • hrpwm Initialized HRPWM handle.
  • fault_id Hardware fault pin/comparator ID.

Returns:

SYN_OK on success.


function syn_hrpwm_enable

Enable or disable complementary HRPWM gate drivers.

SYN_Status syn_hrpwm_enable (
    SYN_HRPWM * hrpwm,
    bool enable
) 

Parameters:

  • hrpwm Initialized HRPWM handle.
  • enable true to enable outputs, false to disable.

Returns:

SYN_OK on success.


function syn_hrpwm_init

Initialize a High-Resolution PWM driver channel.

SYN_Status syn_hrpwm_init (
    SYN_HRPWM * hrpwm,
    uint8_t channel,
    uint32_t freq_hz
) 

Parameters:

  • hrpwm Handle to initialize. Must not be NULL.
  • channel Platform channel index.
  • freq_hz Target switching frequency in Hz.

Returns:

SYN_OK on success, SYN_INVALID_PARAM on invalid argument.


function syn_hrpwm_set_deadtime_ns

Configure complementary dead-time insertion.

SYN_Status syn_hrpwm_set_deadtime_ns (
    SYN_HRPWM * hrpwm,
    uint16_t rise_ns,
    uint16_t fall_ns
) 

Parameters:

  • hrpwm Initialized HRPWM handle.
  • rise_ns High-side rise dead-time in nanoseconds.
  • fall_ns Low-side fall dead-time in nanoseconds.

Returns:

SYN_OK on success.


function syn_hrpwm_set_duty_float

Set high-resolution duty cycle ratio using float (0.0 to 1.0).

SYN_Status syn_hrpwm_set_duty_float (
    const SYN_HRPWM * hrpwm,
    float duty_float
) 

Parameters:

  • hrpwm Initialized HRPWM handle.
  • duty_float Duty ratio (0.0f = 0%, 1.0f = 100%).

Returns:

SYN_OK on success.


function syn_hrpwm_set_duty_q16

Set high-resolution duty cycle ratio using Q16.16 fixed-point format.

SYN_Status syn_hrpwm_set_duty_q16 (
    const SYN_HRPWM * hrpwm,
    int32_t duty_q16
) 

Parameters:

  • hrpwm Initialized HRPWM handle.
  • duty_q16 Duty ratio in Q16.16 (0 = 0%, 65536 = 100%).

Returns:

SYN_OK on success.


function syn_hrpwm_set_phase_deg

Set channel phase shift offset in degrees.

SYN_Status syn_hrpwm_set_phase_deg (
    SYN_HRPWM * hrpwm,
    uint16_t phase_deg
) 

Parameters:

  • hrpwm Initialized HRPWM handle.
  • phase_deg Phase angle offset in degrees (0–360).

Returns:

SYN_OK on success.



The documentation for this class was generated from the following file src/syntropic/drivers/syn_hrpwm.c