no-OS
Functions | Variables
maxim_pwm.c File Reference

Maxim platform specific implementation PWM API. More...

#include "tmr.h"
#include "mxc_pins.h"
#include "no_os_alloc.h"
#include "no_os_error.h"
#include "no_os_util.h"
#include "no_os_units.h"
#include "maxim_pwm.h"
Include dependency graph for maxim_pwm.c:

Functions

int max_pwm_enable (struct no_os_pwm_desc *desc)
 Enable the PWM. More...
 
int max_pwm_disable (struct no_os_pwm_desc *desc)
 Disable the PWM. More...
 
int max_pwm_set_period (struct no_os_pwm_desc *desc, uint32_t period_ns)
 Set the PWM period. More...
 
int max_pwm_get_period (struct no_os_pwm_desc *desc, uint32_t *period_ns)
 Get the PWM period. More...
 
int max_pwm_set_duty_cycle (struct no_os_pwm_desc *desc, uint32_t duty_cycle_ns)
 Set the PWM duty cycle. More...
 
int max_pwm_get_duty_cycle (struct no_os_pwm_desc *desc, uint32_t *duty_cycle_ns)
 Get the PWM duty cycle. More...
 
int max_pwm_init (struct no_os_pwm_desc **desc, const struct no_os_pwm_init_param *param)
 Initialize the PWM. More...
 
int max_pwm_remove (struct no_os_pwm_desc *desc)
 Free the resources allocated by max_pwm_init(). More...
 

Variables

const struct no_os_pwm_platform_ops max_pwm_ops
 Maxim platform specific callbacks for the PWM API. More...
 

Detailed Description

Maxim platform specific implementation PWM API.

Author
Dragos Bogdan (drago.nosp@m.s.bo.nosp@m.gdan@.nosp@m.anal.nosp@m.og.co.nosp@m.m)

Copyright 2024(c) Analog Devices, Inc.

All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Function Documentation

◆ max_pwm_disable()

int max_pwm_disable ( struct no_os_pwm_desc desc)

Disable the PWM.

Parameters
desc- PWM descriptor.
Returns
0 in case of success, negative error otherwise.

◆ max_pwm_enable()

int max_pwm_enable ( struct no_os_pwm_desc desc)

Enable the PWM.

Parameters
desc- PWM descriptor.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ 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.

Parameters
desc- Pointer where the configured instance is stored.
duty_cycle_ns- PWM duty cycle.
Returns
0 in case of success, negative error code otherwise.

◆ max_pwm_get_period()

int max_pwm_get_period ( struct no_os_pwm_desc desc,
uint32_t *  period_ns 
)

Get the PWM period.

Parameters
desc- Pointer where the configured instance is stored.
period_ns- PWM period.
Returns
0 in case of success, negative error code otherwise.

◆ max_pwm_init()

int max_pwm_init ( struct no_os_pwm_desc **  desc,
const struct no_os_pwm_init_param param 
)

Initialize the PWM.

Parameters
desc- PWM descriptor.
param- The structure containing PWM init parameters.
Returns
0 in case of success, negative error code otherwise.

◆ max_pwm_remove()

int max_pwm_remove ( struct no_os_pwm_desc desc)

Free the resources allocated by max_pwm_init().

Parameters
desc- PWM descriptor
Returns
0 in case of success, negative error code otherwise.

◆ 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.

Parameters
desc- Pointer where the configured instance is stored.
duty_cycle_ns- PWM duty cycle.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ max_pwm_set_period()

int max_pwm_set_period ( struct no_os_pwm_desc desc,
uint32_t  period_ns 
)

Set the PWM period.

Parameters
desc- Pointer where the configured instance is stored.
period_ns- PWM period.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

Variable Documentation

◆ max_pwm_ops

const struct no_os_pwm_platform_ops max_pwm_ops
Initial value:
= {
.pwm_ops_enable = (int32_t (*)())max_pwm_enable,
.pwm_ops_disable = (int32_t (*)())max_pwm_disable,
.pwm_ops_set_period = (int32_t (*)())max_pwm_set_period,
.pwm_ops_get_period = (int32_t (*)())max_pwm_get_period,
.pwm_ops_set_duty_cycle = (int32_t (*)())max_pwm_set_duty_cycle,
.pwm_ops_get_duty_cycle = (int32_t (*)())max_pwm_get_duty_cycle,
.pwm_ops_init = (int32_t (*)())max_pwm_init,
.pwm_ops_remove = (int32_t (*)())max_pwm_remove
}

Maxim platform specific callbacks for the PWM API.

Maxim specific PWM ops.

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:137
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:228
max_pwm_disable
int max_pwm_disable(struct no_os_pwm_desc *desc)
Disable the PWM.
Definition: maxim_pwm.c:86
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:195
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:242
max_pwm_enable
int max_pwm_enable(struct no_os_pwm_desc *desc)
Enable the PWM.
Definition: maxim_pwm.c:74
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:296
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:181