Subversion Repositories svnkaklik

Rev

Details | Last modification | View Log

Rev Author Line No. Line
508 kaklik 1
/* 
2
 * Copyright (C) 2004 Darren Hutchinson (dbh@gbdt.com.au)
3
 * 
4
 * This program is free software; you can redistribute it and/or modify
5
 * it under the terms of the GNU Library General Public License as published by
6
 * the Free Software Foundation; either version 2 of the License, or (at your
7
 * option) any later version.
8
 *
9
 * This program is distributed in the hope that it will be useful, but
10
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
11
 * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
12
 * License for more details.
13
 * 
14
 * You should have received a copy of the GNU Library General Public License
15
 * along with this software; see the file COPYING.  If not, write to
16
 * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
17
 * MA 02111-1307, USA. 
18
 *
19
 * $Id: paddle.h,v 1.2 2004/03/03 07:37:11 dbh Exp $
20
 */
21
 
22
#ifndef _PADDLE_H_
23
#define _PADDLE_H_
24
 
25
/* This file describes the data in the EQ6/Atlas hand paddle serial stream.
26
 *
27
 * This is a one-directional serial stream at 935 bits/sec. This is a fairly
28
 * wierd speed that seems to be used to give an overall serial stream time
29
 * of 76.2ms [basically the full-step time for siderial rate, which is
30
 * half of the actual half-step rate].
31
 *
32
 * See the file eq6-serial.txt for further details.
33
 */
34
#include <inttypes.h>
35
 
36
/* Define the serial rate used by the paddle
37
 */
38
#define PADDLE_RATE	935L		/* Bit rate for the paddle */
39
 
40
/* The serial stream is a set of 6, 9 bit words. The first three words
41
 * are for RA control, the second three words are for DEC control.
42
 *
43
 * Note that the ordering here is arbitary (through reverse engineering), but
44
 * seems sensible.
45
 *
46
 * Word1:	RA sync (B8 = 0)
47
 * Word2:	RA direction (B8 = 0)
48
 * Word3:	RA speed (B8 = 0)
49
 * Word4:	??? (Assumed to be DEC sync) (B8 = 1)
50
 * Word5:	DEC direction (B8 = 1)
51
 * Word6:	DEC speed (B8 = 1)
52
 *
53
 */
54
 
55
/* Word #1 - RA SYNC
56
 */
57
#define RA_SYNC		0x7e
58
 
59
/* Word #2 - RA DIRECTION
60
 */
61
#define RA_DIR_BIT	0	// RA Direction bit
62
#define RA_DIR_LEFT	0
63
#define RA_DIR_RIGHT	(1 << RA_DIR_BIT)
64
 
65
/* Note: Will be 0 for southern hemispere siderial, 1 for northern siderial
66
 */
67
 
68
 
69
/* Word #3 - RA SPEED
70
 */
71
#define RA_SPEED_MASK	0x0f	// Speed bits
72
#define RA_SPEED_0	0x00	// x2, opposite direction to siderial
73
#define RA_SPEED_1	0x01	// No RA button pressed
74
#define RA_SPEED_2	0x02	// x2, same direction as siderial
75
#define RA_SPEED_8	0x04	// siderial x8
76
#define RA_SPEED_16	0x08	// siderial x16
77
 
78
/* Word #4 - ???. This word always seems to be zero. Assume it's a sync word
79
 * unless we hear something different
80
 */
81
#define DEC_SYNC	0x00
82
 
83
/* Word #5 - DEC DIRECTION
84
 */
85
#define DEC_DIR_BIT	0	// DEC Direction bit
86
#define DEC_DIR_UP	0
87
#define DEC_DIR_DOWN	(1 << DEC_DIR_BIT)
88
 
89
/* Word #6 - DEC SPEED
90
 */
91
#define DEC_SPEED_MASK	0x0f	// Speed bits
92
#define DEC_SPEED_0	0x00	// No buttons pressed
93
#define DEC_SPEED_2	0x02	// siderial x2
94
#define DEC_SPEED_8	0x04	// siderial x8
95
#define DEC_SPEED_16	0x08	// siderial x16
96
 
97
/* Prototypes for paddle.c functions that can be called from outside
98
 */
99
extern void paddleInit(void);
100
 
101
extern uint8_t	paddleDecRate;
102
extern uint8_t	paddleRaRate;
103
extern uint8_t	siderialRate;
104
 
105
/* Configuration variable - sets whether the 2X rate for the paddle should
106
 * be considered as 1X or 0.3X
107
 */
108
extern uint8_t  paddleGuideRate;
109
#endif /* _PADDLE_H_ */