Subversion Repositories svnkaklik

Rev

Rev 409 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 409 Rev 410
1
#ifndef CAMINTERFACE_H
1
#ifndef CAMINTERFACE_H
2
#define CAMINTERFACE_H
2
#define CAMINTERFACE_H
3
 
3
 
4
/*
4
/*
5
    Copyright (C) 2004    John Orlando
5
    Copyright (C) 2004    John Orlando
6
    
6
    
7
   AVRcam: a small real-time image processing engine.
7
   AVRcam: a small real-time image processing engine.
8
 
8
 
9
    This program is free software; you can redistribute it and/or
9
    This program is free software; you can redistribute it and/or
10
    modify it under the terms of the GNU General Public
10
    modify it under the terms of the GNU General Public
11
    License as published by the Free Software Foundation; either
11
    License as published by the Free Software Foundation; either
12
    version 2 of the License, or (at your option) any later version.
12
    version 2 of the License, or (at your option) any later version.
13
 
13
 
14
    This program is distributed in the hope that it will be useful,
14
    This program is distributed in the hope that it will be useful,
15
    but WITHOUT ANY WARRANTY; without even the implied warranty of
15
    but WITHOUT ANY WARRANTY; without even the implied warranty of
16
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17
    General Public License for more details.
17
    General Public License for more details.
18
 
18
 
19
    You should have received a copy of the GNU General Public
19
    You should have received a copy of the GNU General Public
20
    License along with this program; if not, write to the Free Software
20
    License along with this program; if not, write to the Free Software
21
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
21
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
22
 
22
 
23
   For more information on the AVRcam, please contact:
23
   For more information on the AVRcam, please contact:
24
 
24
 
25
   john@jrobot.net
25
   john@jrobot.net
26
 
26
 
27
   or go to www.jrobot.net for more details regarding the system.
27
   or go to www.jrobot.net for more details regarding the system.
28
*/
28
*/
29
/***********************************************************
29
/***********************************************************
30
	Module Name: CamInterface.h
30
	Module Name: CamInterface.h
31
	Module Date: 04/14/2004
31
	Module Date: 04/14/2004
32
	Module Auth: John Orlando
32
	Module Auth: John Orlando
33
	
33
	
34
	Description: This file is responsible for providing the
34
	Description: This file is responsible for providing the
35
	external interface to the CamInterface module.
35
	external interface to the CamInterface module.
36
    
36
    
37
    Revision History:
37
    Revision History:
38
    Date        Rel Ver.    Notes
38
    Date        Rel Ver.    Notes
39
    4/10/2004      0.1     Module created
39
    4/10/2004      0.1     Module created
40
    6/30/2004      1.0     Initial release for Circuit Cellar
40
    6/30/2004      1.0     Initial release for Circuit Cellar
41
                           contest.
41
                           contest.
42
***********************************************************/
42
***********************************************************/
43
 
43
 
44
#define NUM_PIXELS_IN_A_TRACKED_LINE 	88
44
#define NUM_PIXELS_IN_A_TRACKED_LINE 	88
45
#define NUM_PIXELS_IN_A_DUMP_LINE    	176
45
#define NUM_PIXELS_IN_A_DUMP_LINE    	176
46
#define ACTUAL_NUM_PIXELS_IN_A_LINE		176
46
#define ACTUAL_NUM_PIXELS_IN_A_LINE		176
47
#define ACTUAL_NUM_LINES_IN_A_FRAME		144
47
#define ACTUAL_NUM_LINES_IN_A_FRAME		144
48
#define LENGTH_OF_RUN_LENGTH_BLOCK 2
48
#define LENGTH_OF_RUN_LENGTH_BLOCK 2
49
#define LENGTH_OF_LINE_BUFFER NUM_PIXELS_IN_A_DUMP_LINE
49
#define LENGTH_OF_LINE_BUFFER NUM_PIXELS_IN_A_DUMP_LINE
50
 
50
 
51
#define WAIT_FOR_VSYNC_LOW() 	while( (PIND & 0x04) != 0)
51
#define WAIT_FOR_VSYNC_LOW() 	while( (PIND & 0x04) != 0)
52
#define WAIT_FOR_VSYNC_HIGH()	while( (PIND & 0x04) == 0)
52
#define WAIT_FOR_VSYNC_HIGH()	while( (PIND & 0x04) == 0)
53
 
53
 
54
#define WAIT_FOR_HREF_LOW()		while( (PIND & 0x10) != 0)
54
#define WAIT_FOR_HREF_LOW()		while( (PIND & 0x10) != 0)
55
#define WAIT_FOR_HREF_HIGH()	while( (PIND & 0x10) == 0)
55
#define WAIT_FOR_HREF_HIGH()	while( (PIND & 0x10) == 0)
56
 
56
 
57
#define WAIT_FOR_PCLK_LOW()		while( (PIND & 0x20) != 0)
57
#define WAIT_FOR_PCLK_LOW()		while( (PIND & 0x20) != 0)
58
#define WAIT_FOR_PCLK_HIGH()	while( (PIND & 0x20) == 0)
58
#define WAIT_FOR_PCLK_HIGH()	while( (PIND & 0x20) == 0)
59
 
59
 
60
#define NUM_COLOR_STEPS     16
60
#define NUM_COLOR_STEPS     16
61
#define NUM_COLOR_CHANNELS	3
61
#define NUM_COLOR_CHANNELS	3
62
#define NUM_ELEMENTS_IN_COLOR_MAP (NUM_COLOR_STEPS * NUM_COLOR_CHANNELS)
62
#define NUM_ELEMENTS_IN_COLOR_MAP (NUM_COLOR_STEPS * NUM_COLOR_CHANNELS)
63
 
63
 
64
#define RED_OFFSET		0
64
#define RED_OFFSET		0
65
#define GREEN_OFFSET	16
65
#define GREEN_OFFSET	16
66
#define BLUE_OFFSET		32
66
#define BLUE_OFFSET		32
67
 
67
 
68
extern unsigned char currentLineBuffer[];
68
extern unsigned char currentLineBuffer[];
69
extern unsigned char previousLineBuffer[];
69
extern unsigned char previousLineBuffer[];
70
extern unsigned char colorMap[];
70
extern unsigned char colorMap[];
71
extern unsigned char frameCount;
71
extern unsigned char frameCount;
72
	
72
	
73
/* Extern functions */
73
/* Extern functions */
74
extern void CamInt_init(void);
74
extern void CamInt_init(void);
75
extern void CamInt_resetCam(void);
75
extern void CamInt_resetCam(void);
76
extern void CamInt_waitForNewDumpFrame(void);
76
extern void CamInt_waitForNewDumpFrame(void);
77
extern void CamInt_waitForNewTrackingFrame(void);
77
extern void CamInt_waitForNewTrackingFrame(void);
78
extern void CamInt_acquireTrackingLine(void);
78
extern void CamInt_acquireTrackingLine(void);
79
extern void CamInt_acquireDumpLine(void);
79
extern void CamInt_acquireDumpLine(void);
80
	
80
	
81
#endif	
81
#endif	
82
 
82