| 151 | kaklik | 1 | /*
 | 
        
           |  |  | 2 |     Copyright (C) 2004    John Orlando
 | 
        
           |  |  | 3 |   | 
        
           |  |  | 4 |    AVRcam: a small real-time image processing engine.
 | 
        
           |  |  | 5 |   | 
        
           |  |  | 6 |     This program is free software; you can redistribute it and/or
 | 
        
           |  |  | 7 |     modify it under the terms of the GNU General Public
 | 
        
           |  |  | 8 |     License as published by the Free Software Foundation; either
 | 
        
           |  |  | 9 |     version 2 of the License, or (at your option) any later version.
 | 
        
           |  |  | 10 |   | 
        
           |  |  | 11 |     This program is distributed in the hope that it will be useful,
 | 
        
           |  |  | 12 |     but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
        
           |  |  | 13 |     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 | 
        
           |  |  | 14 |     General Public License for more details.
 | 
        
           |  |  | 15 |   | 
        
           |  |  | 16 |     You should have received a copy of the GNU General Public
 | 
        
           |  |  | 17 |     License along with this program; if not, write to the Free Software
 | 
        
           |  |  | 18 |     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 | 
        
           |  |  | 19 |   | 
        
           |  |  | 20 |    For more information on the AVRcam, please contact:
 | 
        
           |  |  | 21 |   | 
        
           |  |  | 22 |    john@jrobot.net
 | 
        
           |  |  | 23 |   | 
        
           |  |  | 24 |    or go to www.jrobot.net for more details regarding the system.
 | 
        
           |  |  | 25 | */
 | 
        
           |  |  | 26 | /***********************************************************
 | 
        
           |  |  | 27 | 	Module Name: DebugInterface.c
 | 
        
           |  |  | 28 | 	Module Date: 04/15/2004
 | 
        
           |  |  | 29 | 	Module Auth: John Orlando
 | 
        
           |  |  | 30 |   | 
        
           |  |  | 31 | 	Description: This module is responsible for providing a
 | 
        
           |  |  | 32 | 	debug interface to the system.  Currently, the only
 | 
        
           |  |  | 33 | 	debugging that is available is through the on-board
 | 
        
           |  |  | 34 | 	UART (which is used by the main application as well) in
 | 
        
           |  |  | 35 | 	addition to the LED hooked up at PORTD bit 6.
 | 
        
           |  |  | 36 |   | 
        
           |  |  | 37 |     Revision History:
 | 
        
           |  |  | 38 |     Date        Rel Ver.    Notes
 | 
        
           |  |  | 39 |     4/10/2004      0.1     Module created
 | 
        
           |  |  | 40 |     6/30/2004      1.0     Initial release for Circuit Cellar
 | 
        
           |  |  | 41 |                            contest.
 | 
        
           |  |  | 42 | ***********************************************************/
 | 
        
           |  |  | 43 |   | 
        
           |  |  | 44 | /*	Includes */
 | 
        
           |  |  | 45 | #include "CommonDefs.h"
 | 
        
           |  |  | 46 | #include "UartInterface.h"
 | 
        
           |  |  | 47 | #include "Utility.h"
 | 
        
           |  |  | 48 |   | 
        
           |  |  | 49 | /*  Local Variables */
 | 
        
           |  |  | 50 |   | 
        
           |  |  | 51 | /* 	Local Structures and Typedefs */
 | 
        
           |  |  | 52 |   | 
        
           |  |  | 53 | /*  Extern Variables */
 | 
        
           |  |  | 54 |   | 
        
           |  |  | 55 | /*  Definitions */
 | 
        
           |  |  | 56 |   | 
        
           |  |  | 57 | /***********************************************************
 | 
        
           |  |  | 58 | 	Function Name: DebugInt_init
 | 
        
           |  |  | 59 | 	Function Description: This function is responsible for
 | 
        
           |  |  | 60 | 	initializing the debug module.  It sets up the debug LED
 | 
        
           |  |  | 61 | 	as well as any other debugging that will be done.  The 
 | 
        
           |  |  | 62 |     LED blinks four times, which indicates to the user
 | 
        
           |  |  | 63 |     that the system is available for re-programming if 
 | 
        
           |  |  | 64 |     necessary.  This works because the data lines on the
 | 
        
           |  |  | 65 |     OV6620 are still tri-stated at this point, but won't
 | 
        
           |  |  | 66 |     be for long after this function returns.
 | 
        
           |  |  | 67 | 	Inputs:  none
 | 
        
           |  |  | 68 | 	Outputs: none
 | 
        
           |  |  | 69 | ***********************************************************/	
 | 
        
           |  |  | 70 | void DebugInt_init(void)
 | 
        
           |  |  | 71 | {
 | 
        
           |  |  | 72 | 	/* set PortD pin6 for output */
 | 
        
           |  |  | 73 | 	DDRD  |= 0x40;
 | 
        
           |  |  | 74 | 	/* turn on LED */
 | 
        
           |  |  | 75 | 	PORTD |= 0x40;
 | 
        
           |  |  | 76 |     Utility_delay(500);
 | 
        
           |  |  | 77 |     PORTD &= 0xBF;
 | 
        
           |  |  | 78 |     Utility_delay(500);
 | 
        
           |  |  | 79 |     PORTD |= 0x40;
 | 
        
           |  |  | 80 |     Utility_delay(500);
 | 
        
           |  |  | 81 |     PORTD &= 0xBF;
 | 
        
           |  |  | 82 |     Utility_delay(500);
 | 
        
           |  |  | 83 |     PORTD |= 0x40;
 | 
        
           |  |  | 84 |     Utility_delay(500);
 | 
        
           |  |  | 85 |     PORTD &= 0xBF;
 | 
        
           |  |  | 86 |     Utility_delay(500);
 | 
        
           |  |  | 87 |     PORTD |= 0x40;
 | 
        
           |  |  | 88 | }
 | 
        
           |  |  | 89 |   |