/*
**-----------------------------------------------------------------------
**
**	main.c - contains C entry point main()
**	
**  This file was generated by HEW IAR Icch8 project generator
**
**-----------------------------------------------------------------------
*/
                     
#include "ioh82148.h"    
#include "hardware.h"
#include "Onboard.h"        
#include "Weapons.h"
#include "Motion.h"   
#include "Radio.h"      
#include "Display.h"
#include "Commands.h"
#include "Shutdown.h"
#include "Sensors.h"

//
// These globals are filled as soon as a validated packet is received
// via the radio receiver. Each char is boolean.
//

char SpeedRequest[8];
char DirectionRequest[8];
char WeaponsRequest[16];
char SpecialsRequest[16];


/*----------------------------------------------------------------------------
//
//  Scheduler
//      
// This is the basic scheduler. It is run every 10ms.
//  
// Modification Record:
//  24-Jul-00   Paul Hills      First version
-----------------------------------------------------------------------------*/
interrupt [TM_CMIA1] void Scheduler(void)
{          
    // Process operations.
    ProcessSensors();
    ProcessWeapons();
    ProcessMotion();
    ProcessDisplay();
    CheckRadioLevel();

    // And clear interrupt flag.
    CLEAR_MAIN_SEQUENCER_FLAG;
}

/*----------------------------------------------------------------------------
//
//  Main
//      
// Main is simply the basic scheduling loop. The loop is run every 10ms.
//  
// Modification Record:
//  24-Jul-00   Paul Hills      First version
-----------------------------------------------------------------------------*/
void main(void)
{                    
    // Initialisation
    InitialiseRadio();
    InitialiseMotion();
    InitialiseWeapons();
    MAIN_SEQUENCER_INIT;

    // Scheduler loop
    while (TRUE)
    {          
        // Just wait for 10ms interrupts.
    }
}