/*
** ###################################################################
**
**     THIS BEAN MODULE IS GENERATED BY THE TOOL. DO NOT MODIFY IT.
**
**     Filename  : SM1.H
**
**     Project   : Full1
** 
**     Processor : MC68HC908AZ60MFU
**
**     Beantype  : SynchroMaster
**
**     Version   : Bean 02.096, Driver 01.05, CPU db: 2.81.019
**
**     Compiler  : Metrowerks HC08 C Compiler V-5.0.13
**
**     Date/Time : 2.4.2002, 9:36
**
**     Abstract  :
**
**         This bean "SynchroMaster" implements MASTER part of synchronous
**         serial master-slave communication.
**
**     Settings  :
**
**         Synchro type                : MASTER
**
**         Serial channel              : SPI
**
**         Protocol
**             Init baud rate          : 64us
**             Clock edge              : rising
**             Width                   : 8 bits (always)
**             Empty character         : 0
**             Empty char. on input    : RECEIVED
**
**         Registers
**             Input buffer            : SPDR      [18]
**             Output buffer           : SPDR      [18]
**             Control register        : SPCR      [16]
**             Mode register           : SPCR      [16]
**             Baud setting reg.       : SPSCR     [17]
**
**         Input interrupt
**             Vector name             : INT_SPIReceive
**
**         Output interrupt
**             Vector name             : INT_SPITransmit
**
**         Used pins                   : 
**             ----------------------------------------------------
**               Function | On package |    Name
**             ----------------------------------------------------
**                Input   |     18     |  PTE5_MISO
**                Output  |     19     |  PTE6_MOSI
**                Clock   |     20     |  PTE7_SPSCK
**             ----------------------------------------------------
**
**     Contents  :
**
**         RecvChar        - byte SM1_RecvChar(byte *Chr);
**         SendChar        - byte SM1_SendChar(byte Chr);
**         GetCharsInRxBuf - word SM1_GetCharsInRxBuf(void);
**         GetCharsInTxBuf - word SM1_GetCharsInTxBuf(void);
**         GetError        - byte SM1_GetError(byte *Err);
**
**
**     (c) Copyright UNIS, spol. s r.o. 1997-2002
**
**     UNIS, spol. s r.o.
**     Jundrovska 33
**     624 00 Brno
**     Czech Republic
**
**     http      : www.processorexpert.com
**     mail      : info@processorexpert.com
**
** ###################################################################
*/

#ifndef __SM1
#define __SM1

/* MODULE SM1. */

#include "Cpu.h"

typedef struct {
  bool OverRun : 1;                    /* OverRun error flag */
} SM1_TError;

#define SM1_EOF 0                      /* Empty character*/

byte SM1_RecvChar(byte *Chr);
/*
** ===================================================================
**     Method      :  SM1_RecvChar (bean SynchroMaster)
**
**     Description :
**         If any data received, this method returns one character,
**         otherwise it returns error code (it does not wait for
**         data).
**     Parameters  :
**         NAME            - DESCRIPTION
**       * Chr             - Pointer to 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 last char or block receiving
**                           ERR_FAULT - Fault error was detected
**                           from last char or block receiving. This
**                           error does not need to be supported on
**                           some Cpu (see generated code).
** ===================================================================
*/

byte SM1_SendChar(byte Chr);
/*
** ===================================================================
**     Method      :  SM1_SendChar (bean SynchroMaster)
**
**     Description :
**         Send one character to the channel.
**     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_TXFULL - Transmitter is full
** ===================================================================
*/

word SM1_GetCharsInRxBuf(void);
/*
** ===================================================================
**     Method      :  SM1_GetCharsInRxBuf (bean SynchroMaster)
**
**     Description :
**         Return number of characters in the input buffer.
**     Parameters  : None
**     Returns     :
**         ---             - Number of characters in the input
**                           buffer.
** ===================================================================
*/

word SM1_GetCharsInTxBuf(void);
/*
** ===================================================================
**     Method      :  SM1_GetCharsInTxBuf (bean SynchroMaster)
**
**     Description :
**         Return number of characters in the output buffer.
**     Parameters  : None
**     Returns     :
**         ---             - Number of characters in the output
**                           buffer.
** ===================================================================
*/

byte SM1_GetError(SM1_TError *Err);
/*
** ===================================================================
**     Method      :  SM1_GetError (bean SynchroMaster)
**
**     Description :
**         Return a set of errors on the channel (errors that cannot
**         be returned in given methods). The errors accumulate in a
**         set; after calling GetError this set is returned and
**         cleared.
**     Parameters  :
**         NAME            - DESCRIPTION
**       * Err             - Pointer to returned set of errors
**     Returns     :
**         ---             - Error code (if GetError did not succeed),
**                           possible codes:
**                           ERR_OK - OK
**                           ERR_SPEED - This device does not work in
**                           the active speed mode
** ===================================================================
*/

__interrupt void SM1_InterruptRx(void);
/*
** ===================================================================
**     Method      :  SM1_InterruptRx (bean SynchroMaster)
**
**     Description :
**         This method is internal. It is used by Processor Expert
**         only.
** ===================================================================
*/

__interrupt void SM1_InterruptTx(void);
/*
** ===================================================================
**     Method      :  SM1_InterruptTx (bean SynchroMaster)
**
**     Description :
**         This method is internal. It is used by Processor Expert
**         only.
** ===================================================================
*/

void SM1_Init(void);
/*
** ===================================================================
**     Method      :  SM1_Init (bean SynchroMaster)
**
**     Description :
**         This method is internal. It is used by Processor Expert
**         only.
** ===================================================================
*/


/* END SM1. */

#endif /* ifndef __SM1 */
/*
** ###################################################################
**
**     This file was created by UNIS Processor Expert 02.84 for 
**     the Motorola HC08 series of microcontrollers.
**
** ###################################################################
*/
