NEORV32 Software Framework Documentation
The NEORV32 RISC-V Processor
Loading...
Searching...
No Matches
neorv32_pwm.h
Go to the documentation of this file.
1// ================================================================================ //
2// The NEORV32 RISC-V Processor - https://github.com/stnolting/neorv32 //
3// Copyright (c) NEORV32 contributors. //
4// Copyright (c) 2020 - 2025 Stephan Nolting. All rights reserved. //
5// Licensed under the BSD-3-Clause license, see LICENSE for details. //
6// SPDX-License-Identifier: BSD-3-Clause //
7// ================================================================================ //
8
13
14#ifndef NEORV32_PWM_H
15#define NEORV32_PWM_H
16
17#include <stdint.h>
18
19
20/**********************************************************************/
25typedef volatile struct __attribute__((packed,aligned(4))) {
26 uint32_t CHANNEL_CFG[16];
28
30#define NEORV32_PWM ((neorv32_pwm_t*) (NEORV32_PWM_BASE))
31
43
44
45
46/**********************************************************************/
50int neorv32_pwm_available(void);
52void neorv32_pwm_ch_enable(int channel);
53void neorv32_pwm_ch_disable(int channel);
54void neorv32_pwm_ch_set_clock(int channel, int prsc, int cdiv);
55void neorv32_pwm_ch_set_duty(int channel, int duty);
57
58#endif // NEORV32_PWM_H
int neorv32_pmw_get_num_channels(void)
Definition neorv32_pwm.c:43
void neorv32_pwm_ch_set_duty(int channel, int duty)
Definition neorv32_pwm.c:108
void neorv32_pwm_ch_set_clock(int channel, int prsc, int cdiv)
Definition neorv32_pwm.c:90
void neorv32_pwm_ch_disable(int channel)
Definition neorv32_pwm.c:75
CHANNEL_CFG_enum
Definition neorv32_pwm.h:33
@ PWM_CFG_EN
Definition neorv32_pwm.h:41
@ PWM_CFG_CDIV_MSB
Definition neorv32_pwm.h:37
@ PWM_CFG_DUTY_LSB
Definition neorv32_pwm.h:34
@ PWM_CFG_PRSC_MSB
Definition neorv32_pwm.h:40
@ PWM_CFG_CDIV_LSB
Definition neorv32_pwm.h:36
@ PWM_CFG_PRSC_LSB
Definition neorv32_pwm.h:39
@ PWM_CFG_DUTY_MSB
Definition neorv32_pwm.h:35
void neorv32_pwm_ch_enable(int channel)
Definition neorv32_pwm.c:62
int neorv32_pwm_available(void)
Definition neorv32_pwm.c:26
Definition neorv32_pwm.h:25
uint32_t CHANNEL_CFG[16]
Definition neorv32_pwm.h:26