NEORV32 Software Framework Documentation
The NEORV32 RISC-V Processor
|
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 |
Functions | |
Prototypes | |
int | neorv32_pwm_available (void) |
int | neorv32_pmw_get_num_channels (void) |
void | neorv32_pwm_ch_enable (int channel) |
void | neorv32_pwm_ch_disable (int channel) |
void | neorv32_pwm_ch_set_clock (int channel, int prsc, int cdiv) |
void | neorv32_pwm_ch_set_duty (int channel, int duty) |
IO Device: Pulse Width Modulation Controller (PWM) | |
#define | NEORV32_PWM ((neorv32_pwm_t*) (NEORV32_PWM_BASE)) |
enum | CHANNEL_CFG_enum { PWM_CFG_DUTY_LSB = 0 , PWM_CFG_DUTY_MSB = 7 , PWM_CFG_CDIV_LSB = 8 , PWM_CFG_CDIV_MSB = 17 , PWM_CFG_PRSC_LSB = 28 , PWM_CFG_PRSC_MSB = 30 , PWM_CFG_EN = 31 } |
Pulse-Width Modulation Controller (PWM) HW driver header file.
#define NEORV32_PWM ((neorv32_pwm_t*) (NEORV32_PWM_BASE)) |
PWM module hardware access (neorv32_pwm_t)
enum CHANNEL_CFG_enum |
PWM channel configuration bits
int neorv32_pmw_get_num_channels | ( | void | ) |
Get number of implemented PWM channels.
int neorv32_pwm_available | ( | void | ) |
Check if PWM unit was synthesized.
void neorv32_pwm_ch_disable | ( | int | channel | ) |
Disable PWM channel.
[in] | channel | Channel select (0..15). |
void neorv32_pwm_ch_enable | ( | int | channel | ) |
Enable PWM channel.
[in] | channel | Channel select (0..15). |
void neorv32_pwm_ch_set_clock | ( | int | channel, |
int | prsc, | ||
int | cdiv ) |
Set PWM channel's clock configuration.
[in] | channel | Channel select (0..15). |
[in] | prsc | Coarse clock prescaler select (3-bit, LSB-aligned). See NEORV32_CLOCK_PRSC_enum. |
[in] | cdiv | Fine clock divider value (10-bit, LSB-aligned). |
void neorv32_pwm_ch_set_duty | ( | int | channel, |
int | duty ) |
Set PWM channel's duty cycle.
[in] | channel | Channel select (0..15). |
[in] | duty | Duty cycle (8-bit, LSB-aligned). |