📄 genericpwm.c
字号:
//*****************************************************************************
//*****************************************************************************
// FILENAME: `@LIB_NAME`_GENERICPWM.c
// Version: 1.3.0.1, Updated on 2007/05/18 at 17:39:01
// Application: PSoC Express 2.0
//
// DESCRIPTION: This Driver controls the Generic PWM parameters and returns
// the percent duty cycle for the selected channel.
//-----------------------------------------------------------------------------
// Copyright (c) Cypress MicroSystems 2004-2005. All Rights Reserved.
//*****************************************************************************
//*****************************************************************************
#include "m8c.h"
#include "`@LIB_NAME`_GENERICPWM.h"
#include "cmx.h"
// Channel type header file
#include "cmx_pwm_chan.h"
//-----------------------------------------------------------------------------
// FUNCTION NAME: GENERICPWM_Instantiate(const `@LIB_NAME`_GERNERICPWM_ParameterBlock * thisBLK)
//
// DESCRIPTION:
// GENERICPWM Initialization
//
//-----------------------------------------------------------------------------
//
// ARGUMENTS:
// thisBLK => Pointer to parameter Block for this instance.
//
// RETURNS: None
//
// SIDE EFFECTS:
//
// THEORY of OPERATION or PROCEDURE: Initialization for GENERICPWM
// Initial conditions set based on parameters set in
// GENERICPWM Parameter block
//-----------------------------------------------------------------------------
void `@LIB_NAME`_GENERICPWM_Instantiate(const `@LIB_NAME`_GENERICPWM_ParameterBlock * thisBLK)
{
BYTE Instance;
BYTE Polarity;
Instance = thisBLK->GENERICPWM_ChannelID;
Polarity = thisBLK->GENERICPWM_Polarity;
PWMSetPolarity(Instance,Polarity);
PWMSetDutyCycle(Instance, 0);
PWMStart(Instance);
}
//-----------------------------------------------------------------------------
// FUNCTION NAME: GENERICPWM_SetValue(const `@LIB_NAME`_GENERICPWM_ParameterBlock * thisBLK, BYTE bPercent_DutyCycle)
//
// DESCRIPTION:
// Sets Percent Duty Cycle Value for given instance.
//
//-----------------------------------------------------------------------------
//
// ARGUMENTS:
// thisBLK => Pointer to parameter Block for this instance.
// bPercent_DutyCycle => Percent duty cycle in which to set PWM.
//
// RETURNS: None
//
// SIDE EFFECTS:
//
// THEORY of OPERATION or PROCEDURE: Initialization for GENERICPWM
// Parameters set in GENERICPWM Parameter block
//-----------------------------------------------------------------------------
void `@LIB_NAME`_GENERICPWM_SetValue(const `@LIB_NAME`_GENERICPWM_ParameterBlock * thisBLK, BYTE bDutyCycle)
{
BYTE Instance;
Instance = thisBLK->GENERICPWM_ChannelID;
PWMSetDutyCycle(Instance, bDutyCycle);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -