aboutsummaryrefslogtreecommitdiff
path: root/AT91SAM7S256/Source/c_input.iom
blob: dee130980b84d235ed918f1a84473b685fb026e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
//
// Date init       14.12.2004
//
// Revision date   $Date:: 24-09-08 15:23                                    $
//
// Filename        $Workfile:: c_input.iom                                   $
//
// Version         $Revision:: 16                                            $
//
// Archive         $Archive:: /LMS2006/Sys01/Main_V02/Firmware/Source/c_inpu $
//
// Platform        C
//

#ifndef   CINPUT_IOM
#define   CINPUT_IOM

#define   NO_OF_INPUTS     4
#define   pMapInput        ((IOMAPINPUT*)(pHeaders[ENTRY_INPUT]->pIOMap))


/* Constants related to sensor type  */
enum
{
  NO_SENSOR           =  0,
  SWITCH              =  1,
  TEMPERATURE         =  2,
  REFLECTION          =  3,
  ANGLE               =  4,
  LIGHT_ACTIVE        =  5,
  LIGHT_INACTIVE      =  6,
  SOUND_DB            =  7,
  SOUND_DBA           =  8,
  CUSTOM              =  9,
  LOWSPEED            = 10,
  LOWSPEED_9V         = 11,
  HIGHSPEED           = 12,
  COLORFULL           = 13,
  COLORRED            = 14,
  COLORGREEN          = 15,
  COLORBLUE           = 16,
  COLORNONE           = 17,
  COLOREXIT           = 18, /* For internal use when going from color or Lamp to no_sensor*/
  NO_OF_SENSOR_TYPES  = 18
};

/* Constants related to sensor mode */
enum
{
  RAWMODE           = 0x00,
  BOOLEANMODE       = 0x20,
  TRANSITIONCNTMODE = 0x40,
  PERIODCOUNTERMODE = 0x60,
  PCTFULLSCALEMODE  = 0x80,
  CELSIUSMODE       = 0xA0,
  FAHRENHEITMODE    = 0xC0,
  ANGLESTEPSMODE    = 0xE0,
  SLOPEMASK         = 0x1F,
  MODEMASK          = 0xE0
};

/* Constants related to Digital I/O */
enum
{
  DIGI0             = 1,
  DIGI1             = 2
};

enum
{
  CUSTOMINACTIVE    = 0x00,
  CUSTOM9V          = 0x01,
  CUSTOMACTIVE      = 0x02
};

enum
{
  INVALID_DATA      = 0x01
};

/* Constants related to Colorstruct */
enum
{
  RED,
  GREEN,
  BLUE,
  BLANK,
  NO_OF_COLORS
};


/* Constants related to color sensor value using */
/* Color sensor as color detector                */
enum
{
  BLACKCOLOR   = 1,
  BLUECOLOR    = 2,
  GREENCOLOR   = 3,
  YELLOWCOLOR  = 4,
  REDCOLOR     = 5,
  WHITECOLOR   = 6
};


/* Constants related to Color CalibrationState */
/* When STARTCAL is TRUE then calibration is   */
/* in progress                                 */
enum
{
  SENSORCAL     = 0x01,
  SENSOROFF     = 0x02,
  RUNNINGCAL    = 0x20,
  STARTCAL      = 0x40,
  RESETCAL      = 0x80,
};

enum
{
  CAL_POINT_0,
  CAL_POINT_1,
  CAL_POINT_2,
  NO_OF_POINTS
};


typedef   struct
{
  UWORD   CustomZeroOffset;    /* Set the offset of the custom sensor  */
  UWORD   ADRaw;
  UWORD   SensorRaw;
  SWORD   SensorValue;

  UBYTE   SensorType;
  UBYTE   SensorMode;
  UBYTE   SensorBoolean;

  UBYTE   DigiPinsDir;         /* Direction of the Digital pins 1 is output 0 is input         */
  UBYTE   DigiPinsIn;          /* Contains the status of the digital pins                      */
  UBYTE   DigiPinsOut;         /* Sets the output level of the digital pins                    */
  UBYTE   CustomPctFullScale;  /* Sets the Pct full scale of the custom sensor                 */
  UBYTE   CustomActiveStatus;  /* Sets the active or inactive state of the custom sensor       */

  UBYTE   InvalidData;         /* Indicates wether data is invalid (1) or valid (0)            */

  UBYTE   Spare1;
  UBYTE   Spare2;
  UBYTE   Spare3;

}INPUTSTRUCT;

typedef   struct
{

  ULONG   Calibration[NO_OF_POINTS][NO_OF_COLORS];
  UWORD   CalLimits[NO_OF_POINTS - 1];
  UWORD   ADRaw[NO_OF_COLORS];
  UWORD   SensorRaw[NO_OF_COLORS];
  SWORD   SensorValue[NO_OF_COLORS];
  UBYTE   Boolean[NO_OF_COLORS];
  UBYTE   CalibrationState;
  UBYTE   Free1;
  UBYTE   Free2;
  UBYTE   Free3;
}COLORSTRUCT;

typedef   struct
{
  INPUTSTRUCT   Inputs[NO_OF_INPUTS];
  COLORSTRUCT   Colors[NO_OF_INPUTS];
}IOMAPINPUT;

#endif