📄 ledspi.h
字号:
/** ###################################################################
** THIS BEAN MODULE IS GENERATED BY THE TOOL. DO NOT MODIFY IT.
** Filename : LEDSPI.H
** Project : PMSM
** Processor : 56F8013VFAE
** Beantype : SynchroMaster
** Version : Bean 02.240, Driver 01.18, CPU db: 2.87.089
** Compiler : Metrowerks DSP C Compiler
** Date/Time : 2008-1-24, 下午 01:45
** Abstract :
** This bean "SynchroMaster" implements MASTER part of synchronous
** serial master-slave communication.
** Settings :
** Synchro type : MASTER
**
** Serial channel : SPI
**
** Protocol
** Init baud rate : 0_5us
** Clock edge : falling
** Width : 16 bits
** Empty character : 0
** Empty char. on input : RECEIVED
**
** Registers
** Input buffer : SPI_DRR [61634]
** Output buffer : SPI_DTR [61635]
** Control register : SPI_SCR [61632]
** Mode register : SPI_DSR [61633]
** Baud setting reg. : SPI_SCR [61632]
**
**
**
** Used pins :
** ----------------------------------------------------------
** Function | On package | Name
** ----------------------------------------------------------
** Output | 16 | GPIOB3_MOSI_T3
** Clock | 21 | GPIOB0_SCLK_SCL
** Select slave | 2 | GPIOB1_SS_B_SDA
** ----------------------------------------------------------
**
** Contents :
** Enable - byte LEDSPI_Enable(void);
** RecvChar - byte LEDSPI_RecvChar(LEDSPI_TComData *Chr);
** SendChar - byte LEDSPI_SendChar(LEDSPI_TComData Chr);
** GetCharsInRxBuf - word LEDSPI_GetCharsInRxBuf(void);
** GetCharsInTxBuf - word LEDSPI_GetCharsInTxBuf(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
** ###################################################################*/
#ifndef __LEDSPI
#define __LEDSPI
/* MODULE LEDSPI. */
/*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"
#ifndef __BWUserType_LEDSPI_TError
#define __BWUserType_LEDSPI_TError
typedef union {
byte err;
struct {
bool OverRun : 1; /* OverRun error flag */
bool RxBufOvf : 1; /* Rx buffer full error flag */
bool FaultErr : 1; /* Fault mode error flag */
}errName;
} LEDSPI_TError; /* Error flags. For languages which don't support bit access is byte access only to error flags possible. */
#endif
#define LEDSPI_EOF 0 /* Empty character */
#ifndef __BWUserType_LEDSPI_TComData
#define __BWUserType_LEDSPI_TComData
typedef word LEDSPI_TComData; /* User type for communication. Size of this type depends on the communication data witdh. */
#endif
byte LEDSPI_Enable(void);
/*
** ===================================================================
** Method : LEDSPI_Enable (bean SynchroMaster)
**
** Description :
** Enable the bean - it starts send and receive functions.
** Events may be generated ("DisableEvent"/"EnableEvent").
** Parameters : None
** Returns :
** --- - Error code, possible codes:
** ERR_OK - OK
** ERR_SPEED - This device does not work in
** the active speed mode
** ===================================================================
*/
byte LEDSPI_RecvChar(LEDSPI_TComData *Chr);
/*
** ===================================================================
** Method : LEDSPI_RecvChar (bean SynchroMaster)
**
** Description :
** If any data is received, this method returns one
** character, otherwise it returns an error code (it does
** not wait for data).
** DMA mode:
** If DMA controller is available on selected CPU and
** receiver is configured to use DMA controller then this
** method only sets the selected DMA channel. Status of the
** DMA transfer can then be checked using method
** GetCharsInRxBuf. See typical usage for details about
** communication using DMA.
** Parameters :
** NAME - DESCRIPTION
** * Chr - A pointer to the received character
** Returns :
** --- - Error code, possible codes:
** ERR_OK - OK
** ERR_SPEED - This device does not work in
** the active speed mode
** ERR_RXEMPTY - No data in receiver
** ERR_OVERRUN - Overrun error was detected
** from the last char or block received
** ERR_FAULT - Fault error was detected
** from the last char or block received.
** This error may not be supported on some
** CPUs (see generated code).
** ===================================================================
*/
byte LEDSPI_SendChar(LEDSPI_TComData Chr);
/*
** ===================================================================
** Method : LEDSPI_SendChar (bean SynchroMaster)
**
** Description :
** Sends one character to the channel.
** DMA mode:
** If DMA controller is available on the selected CPU and
** the transmitter is configured to use DMA controller then
** this method only sets the selected DMA channel. The
** status of the DMA transfer can then be checked using
** GetCharsInTxBuf method. See the typical usage for details
** about communication using DMA.
** Parameters :
** NAME - DESCRIPTION
** Chr - Character to send
** Returns :
** --- - Error code, possible codes:
** ERR_OK - OK
** ERR_SPEED - This device does not work in
** the active speed mode
** ERR_DISABLED - Device is disabled (only
** if output DMA is supported and enabled)
** ERR_TXFULL - Transmitter is full
** ===================================================================
*/
#define LEDSPI_GetCharsInRxBuf() (getRegBit(SPI_SCR,SPRF)?(word)1:(word)0) /* Return number of chars in receive buffer */
/*
** ===================================================================
** Method : LEDSPI_GetCharsInRxBuf (bean SynchroMaster)
**
** Description :
** Returns the number of characters in the input buffer.
** Note: If the Interrupt service is disabled, and the
** Ignore empty character is set to yes, and a character has
** been received, then this method returns 1 although it was
** an empty character.
** DMA mode:
** If DMA controller is available on the selected CPU and
** the receiver is configured to use DMA controller then
** this method returns the number of characters in the
** receive buffer.
** Parameters : None
** Returns :
** --- - Number of characters in the input
** buffer.
** ===================================================================
*/
word LEDSPI_GetCharsInTxBuf(void);
/*
** ===================================================================
** Method : LEDSPI_GetCharsInTxBuf (bean SynchroMaster)
**
** Description :
** Returns the number of characters in the output buffer.
** DMA mode:
** If DMA controller is available on the selected CPU and
** the transmitter is configured to use DMA controller then
** this method returns the number of characters in the
** transmit buffer.
** Parameters : None
** Returns :
** --- - Number of characters in the output
** buffer.
** ===================================================================
*/
void LEDSPI_Init(void);
/*
** ===================================================================
** Method : LEDSPI_Init (bean SynchroMaster)
**
** Description :
** Initializes the associated peripheral(s) and the beans
** internal variables. The method is called automatically as a
** part of the application initialization code.
** This method is internal. It is used by Processor Expert only.
** ===================================================================
*/
/* END LEDSPI. */
#endif /* ifndef __LEDSPI */
/*
** ###################################################################
**
** 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 + -