beautypg.com

HID Hi-O iCLASS Installation Guide User Manual

Page 36

background image

iCLASS OEM75 Integration Guide, 3141-907, Rev. B.0

Page 36 of 49

January 2014

HID GLOBAL CONFIDENTIAL AND/OR PROPRIETARY INFORMATION. This document contains confidential and/or proprietary

information, which may not be duplicated, published, disseminated or disclosed, or used for any purpose, without the written

consent of HID Global Corporation. If you are an unintended recipient of this information or are unwilling to accept the above

restrictions, please immediately return this document to HID Global Corporation, 15370 Barranca Pkwy, Irvine, CA 92618-3106.

** the I²C SSP link.

**

** NOTES:

**

***********************************************************************/

void InitI2C (void)

{

SSP1ADD = 31; // 115200 Baud

SSP1CON1 = 0b00101000; // Master mode, clock = FOSC/(4 * (SSPxADD + 1))

SSP1CON2 = 0;

SSP1STAT = 0;

} /* InitI2C */

/***********************************************************************

** NAME:

** WriteI2C

**

** INPUTS:

** pData - points to the data to write out the I²C

** numBytes - number of bytes to transmit

**

** OUTPUTS:

** None

**

** RETURN:

** None

**

** DESCRIPTION:

** This function transmits data to an external CPU or

** peripheral device via I²C.

**

** NOTES:

**

***********************************************************************/

void WriteI2C(UBYTE *pData, UBYTE numBytes)

{

UBYTE cnt;

//

// Issue a bus start

//

sendI2CStart();

//

// Send device address.

//

if (I2C_ACK == writeByte(SLAVE_ADDR))

{

//

// Send the number of bytes in this message to the slave.

//

if (I2C_ACK == writeByte(numBytes))

{

//

// Send the message.

//