📄 acrelay.c
字号:
/** ###################################################################
** THIS BEAN MODULE IS GENERATED BY THE TOOL. DO NOT MODIFY IT.
** Filename : ACRELAY.C
** Project : PMSM
** Processor : 56F8013VFAE
** Beantype : BitIO
** Version : Bean 02.068, Driver 01.16, CPU db: 2.87.089
** Compiler : Metrowerks DSP C Compiler
** Date/Time : 2008-1-24, 下午 01:45
** Abstract :
** This bean "BitIO" implements an one-bit input/output.
** It uses one bit/pin of a port.
** Methods of this bean are mostly implemented as a macros
** (if supported by target language and compiler).
** Settings :
** Used pin :
** ----------------------------------------------------
** Number (on package) | Name
** ----------------------------------------------------
** 4 | GPIOB5_T1_FAULT3
** ----------------------------------------------------
**
** Port name : GPIOB
**
** Bit number (in port) : 5
** Bit mask of the port : 32
**
** Initial direction : Output (direction can be changed)
** Safe mode : yes
** Initial output value : 0
** Initial pull option : off
**
** Port data register : GPIO_B_DR [61713]
** Port control register : GPIO_B_DDR [61714]
** Port function register : GPIO_B_PER [61715]
**
** Optimization for : speed
** Contents :
** SetDir - void ACRELAY_SetDir(bool Dir);
** GetVal - bool ACRELAY_GetVal(void);
** PutVal - void ACRELAY_PutVal(bool Val);
** ClrVal - void ACRELAY_ClrVal(void);
** SetVal - void ACRELAY_SetVal(void);
**
** (c) Copyright UNIS, spol. s r.o. 1997-2006
** UNIS, spol. s r.o.
** Jundrovska 33
** 624 00 Brno
** Czech Republic
** http : www.processorexpert.com
** mail : info@processorexpert.com
** ###################################################################*/
/* MODULE ACRELAY. */
#include "ACRELAY.h"
/*Include shared modules, which are used for whole project*/
#include "PE_Types.h"
#include "PE_Error.h"
#include "PE_Const.h"
#include "IO_Map.h"
#include "Cpu.h"
/*
** ===================================================================
** Method : ACRELAY_GetVal (bean BitIO)
**
** Description :
** This method returns an input value.
** a) direction = Input : reads the input value from the
** pin and returns it
** b) direction = Output : returns the last written value
** Parameters : None
** Returns :
** --- - Input value. Possible values:
** FALSE - logical "0" (Low level)
** TRUE - logical "1" (High level)
** ===================================================================
*/
/*
bool ACRELAY_GetVal(void)
** This method is implemented as a macro. See ACRELAY.h file. **
*/
/*
** ===================================================================
** Method : ACRELAY_PutVal (bean BitIO)
**
** Description :
** This method writes the new output value.
** a) direction = Input : sets the new output value;
** this operation will be shown on
** output after the direction has
** been switched to output
** (SetDir(TRUE);)
** b) direction = Output : directly writes the value to the
** appropriate pin
** Parameters :
** NAME - DESCRIPTION
** Val - Output value. Possible values:
** FALSE - logical "0" (Low level)
** TRUE - logical "1" (High level)
** Returns : Nothing
** ===================================================================
*/
void ACRELAY_PutVal(bool Val)
{
if (Val) { /* Is it one to be written? */
Shadow_GPIO_B_DR |= ACRELAY_PIN_MASK; /* Set bit in shadow variable */
setRegBits(GPIO_B_DR,ACRELAY_PIN_MASK); /* Set bit on port */
}
else { /* Is it zero to be written? */
Shadow_GPIO_B_DR &= ~ACRELAY_PIN_MASK; /* Clear bit in shadow variable */
clrRegBits(GPIO_B_DR,ACRELAY_PIN_MASK); /* Clear bit on port */
}
}
/*
** ===================================================================
** Method : ACRELAY_SetVal (bean BitIO)
**
** Description :
** This method sets (sets to one) the output value.
** a) direction = Input : sets the output value to "1";
** this operation will be shown on
** output after the direction has
** been switched to output
** (SetDir(TRUE);)
** b) direction = Output : directly writes "1" to the
** appropriate pin
** Parameters : None
** Returns : Nothing
** ===================================================================
*/
/*
void ACRELAY_SetVal(void)
** This method is implemented as a macro. See ACRELAY.h file. **
*/
/*
** ===================================================================
** Method : ACRELAY_ClrVal (bean BitIO)
**
** Description :
** This method clears (sets to zero) the output value.
** a) direction = Input : sets the output value to "0";
** this operation will be shown on
** output after the direction has
** been switched to output
** (SetDir(TRUE);)
** b) direction = Output : directly writes "0" to the
** appropriate pin
** Parameters : None
** Returns : Nothing
** ===================================================================
*/
/*
void ACRELAY_ClrVal(void)
** This method is implemented as a macro. See ACRELAY.h file. **
*/
/*
** ===================================================================
** Method : ACRELAY_SetDir (bean BitIO)
**
** Description :
** This method sets direction of the bean.
** Parameters :
** NAME - DESCRIPTION
** Dir - Direction to set (FALSE or TRUE)
** FALSE = Input, TRUE = Output
** Returns : Nothing
** ===================================================================
*/
void ACRELAY_SetDir(bool Dir)
{
if (Dir) { /* Is given direction output? */
setReg(GPIO_B_DR,((getReg(GPIO_B_DR)) & ~ACRELAY_PIN_MASK) | (Shadow_GPIO_B_DR & ACRELAY_PIN_MASK)); /* Restore correct value of output from shadow variable */
setRegBits(GPIO_B_DDR,ACRELAY_PIN_MASK); /* Set direction to output */
}
else { /* Is given direction input? */
clrRegBits(GPIO_B_DDR,ACRELAY_PIN_MASK); /* Set direction to input */
}
}
/* END ACRELAY. */
/*
** ###################################################################
**
** This file was created by UNIS Processor Expert 2.98 [03.79]
** for the Freescale 56800 series of microcontrollers.
**
** ###################################################################
*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -