Kamcho Library 02.00.03  lib.kamcho.02.00.03.287
Functions | Variables
pwm_device.c File Reference
#include <stdint.h>
#include <string.h>
#include "hdf.h"
#include "errno.h"
#include "pwm_device.h"

Functions

int32_t PWM_devSetPeriod (PWM_Device_t *dev, uint32_t period)
 Set period of a PWM driver. More...
 
int32_t PWM_devSetWidth (PWM_Device_t *dev, uint32_t width)
 Set width of a PWM driver. More...
 
int32_t PWM_devSetClockDivider (PWM_Device_t *dev, uint8_t div)
 Set pre-scaler of a PWM driver. More...
 
int32_t PWM_devInvertEnable (PWM_Device_t *dev)
 Enable PWM inverter. More...
 
int32_t PWM_devInvertDisable (PWM_Device_t *dev)
 Disable PWM inverter. More...
 
int32_t PWM_devEnable (PWM_Device_t *dev)
 Enable PWM driver. More...
 
int32_t PWM_devDisable (PWM_Device_t *dev)
 Disable PWM driver. More...
 
PWM_Device_tPWM_devRequest (const char *name)
 Request a PWM Device. More...
 

Variables

static PWM_Device_t PWM1_Device
 The instance of PMW1 device. More...
 
static PWM_Device_t PWM2_Device
 The instance of PMW2 device. More...
 
static const PWM_Device_tPWM_DeviceTable []
 The table of PWM device instances supported by the platform. More...
 

Detailed Description

This file is proprietary to Indie Semiconductor. All rights reserved. Reproduction or distribution, in whole or in part, is forbidden except by express written permission of Indie Semiconductor.

Function Documentation

int32_t PWM_devDisable ( PWM_Device_t dev)

Disable PWM driver.

Parameters
devThe pointer to PWM_Device structure.
Returns
0 for success or error code upon a failure.
int32_t PWM_devEnable ( PWM_Device_t dev)

Enable PWM driver.

Parameters
devThe pointer to PWM_Device structure.
Returns
0 for success or error code upon a failure.
int32_t PWM_devInvertDisable ( PWM_Device_t dev)

Disable PWM inverter.

Parameters
devThe pointer to PWM_Device structure.
Returns
0 for success or error code upon a failure.
int32_t PWM_devInvertEnable ( PWM_Device_t dev)

Enable PWM inverter.

Parameters
devThe pointer to PWM_Device structure.
Returns
0 for success or error code upon a failure.
PWM_Device_t* PWM_devRequest ( const char *  name)

Request a PWM Device.

Parameters
nameThe name string of PWM device.
Returns
The pointer to the PWM device instance.
int32_t PWM_devSetClockDivider ( PWM_Device_t dev,
uint8_t  div 
)

Set pre-scaler of a PWM driver.

Parameters
devThe pointer to PWM_Device structure.
divthe setting for clock divider.
Returns
0 for success or error code upon a failure.
int32_t PWM_devSetPeriod ( PWM_Device_t dev,
uint32_t  period 
)

Set period of a PWM driver.

Parameters
devThe pointer to PWM_Device structure.
periodpercentage of PWM period
Returns
0 for success or error code upon a failure.
int32_t PWM_devSetWidth ( PWM_Device_t dev,
uint32_t  width 
)

Set width of a PWM driver.

Parameters
devThe pointer to PWM_Device structure.
widthpercentage of PWM width
Returns
0 for success or error code upon a failure.

Variable Documentation

PWM_Device_t PWM1_Device
static
Initial value:
= {
.Name = "PWM1",
.SetPeriod = f_PWM1_SetPeriod,
.SetWidth = f_PWM1_SetWidth,
.SetPreScaler = f_PWM1_SetPreScaler,
.InvertOn = f_PWM1_InvertOn,
.Enable = f_PWM1_Enable,
.InvertOff = f_PWM1_InvertOff,
.Disable = f_PWM1_Disable,
}
static __INLINE void f_PWM1_InvertOff(void)
Disable on inverter for PWM1.
Definition: pwm_sfrs.h:97
static __INLINE void f_PWM1_SetPreScaler(uint8_t div)
Set clock pre-scaler for PWM1.
Definition: pwm_sfrs.h:81
static __INLINE void f_PWM1_Disable(void)
Disable PWM1.
Definition: pwm_sfrs.h:113
static __INLINE void f_PWM1_InvertOn(void)
Enable on inverter for PWM1.
Definition: pwm_sfrs.h:89
static __INLINE void f_PWM1_SetWidth(uint32_t width)
Set width for PWM1.
Definition: pwm_sfrs.h:70
static __INLINE void f_PWM1_Enable(void)
Enable PWM1.
Definition: pwm_sfrs.h:105
static __INLINE void f_PWM1_SetPeriod(uint32_t period)
Set period for PWM1.
Definition: pwm_sfrs.h:59

The instance of PMW1 device.

PWM_Device_t PWM2_Device
static
Initial value:
= {
.Name = "PWM2",
.SetPeriod = f_PWM2_SetPeriod,
.SetWidth = f_PWM2_SetWidth,
.SetPreScaler = f_PWM2_SetPreScaler,
.InvertOn = f_PWM2_InvertOn,
.Enable = f_PWM2_Enable,
.InvertOff = f_PWM2_InvertOff,
.Disable = f_PWM2_Disable,
}
static __INLINE void f_PWM2_SetPeriod(uint32_t period)
Set period for PWM2.
Definition: pwm_sfrs.h:162
static __INLINE void f_PWM2_InvertOff(void)
Disable on inverter for PWM2.
Definition: pwm_sfrs.h:200
static __INLINE void f_PWM2_Enable(void)
Enable PWM2.
Definition: pwm_sfrs.h:208
static __INLINE void f_PWM2_SetWidth(uint32_t width)
Set width for PWM2.
Definition: pwm_sfrs.h:173
static __INLINE void f_PWM2_InvertOn(void)
Enable on inverter for PWM2.
Definition: pwm_sfrs.h:192
static __INLINE void f_PWM2_Disable(void)
Disable PWM2.
Definition: pwm_sfrs.h:216
static __INLINE void f_PWM2_SetPreScaler(uint8_t div)
Set clock pre-scaler for PWM2.
Definition: pwm_sfrs.h:184

The instance of PMW2 device.

const PWM_Device_t* PWM_DeviceTable[]
static
Initial value:
= {
NULL,
}
static PWM_Device_t PWM2_Device
The instance of PMW2 device.
Definition: pwm_device.c:39
static PWM_Device_t PWM1_Device
The instance of PMW1 device.
Definition: pwm_device.c:23

The table of PWM device instances supported by the platform.