/**************************************************************************
SPI.h
ME 218B Lab 8 - SPI, mobile robot
February 3, 2010
The E128 queries the Command Generator over SPI for command
instructions
E128 = master
Command Generator = slave
***************************************************************************/
/*---------------------------- Include Files
------------------------------*/
#ifndef SPI_h
#define SPI_h
#include
"ME218_E128.h"
#include <stdio.h>
#include <termio.h>
#include <S12E128bits.h>
//#include "S12eVec.h"
#include <hidef.h> /* common defines and macros */
#include <mc9s12e128.h> /* derivative information */
#pragma LINK_INFO DERIVATIVE "SampleS12"
typedef
enum { SPI_READY,
SPI_TARGET_STATUS_READY,
SPI_GAME_OVER,
SPI_DELAY,
SPI_ERROR
} SPI_Status_t;
/*-------------------------- Public Function Prototypes
-----------------------------*/
//Initializes SPI. Sets Baud Rate to 24.41kHz (to be called only
once at program start)
void
SPI_Init(void); //
to be called only once
//Returns SPI_READY, SPI_TARGET_STATUS_READY, SPI_GAME_OVER,
SPI_DELAY, or SPI_ERROR
SPI_Status_t
SPI_getStatus(void); //needs
to be called continuously
//returns the current active target
char
SPI_getCurTarget(void);
//Increment the curBeaconIndex in ActivatedBeacons array
void
SPI_skipCurTarget(void);
void
SPI_requestTargetStatus(void); //call once
char
SPI_isCurTargetHit(void); //call when SPI_Status is TARGET_STATUS_READY
void
debug_printActiveBeacons(void);
#endif