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

Download.h

Team Firefox

ME 218A 11/20/09

This software module

  1) Controls the shift register that drives the download LEDs

  2) Senses the presence of the 3.5’ floppy drive

  3) Keeps track of the progress of the hypothetical download used in the game

 

Input Pins:

M0 - Disk switch (0=Disk In, 1=Disk Out)

 

Output Pins:

A6 – Data line for shift register

A7 – Shift/clock line for shift register

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

 

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

#ifndef Download_h

#define Download_h

 

#include <string.h>

#include <timers12.h>

#include <stdio.h>

#include <ME218_C32.h>

 

/*---------------------------- Module Defines ------------------------------*/

typedef enum {       DOWNLOAD_NO_EVENT,

                     DOWNLOAD_STARTED_EVENT,

                     DOWNLOAD_STOPPED_EVENT,

                     DOWNLOAD_COMPLETE_EVENT

       } DOWNLOAD_EVENT_t;

 

/*---------------------------- Public Function Prototypes ------------------------------*/

void initDownload(void);          //To be called once at flicker power up

void resetDownload(void);         //To be called before each new game

char isDiskIn(void);              //Quick check if disk is in (with debounce software)

void clearDownloadDisplay(void);  //Will turn off all download progress bar LEDs (will not reset

                                  //download progress)

void blinkDownloadLEDs(void);     //Will cause download progress bar LEDs to blink (NOTE: calls to //this function will reset download progress)

 

DOWNLOAD_EVENT_t checkDownloadEvents(void);     //Will update the download progress LEDs

// Will return one of the following:

//     DOWNLOAD_STARTED_EVENT – if download has just begun

//     DOWNLOAD_STOPPED_EVENT – if download was running but has just stopped

//     DOWNLOAD_COMPLETE_EVENT – if download has completed

//     DOWNLOAD_NO_EVENT - otherwise

 

#endif