Subversion Repositories svnkaklik

Rev

Blame | Last modification | View Log | Download

/* 
 * Copyright (C) 2004 Darren Hutchinson (dbh@gbdt.com.au)
 * 
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Library General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or (at your
 * option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
 * License for more details.
 * 
 * You should have received a copy of the GNU Library General Public License
 * along with this software; see the file COPYING.  If not, write to
 * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
 * MA 02111-1307, USA. 
 *
 * $Id: eq6.c,v 1.4 2004/04/04 10:32:50 dbh Exp $
 */

#include <avr/interrupt.h>

#include "eq6.h"
#include "paddle.h"
#include "stepper.h"
#include "driver.h"
#include "serial.h"
#include "pguide.h"
#include "sr.h"

volatile uint32_t    idleCtr;

/* main() is called after the basic system initialization. This 
 * initialises the program modules (these are, generally, interrupt
 * driver), and then waits for the end of civilization as we know it
 *
 * Passed:
 *     Nothing
 *
 * Returns:
 *     Nothing
 *
 * Notes:
 *     There is little to do here but wait.
 */
int
main(void)
{
    DDRA = 0xff;
    DDRC = 0xff;
    PORTA = 0x0;
    PORTC = 0x0;

    /* Initialize the modules */
    paddleInit();
    stepperInit();
    driverInit();
    serialInit();
    pguideInit();

    /* Load save data (if any) from the EEPROM */
    srLoadState();
    
    setupRateTable(transRatio);
    setTrackRate(0);
    setTrackRate(trackingRate);

    /* Enable interrupts */
    sei();

    /* Increment the idle counter to get some idea of the system
     * idle time
     */
    for (;;)
    {
        if (doSave)
        {
            doSave = 0;
            srSaveState();
        }
    }

    /* NOTREACHED */
    return 0;
}