no-OS
Classes | Enumerations | Functions
no_os_pwm.h File Reference

Header file of PWM Interface. More...

#include <stdint.h>
#include <stdbool.h>
Include dependency graph for no_os_pwm.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  no_os_pwm_init_param
 Structure containing the init parameters needed by the PWM generator. More...
 
struct  no_os_pwm_desc
 Structure representing an PWM generator device. More...
 

Enumerations

enum  no_os_pwm_polarity {
  NO_OS_PWM_POLARITY_HIGH,
  NO_OS_PWM_POLARITY_LOW
}
 Possible polarities of the PWM signal. More...
 

Functions

int32_t no_os_pwm_init (struct no_os_pwm_desc **desc, const struct no_os_pwm_init_param *param)
 Initialize the pwm axi generator and the handler associated with it. More...
 
int32_t no_os_pwm_remove (struct no_os_pwm_desc *desc)
 Free the memory allocated by axi_pwmgen_init(). More...
 
int32_t no_os_pwm_enable (struct no_os_pwm_desc *desc)
 Enable PWM generator device. More...
 
int32_t no_os_pwm_disable (struct no_os_pwm_desc *desc)
 Disable PWM generator device. More...
 
int32_t no_os_pwm_set_period (struct no_os_pwm_desc *desc, uint32_t period_ns)
 Set period of PWM generator device. More...
 
int32_t no_os_pwm_get_period (struct no_os_pwm_desc *desc, uint32_t *period_ns)
 Get period of PWM generator device. More...
 
int32_t no_os_pwm_set_duty_cycle (struct no_os_pwm_desc *desc, uint32_t duty_cycle_ns)
 Set duty cycle of PWM generator device. More...
 
int32_t no_os_pwm_get_duty_cycle (struct no_os_pwm_desc *desc, uint32_t *duty_cycle_ns)
 Get duty cycle of PWM generator device. More...
 
int32_t no_os_pwm_set_phase (struct no_os_pwm_desc *desc, uint32_t phase_ns)
 Set phase of PWM generator device. More...
 
int32_t no_os_pwm_get_phase (struct no_os_pwm_desc *desc, uint32_t *phase_ns)
 Get phase of PWM generator device. More...
 
int32_t no_os_pwm_set_polarity (struct no_os_pwm_desc *desc, enum no_os_pwm_polarity polarity)
 
int32_t no_os_pwm_get_polarity (struct no_os_pwm_desc *desc, enum no_os_pwm_polarity *polarity)
 

Detailed Description

Header file of PWM Interface.

Author
Cristian Pop (crist.nosp@m.ian..nosp@m.pop@a.nosp@m.nalo.nosp@m.g.com)

Copyright 2020(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.

Enumeration Type Documentation

◆ no_os_pwm_polarity

Possible polarities of the PWM signal.

Enumerator
NO_OS_PWM_POLARITY_HIGH 

PWM duty cycle is high, idle low

NO_OS_PWM_POLARITY_LOW 

PWM duty cycle is low, idle high

Function Documentation

◆ no_os_pwm_disable()

int32_t no_os_pwm_disable ( struct no_os_pwm_desc desc)

Disable PWM generator device.

Parameters
[in]desc- Decriptor containing PWM generator parameters.
Returns
0 in case of success, -1 otherwise.
Here is the caller graph for this function:

◆ no_os_pwm_enable()

int32_t no_os_pwm_enable ( struct no_os_pwm_desc desc)

Enable PWM generator device.

Parameters
[in]desc- Decriptor containing PWM generator parameters.
Returns
0 in case of success, -1 otherwise.
Here is the caller graph for this function:

◆ no_os_pwm_get_duty_cycle()

int32_t no_os_pwm_get_duty_cycle ( struct no_os_pwm_desc desc,
uint32_t *  duty_cycle_ns 
)

Get duty cycle of PWM generator device.

Parameters
[in]desc- Decriptor containing PWM generator parameters.
[out]duty_cycle_ns- PWM duty cycle.
Returns
0 in case of success, -1 otherwise.

◆ no_os_pwm_get_period()

int32_t no_os_pwm_get_period ( struct no_os_pwm_desc desc,
uint32_t *  period_ns 
)

Get period of PWM generator device.

Parameters
[in]desc- Decriptor containing PWM generator parameters.
[out]period_ns- PWM period.
Returns
0 in case of success, -1 otherwise.

◆ no_os_pwm_get_phase()

int32_t no_os_pwm_get_phase ( struct no_os_pwm_desc desc,
uint32_t *  phase_ns 
)

Get phase of PWM generator device.

Parameters
[in]desc- Decriptor containing PWM generator parameters.
[out]phase_ns- PWM phase.
Returns
0 in case of success, -1 otherwise.

◆ no_os_pwm_get_polarity()

int32_t no_os_pwm_get_polarity ( struct no_os_pwm_desc desc,
enum no_os_pwm_polarity polarity 
)

◆ no_os_pwm_init()

int32_t no_os_pwm_init ( struct no_os_pwm_desc **  desc,
const struct no_os_pwm_init_param param 
)

Initialize the pwm axi generator and the handler associated with it.

Parameters
[out]desc- Decriptor containing PWM generator parameters.
[in]param- Structure containing the PWM generator init parameters.
Returns
0 in case of success, -1 otherwise.
Here is the caller graph for this function:

◆ no_os_pwm_remove()

int32_t no_os_pwm_remove ( struct no_os_pwm_desc desc)

Free the memory allocated by axi_pwmgen_init().

Parameters
[in]desc- Pointer to the device handler.
Returns
0 in case of success, -1 otherwise
Here is the caller graph for this function:

◆ no_os_pwm_set_duty_cycle()

int32_t no_os_pwm_set_duty_cycle ( struct no_os_pwm_desc desc,
uint32_t  duty_cycle_ns 
)

Set duty cycle of PWM generator device.

Parameters
[in]desc- Decriptor containing PWM generator parameters.
[in]duty_cycle_ns- PWM duty cycle.
Returns
0 in case of success, -1 otherwise.

◆ no_os_pwm_set_period()

int32_t no_os_pwm_set_period ( struct no_os_pwm_desc desc,
uint32_t  period_ns 
)

Set period of PWM generator device.

Parameters
[in]desc- Decriptor containing PWM generator parameters.
[in]period_ns- PWM period.
Returns
0 in case of success, -1 otherwise.

◆ no_os_pwm_set_phase()

int32_t no_os_pwm_set_phase ( struct no_os_pwm_desc desc,
uint32_t  phase_ns 
)

Set phase of PWM generator device.

Parameters
[in]desc- Decriptor containing PWM generator parameters.
[in]phase_ns- PWM phase.
Returns
0 in case of success, -1 otherwise.

◆ no_os_pwm_set_polarity()

int32_t no_os_pwm_set_polarity ( struct no_os_pwm_desc desc,
enum no_os_pwm_polarity  polarity 
)