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

TapeSensors.h

ME 218B Project Hats Off

Team Firefox

March 7, 2010

 

Robot uses 7 tape sensors to track and align with tape on the floor.

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

#ifndef TapeSensors_h

#define TapeSensors_h

/*-------------------------- Include Files -----------------------------*/

#include <stdio.h>

#include <termio.h>

 

#include <hidef.h>

#include <mc9s12e128.h>

#include <bitdefs.h>

#include <S12E128bits.h>

#include "S12eVec.h"

#include "ADS12.h"

#include "ME218_E128.h"

 

//included with main.c for E128

/* common defines and macros */

/* derivative information */

#pragma LINK_INFO DERIVATIVE "SampleS12"

/*-------------------------- Public Type Def -----------------------------*/

typedef enum {    ALIGNED,

                  LIL_LEFT,

                  WAY_LEFT,

                  LIL_RIGHT,

                  WAY_RIGHT,

                  LOST,

                  ERROR,

                  INTERSECTION

            } TAPE_TrackStatus_t;

 

//numbers correspond to analog pin assignment

typedef enum {    FRONT = 0,

                  FRONT_LEFT = 1,

                  FRONT_RIGHT = 2,

                  CENTER = 3,

                  CENTER_LEFT = 4,

                  CENTER_RIGHT = 5,

                  REAR = 6

            } TAPE_Sensor_t;

/*-------------------------- Public Functions -----------------------------*/

char Tape_isParallel(void);   //is robot aligned with black tape

char Tape_isPerp(void);       //is robot perpendicular to black tape

TAPE_TrackStatus_t Tape_getTrackStatus(void); //how close is robot to tracking black line

char Tape_isBlack(TAPE_Sensor_t);             //specifically check one tape sensor

 

#endif