beautypg.com

HID Hi-O iCLASS Installation Guide User Manual

Page 29

background image

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

January 2014

Page 29 of 49

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.

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

/************************** Public functions *************************/

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

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

** NAME:

** InitSpi

**

** INPUTS:

** None

**

** OUTPUTS:

** None

**

** RETURN:

** None

**

** DESCRIPTION:

** This function sets up the MSSP to be a master SPI device.

**

** NOTES: This is code for a Microchip PIC18F2520. This initialization code will

** be different for other SPI drivers on other processors.

**

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

void InitSpi(void)

{

// Enable SPI as a master device, Mode 3

SSPSTAT = SSPSTAT_MASTER;

SSPCON1 = SSPCON1_MASTER;

}

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

** NAME:

** WriteSpi

**

** INPUTS:

** pData - points to the data to send to the slave SPI

** numBytes – number of bytes in the message

**

** OUTPUTS:

** None

**

** RETURN:

** None

**

** DESCRIPTION:

** This function transmits a message to a slave SPI device.

**

** NOTES:

**

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

void WriteSpi(UBYTE *pData, UBYTE numBytes)

{

UBYTE returnByte, cnt;

// Select the SPI slave device.

OEM75_SS = 0;