NEORV32 API Reference
The NEORV32 RISC-V Processor
Loading...
Searching...
No Matches
neorv32_pwm.h File Reference

Pulse-Width Modulation Controller (PWM) HW driver header file. More...

#include <stdint.h>

Go to the source code of this file.

Data Structures

struct  neorv32_pwm_t
 

Macros

IO Device: Pulse Width Modulation Controller (PWM)
#define NEORV32_PWM   ((neorv32_pwm_t*) (NEORV32_PWM_BASE))
 

Functions

Prototypes
int neorv32_pwm_available (void)
 
int neorv32_pmw_get_num_channels (void)
 
void neorv32_pwm_set_clock (int prsc)
 
void neorv32_pwm_ch_enable_mask (uint32_t mask)
 
void neorv32_pwm_ch_disable_mask (uint32_t mask)
 
void neorv32_pwm_ch_enable_single (int ch)
 
void neorv32_pwm_ch_disable_single (int ch)
 
void neorv32_pwm_ch_setup (int ch, int top, int pol)
 
void neorv32_pwm_ch_set_duty (int ch, int duty)
 

Detailed Description

Pulse-Width Modulation Controller (PWM) HW driver header file.

Macro Definition Documentation

◆ NEORV32_PWM

#define NEORV32_PWM   ((neorv32_pwm_t*) (NEORV32_PWM_BASE))

PWM module hardware handle (neorv32_pwm_t)

Function Documentation

◆ neorv32_pmw_get_num_channels()

int neorv32_pmw_get_num_channels ( void )

Get number of implemented PWM channels.

Warning
This function overrides the POLARITY register.
Returns
Number of implemented PWM channels.

◆ neorv32_pwm_available()

int neorv32_pwm_available ( void )

Check if PWM unit was synthesized.

Returns
0 if PWM was not synthesized, non-zero if PWM is available.

◆ neorv32_pwm_ch_disable_mask()

void neorv32_pwm_ch_disable_mask ( uint32_t mask)

Disable PWM channel using bit mask.

Parameters
[in]maskChannel bit mask (16 bits).

◆ neorv32_pwm_ch_disable_single()

void neorv32_pwm_ch_disable_single ( int ch)

Disable individual PWM channel using bit mask.

Parameters
[in]chChannel select (0..16).

◆ neorv32_pwm_ch_enable_mask()

void neorv32_pwm_ch_enable_mask ( uint32_t mask)

Enable PWM channel using bit mask.

Parameters
[in]maskChannel bit mask (16 bits).

◆ neorv32_pwm_ch_enable_single()

void neorv32_pwm_ch_enable_single ( int ch)

Enable individual PWM channel.

Parameters
[in]chChannel select (0..16).

◆ neorv32_pwm_ch_set_duty()

void neorv32_pwm_ch_set_duty ( int ch,
int duty )

Set PWM channel's duty cycle.

Parameters
[in]chChannel select (0..15).
[in]dutyDuty cycle (16-bit).

◆ neorv32_pwm_ch_setup()

void neorv32_pwm_ch_setup ( int ch,
int top,
int pol )

Configure a single channel's wrap value and polarity.

Parameters
[in]chChannel select (0..15).
[in]topWrap value for PWM counter (16-bit).
[in]polIdle polarity of PWM output (0 or 1).

◆ neorv32_pwm_set_clock()

void neorv32_pwm_set_clock ( int prsc)

Set global PWM counter clock prescaler.

Parameters
[in]prscClock prescaler select (0..7). See NEORV32_CLOCK_PRSC_enum.