/** ###################################################################
**     THIS COMPONENT MODULE IS GENERATED BY THE TOOL. DO NOT MODIFY IT.
**     Filename  : EI2C2.H
**     Project   : Generator
**     Processor : MC9S08GT16ACFB
**     Component : SW_I2C
**     Version   : Component 01.121, Driver 03.27, CPU db: 2.87.091
**     Compiler  : CodeWarrior HCS08 C Compiler
**     Date/Time : 20.5.2010, 21:50
**     Abstract  :
**         This device "SW_I2C" implements an external I2C
**         communication interface. It uses two general-purpose
**         I/O pins.
**     Settings  :
**         Serial Clock (SCL) pin      :
**             ----------------------------------------------------
**                Number (on package)  |    Name
**             ----------------------------------------------------
**                       5             |  PTC3_SCL
**             ----------------------------------------------------
**
**         Serial Data (SDA) pin       :
**             ----------------------------------------------------
**                Number (on package)  |    Name
**             ----------------------------------------------------
**                       4             |  PTC2_SDA
**             ----------------------------------------------------
**
**
**         Mode                        : MASTER
**         Communication Speed         : FAST MODE
**         Output Buffer Size          : 0
**         Auto Stop Condition         : no
**         Acknowledge Polling Trials  : 2000
**
**         Speed modes
**
**             High Speed Mode         : Enabled
**             Low Speed Mode          : Disabled
**             Slow Speed Mode         : Disabled
**
**         Initialization
**
**             Slave address           : 121
**             Bean function           : Enabled
**             Events                  : Enabled
**     Contents  :
**         Enable       - byte EI2C2_Enable(void);
**         Disable      - byte EI2C2_Disable(void);
**         EnableEvent  - byte EI2C2_EnableEvent(void);
**         DisableEvent - byte EI2C2_DisableEvent(void);
**         SendChar     - byte EI2C2_SendChar(byte Chr);
**         RecvChar     - byte EI2C2_RecvChar(byte *Chr);
**         SendBlock    - byte EI2C2_SendBlock(void* Ptr, word Siz, word *Snt);
**         RecvBlock    - byte EI2C2_RecvBlock(void* Ptr, word Siz, word *Rcv);
**         SendStop     - byte EI2C2_SendStop(void);
**         SelectSlave  - byte EI2C2_SelectSlave(byte Slv);
**         GetSelected  - byte EI2C2_GetSelected(byte *Slv);
**
**     Copyright : 1997 - 2009 Freescale Semiconductor, Inc. All Rights Reserved.
**     
**     http      : www.freescale.com
**     mail      : support@freescale.com
** ###################################################################*/

#ifndef __EI2C2
#define __EI2C2

/* MODULE EI2C2. */

/*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"



void EI2C2_Init(void);
/*
** ===================================================================
**     Method      :  EI2C2_Init (component SW_I2C)
**
**     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.
** ===================================================================
*/

byte EI2C2_Enable(void);
/*
** ===================================================================
**     Method      :  EI2C2_Enable (component SW_I2C)
**
**     Description :
**         This method enables the I2C interface for send and receive
**         operations. This method cannot be disabled if the <Enabled
**         in init. code> property value is "no".
**     Parameters  : None
**     Returns     :
**         ---             - Error code, possible codes:
**                           ERR_OK - OK
**                           ERR_SPEED - This device does not work in
**                           the active speed mode
** ===================================================================
*/

byte EI2C2_Disable(void);
/*
** ===================================================================
**     Method      :  EI2C2_Disable (component SW_I2C)
**
**     Description :
**         This method disables the I2C interface for send and receive
**         operations.
**     Parameters  : None
**     Returns     :
**         ---             - Error code, possible codes:
**                           ERR_OK - OK
**                           ERR_SPEED - This device does not work in
**                           the active speed mode
** ===================================================================
*/

byte EI2C2_EnableEvent(void);
/*
** ===================================================================
**     Method      :  EI2C2_EnableEvent (component SW_I2C)
**
**     Description :
**         This method enables the events. This method is available
**         only if at least one event is enabled.
**     Parameters  : None
**     Returns     :
**         ---             - Error code, possible codes:
**                           ERR_OK - OK
**                           ERR_SPEED - This device does not work in
**                           the active speed mode
** ===================================================================
*/

byte EI2C2_DisableEvent(void);
/*
** ===================================================================
**     Method      :  EI2C2_DisableEvent (component SW_I2C)
**
**     Description :
**         This method disables the events. This method is available
**         only if at least one event is enabled.
**     Parameters  : None
**     Returns     :
**         ---             - Error code, possible codes:
**                           ERR_OK - OK
**                           ERR_SPEED - This device does not work in
**                           the active speed mode
** ===================================================================
*/

byte EI2C2_SendChar(byte Chr);
/*
** ===================================================================
**     Method      :  EI2C2_SendChar (component SW_I2C)
**
**     Description :
**         When working as a MASTER, this method writes 7 bits of slave
**         address plus R/W bit = 0 to the I2C bus and then writes one
**         character (byte) to the bus. The slave address must be
**         specified before by the "SelectSlave" method or in the bean
**         initialization section of <Slave address init> property.
**         When working as the SLAVE, this method writes one character
**         (byte) to the bus. If the ERR_NOTAVAIL error code returned,
**         the char is successfully sent to master but the master
**         device responds by an acknowledgement instead of no
**         acknowledgement at the end of transfer. <OnError> event is
**         called in this case.
**     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_BUSY - The slave device is busy, it
**                           does not respond by the acknowledgement
**                           (MASTER mode only)
**                           ERR_NOTAVAIL - The master device sends
**                           acknowledgement instead of no
**                           acknowledgement after the last byte
**                           transfer (SLAVE mode only)
**                           ERR_DISABLED - Device is disabled
**                           ERR_BUSOFF - Clock timeout elapsed (SLAVE
**                           mode only)
** ===================================================================
*/

byte EI2C2_RecvChar(byte *Chr);
/*
** ===================================================================
**     Method      :  EI2C2_RecvChar (component SW_I2C)
**
**     Description :
**         When working as a MASTER, this method writes 7 bits of slave
**         address plus R/W bit = 1 to the I2C bus and then reads one
**         character (byte) from the bus. The slave address must be
**         specified before by the "SelectSlave" method or in the bean
**         initialization section of <Slave address init> property.
**         When working as a SLAVE, this method reads one character
**         (byte) from the bus.
**     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_BUSY - The slave device is busy, it
**                           does not respond by the acknowledgement
**                           (MASTER mode only)
**                           ERR_DISABLED - Device is disabled
**                           ERR_BUSOFF - Clock timeout elapsed (SLAVE
**                           mode only)
** ===================================================================
*/

byte EI2C2_SendBlock(void * Ptr,word Siz,word *Snt);
/*
** ===================================================================
**     Method      :  EI2C2_SendBlock (component SW_I2C)
**
**     Description :
**         When working as a MASTER, this method writes 7 bits of slave
**         address plus R/W bit = 0 to the I2C bus and then writes the
**         block of characters to the bus. If the bean is disabled (by
**         the "Disable" method or initialization), the block is moved
**         to the output buffer if the <Output buffer size> property is
**         different from zero. The content of the output buffer is
**         sent immediately with the stop condition at the end when the
**         bean is enabled by the "Enable" method. After the output
**         buffer transmission, the whole output buffer is cleared. The
**         slave address must be specified before by the "SelectSlave"
**         method or in bean initialization section of <Slave address
**         init> property. When working as a SLAVE, this method writes
**         block of characters to the bus. If the ERR_NOTAVAIL error
**         code is returned, the whole block is successfully sent to a
**         master but the master device responds by an acknowledgement
**         instead of no acknowledgment sent at the end of the last
**         block byte transfer. <OnError> event is called in this case.
**     Parameters  :
**         NAME            - DESCRIPTION
**       * Ptr             - A pointer to the block of data to send
**         Siz             - The size of the block
**       * Snt             - A pointer to the number of data that are
**                           sent (copied to buffer)
**     Returns     :
**         ---             - Error code, possible codes:
**                           ERR_OK - OK
**                           ERR_SPEED - This device does not work in
**                           the active speed mode
**                           ERR_BUSY - The slave device is busy, it
**                           does not respond by the acknowledgement
**                           (MASTER mode only)
**                           ERR_TXFULL - Output buffer is full (MASTER
**                           mode only)
**                           ERR_NOTAVAIL - The master device sends
**                           acknowledgement instead of no
**                           acknowledgement after the last byte
**                           transfer (SLAVE mode only)
**                           ERR_DISABLED - Device is disabled
**                           ERR_BUSOFF - Clock timeout elapsed (SLAVE
**                           mode only)
** ===================================================================
*/

byte EI2C2_RecvBlock(void* Ptr,word Siz,word *Rcv);
/*
** ===================================================================
**     Method      :  EI2C2_RecvBlock (component SW_I2C)
**
**     Description :
**         When working as a MASTER, this method writes 7 bits of slave
**         address plus R/W bit = 1 to the I2C bus and then reads the
**         block of characters from the bus. The slave address must be
**         specified before by the "SelectSlave" method or in bean
**         initialization section of <Slave address init> property.
**         When working as a SLAVE, this method reads the block of
**         characters from the bus.
**     Parameters  :
**         NAME            - DESCRIPTION
**       * Ptr             - A pointer to the block space for received
**                           data
**         Siz             - The size of the block
**       * Rcv             - A pointer to the number of actually
**                           received data
**     Returns     :
**         ---             - Error code, possible codes:
**                           ERR_OK - OK
**                           ERR_SPEED - This device does not work in
**                           the active speed mode
**                           ERR_BUSY - The slave device is busy, it
**                           does not respond by the acknowledgement
**                           (MASTER mode only)
**                           ERR_DISABLED - Device is disabled
**                           ERR_BUSOFF - Clock timeout elapsed (SLAVE
**                           mode only)
** ===================================================================
*/

byte EI2C2_SendStop(void);
/*
** ===================================================================
**     Method      :  EI2C2_SendStop (component SW_I2C)
**
**     Description :
**         When working as a MASTER, if the <Automatic stop condition>
**         property value is 'no', this method sends a valid stop
**         condition to the serial data line of the I2C bus to
**         terminate the communication on the bus after using send
**         methods. This method is enabled only if the bean is in
**         MASTER mode and <Automatic stop condition> property value is
**         'no'
**     Parameters  : None
**     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
** ===================================================================
*/

byte EI2C2_SelectSlave(byte Slv);
/*
** ===================================================================
**     Method      :  EI2C2_SelectSlave (component SW_I2C)
**
**     Description :
**         When working as a MASTER, this method selects a new slave
**         for communication by its slave address value. Any send or
**         receive method are directed to or from the selected device,
**         until a new slave device is selected by this method. If the
**         selected slave uses 10-bit slave addressing, as the
**         parameter 7 bits must be passed, which involves 10-bit
**         addressing (11110XX), including two MSBs of slave address
**         (XX). The second byte of the 10-bit slave address must be
**         sent to the slave as a general character of send methods.
**         This method is available only if the bean is in MASTER mode.
**     Parameters  :
**         NAME            - DESCRIPTION
**         Slv             - Slave address value
**     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
** ===================================================================
*/

byte EI2C2_GetSelected(byte *Slv);
/*
** ===================================================================
**     Method      :  EI2C2_GetSelected (component SW_I2C)
**
**     Description :
**         When working as a MASTER, this method returns the
**         identification address value of the slave, which is
**         currently selected for communication with the master. If the
**         current slave uses 10-bit slave addressing, the method
**         returns the first 7 bits only, which involves 10-bit
**         addressing (11110XX), including two MSBs of the slave
**         address (XX). This method is not able to return the rest
**         value of 10-bit slave address. This method is available only
**         if the bean is in MASTER mode.
**     Parameters  :
**         NAME            - DESCRIPTION
**       * Slv             - A pointer to the current selected slave
**                           address value
**     Returns     :
**         ---             - Error code, possible codes:
**                           ERR_OK - OK
**                           ERR_SPEED - This device does not work in
**                           the active speed mode
** ===================================================================
*/


/* END EI2C2. */

#endif /* ifndef __EI2C2 */
/*
** ###################################################################
**
**     This file was created by Processor Expert 3.07 [04.34]
**     for the Freescale HCS08 series of microcontrollers.
**
** ###################################################################
*/
