no-OS
maxim_pwm.h
Go to the documentation of this file.
1 /***************************************************************************/
33 #ifndef MAXIM_PWM_H_
34 #define MAXIM_PWM_H_
35 
36 #include "tmr.h"
37 #include "no_os_pwm.h"
38 #include "no_os_util.h"
39 
40 #define MAX_PWM_TMR_MAX_VAL NO_OS_GENMASK(15, 0)
41 #define MAX_PWM_PRESCALER_VAL(n) ((n - 1) * 16)
42 #define MAX_PWM_PRESCALER_TRUE(n) NO_OS_BIT((n) / 16)
43 #define MAX_PWM_GET_PRESCALER(n) NO_OS_BIT((n) - 1)
44 
46  mxc_gpio_vssel_t vssel;
47 };
48 
49 struct max_pwm_extra {
50  mxc_gpio_vssel_t vssel;
51  mxc_tmr_cfg_t tmr_cfg;
52 };
53 
57 extern const struct no_os_pwm_platform_ops max_pwm_ops;
58 
59 #endif // MAXIM_PWM_H_
no_os_alloc.h
no_os_pwm_desc::duty_cycle_ns
uint32_t duty_cycle_ns
Definition: no_os_pwm.h:101
no_os_pwm_init_param
Structure containing the init parameters needed by the PWM generator.
Definition: no_os_pwm.h:66
max_pwm_extra::tmr_cfg
mxc_tmr_cfg_t tmr_cfg
Definition: maxim_pwm.h:51
MAX_PWM_PRESCALER_TRUE
#define MAX_PWM_PRESCALER_TRUE(n)
Definition: maxim_pwm.h:42
no_os_pwm_desc::id
uint32_t id
Definition: no_os_pwm.h:97
no_os_units.h
Header file of Units.
max_pwm_set_period
int max_pwm_set_period(struct no_os_pwm_desc *desc, uint32_t period_ns)
Set the PWM period.
Definition: maxim_pwm.c:131
no_os_pwm_init_param::period_ns
uint32_t period_ns
Definition: no_os_pwm.h:70
NO_OS_DIV_ROUND_CLOSEST_ULL
#define NO_OS_DIV_ROUND_CLOSEST_ULL(x, y)
Definition: no_os_util.h:56
no_os_pwm_init_param::id
uint32_t id
Definition: no_os_pwm.h:68
no_os_calloc
void * no_os_calloc(size_t nitems, size_t size)
Allocate memory and return a pointer to it, set memory to 0.
Definition: chibios_alloc.c:54
MAX_PWM_TMR_MAX_VAL
#define MAX_PWM_TMR_MAX_VAL
Definition: maxim_pwm.h:40
max_pwm_get_duty_cycle
int max_pwm_get_duty_cycle(struct no_os_pwm_desc *desc, uint32_t *duty_cycle_ns)
Get the PWM duty cycle.
Definition: maxim_pwm.c:226
no_os_pwm_desc::period_ns
uint32_t period_ns
Definition: no_os_pwm.h:99
maxim_pwm.h
Maxim platform specific implementation PWM API.
max_pwm_ops
const struct no_os_pwm_platform_ops max_pwm_ops
Maxim specific PWM ops.
Definition: maxim_pwm.c:309
max_pwm_disable
int max_pwm_disable(struct no_os_pwm_desc *desc)
Disable the PWM.
Definition: maxim_pwm.c:80
maxim_pwm.h
Maxim platform specific implementation PWM API.
no_os_error.h
Error codes definition.
no_os_pwm_init_param::polarity
enum no_os_pwm_polarity polarity
Definition: no_os_pwm.h:76
MAX_PWM_GET_PRESCALER
#define MAX_PWM_GET_PRESCALER(n)
Definition: maxim_pwm.h:43
no_os_pwm_desc::polarity
enum no_os_pwm_polarity polarity
Definition: no_os_pwm.h:105
maxim_pwm.h
Maxim platform specific implementation PWM API.
maxim_pwm.h
Maxim platform specific implementation PWM API.
max_pwm_set_duty_cycle
int max_pwm_set_duty_cycle(struct no_os_pwm_desc *desc, uint32_t duty_cycle_ns)
Set the PWM duty cycle.
Definition: maxim_pwm.c:189
max_pwm_ops
const struct no_os_pwm_platform_ops max_pwm_ops
Maxim platform specific callbacks for the PWM API.
Definition: maxim_pwm.c:309
no_os_pwm_init_param::extra
void * extra
Definition: no_os_pwm.h:86
no_os_pwm_desc
Structure representing an PWM generator device.
Definition: no_os_pwm.h:93
no_os_pwm_init_param::duty_cycle_ns
uint32_t duty_cycle_ns
Definition: no_os_pwm.h:72
no_os_pwm_platform_ops
Structure holding PWM function pointers that point to the platform specific function.
Definition: no_os_pwm.h:125
no_os_pwm.h
Header file of PWM Interface.
no_os_pwm_desc::extra
void * extra
Definition: no_os_pwm.h:117
maxim_pwm.h
Maxim platform specific implementation PWM API.
no_os_free
void no_os_free(void *ptr)
Deallocate memory previously allocated by a call to no_os_calloc or no_os_malloc.
Definition: chibios_alloc.c:69
max_pwm_extra::vssel
mxc_gpio_vssel_t vssel
Definition: maxim_pwm.h:50
no_os_pwm_platform_ops::pwm_ops_enable
int32_t(* pwm_ops_enable)(struct no_os_pwm_desc *)
Definition: no_os_pwm.h:130
max_pwm_init_param::vssel
mxc_gpio_vssel_t vssel
Definition: maxim_pwm.h:46
max_pwm_init_param
Definition: maxim_pwm.h:45
max_pwm_init
int max_pwm_init(struct no_os_pwm_desc **desc, const struct no_os_pwm_init_param *param)
Initialize the PWM.
Definition: maxim_pwm.c:240
max_pwm_enable
int max_pwm_enable(struct no_os_pwm_desc *desc)
Enable the PWM.
Definition: maxim_pwm.c:68
NANO
#define NANO
Definition: no_os_units.h:50
max_pwm_remove
int max_pwm_remove(struct no_os_pwm_desc *desc)
Free the resources allocated by max_pwm_init().
Definition: maxim_pwm.c:294
no_os_util.h
Header file of utility functions.
maxim_pwm.h
Maxim platform specific implementation PWM API.
maxim_pwm.h
Maxim platform specific implementation PWM API.
MAX_PWM_PRESCALER_VAL
#define MAX_PWM_PRESCALER_VAL(n)
Definition: maxim_pwm.h:41
max_pwm_get_period
int max_pwm_get_period(struct no_os_pwm_desc *desc, uint32_t *period_ns)
Get the PWM period.
Definition: maxim_pwm.c:175
max_pwm_extra
Definition: maxim_pwm.h:49