NiboRoboLib 3.6 - NIBO Library
iodefs_nibo2.h
gehe zur Dokumentation dieser Datei
1 /* BSD-License:
2 
3 Copyright (c) 2007 by Nils Springob, nicai-systems, Germany
4 
5 All rights reserved.
6 
7 Redistribution and use in source and binary forms, with or without modification,
8 are permitted provided that the following conditions are met:
9 
10  * Redistributions of source code must retain the above copyright notice,
11  this list of conditions and the following disclaimer.
12  * Redistributions in binary form must reproduce the above copyright notice,
13  this list of conditions and the following disclaimer in the documentation
14  and/or other materials provided with the distribution.
15  * Neither the name nicai-systems nor the names of its contributors may be
16  used to endorse or promote products derived from this software without
17  specific prior written permission.
18 
19 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
23 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
26 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 
31 */
32 
41 #define IO_LEDS_RED_PORT PORTE
42 #define IO_LEDS_RED_MASK 0xff
43 #define IO_LEDS_RED_DDR DDRE
44 
46 #define IO_LEDS_GREEN_PORT PORTC
47 #define IO_LEDS_GREEN_MASK 0xff
48 #define IO_LEDS_GREEN_DDR DDRC
49 
50 
52 #define IO_LED_WHITE_PORT PORTB
53 #define IO_LED_WHITE_BIT 5
54 #define IO_LED_WHITE_DDR DDRB
55 
57 #define IO_DISP_LIGHT_PORT PORTB
58 #define IO_DISP_LIGHT_BIT 6
59 #define IO_DISP_LIGHT_DDR DDRB
60 
62 #define IO_LED_RG_PORT PORTB
63 #define IO_LED_RG_BIT 7
64 #define IO_LED_RG_DDR DDRB
65 
67 #define IO_AUDIO_PORT PORTB
68 #define IO_AUDIO_BIT 4
69 #define IO_AUDIO_DDR DDRB
70 
71 
72 
74 #define IO_LINE_FLOOR_EN IO_LINE_FLOOR_EN
75 #define IO_LINE_FLOOR_EN_PORT PORTF
76 #define IO_LINE_FLOOR_EN_BIT 6
77 #define IO_LINE_FLOOR_EN_DDR DDRF
78 
79 
81 #define AN_FLOOR_R 0
82 #define AN_FLOOR_L 1
83 #define AN_LINE_L 2
84 #define AN_LINE_R 3
85 #define AN_VBAT 7
89 #define IO_DISPLAY_RS IO_DISPLAY_RS
90 #define IO_DISPLAY_RS_PORT PORTG
91 #define IO_DISPLAY_RS_BIT 3
92 #define IO_DISPLAY_RS_DDR DDRG
93 
95 #define IO_DISPLAY_RW IO_DISPLAY_RW
96 #define IO_DISPLAY_RW_PORT PORTG
97 #define IO_DISPLAY_RW_BIT 4
98 #define IO_DISPLAY_RW_DDR DDRG
99 
101 #define IO_DISPLAY_EN IO_DISPLAY_EN
102 #define IO_DISPLAY_EN_PORT PORTG
103 #define IO_DISPLAY_EN_BIT 2
104 #define IO_DISPLAY_EN_DDR DDRG
105 
107 #define IO_DISPLAY_CS1 IO_DISPLAY_CS1
108 #define IO_DISPLAY_CS1_PORT PORTG
109 #define IO_DISPLAY_CS1_BIT 0
110 #define IO_DISPLAY_CS1_DDR DDRG
111 
113 #define IO_DISPLAY_CS2 IO_DISPLAY_CS2
114 #define IO_DISPLAY_CS2_PORT PORTG
115 #define IO_DISPLAY_CS2_BIT 1
116 #define IO_DISPLAY_CS2_DDR DDRG
117 
119 #define IO_DISPLAY_RST IO_DISPLAY_RST
120 #define IO_DISPLAY_RST_PIN PINB
121 #define IO_DISPLAY_RST_PORT PORTB
122 #define IO_DISPLAY_RST_BIT 0
123 #define IO_DISPLAY_RST_DDR DDRB
124 
126 #define IO_DISPLAY_PORT PORTA
127 #define IO_DISPLAY_PIN PINA
128 #define IO_DISPLAY_DDR DDRA
129 
130 
132 #define IO_EXT_A_PORT PORTD
133 #define IO_EXT_A_PIN PIND
134 #define IO_EXT_A_BIT 6
135 #define IO_EXT_A_DDR DDRD
136 
138 #define IO_EXT_B_PORT PORTD
139 #define IO_EXT_B_PIN PIND
140 #define IO_EXT_B_BIT 5
141 #define IO_EXT_B_DDR DDRD
142 
144 #define IO_EXT_C_PORT PORTD
145 #define IO_EXT_C_PIN PIND
146 #define IO_EXT_C_BIT 3
147 #define IO_EXT_C_DDR DDRD
148 
150 #define IO_EXT_D_PORT PORTD
151 #define IO_EXT_D_PIN PIND
152 #define IO_EXT_D_BIT 2
153 #define IO_EXT_D_DDR DDRD
154 
156 #define IO_RESET_CO_PORT PORTD
157 #define IO_RESET_CO_BIT 7
158 #define IO_RESET_CO_DDR DDRD
159 
160 
162 #define IO_INPUT_1 IO_INPUT_1
163 #define IO_INPUT_1_PORT PORTD
164 #define IO_INPUT_1_PIN PIND
165 #define IO_INPUT_1_BIT 4
166 #define IO_INPUT_1_DDR DDRD
167 
169 #define IO_INPUT_2 IO_INPUT_2
170 #define IO_INPUT_2_PORT PORTF
171 #define IO_INPUT_2_PIN PINF
172 #define IO_INPUT_2_BIT 5
173 #define IO_INPUT_2_DDR DDRF
174 
176 #define IO_INPUT_3 IO_INPUT_3
177 #define IO_INPUT_3_PORT PORTF
178 #define IO_INPUT_3_PIN PINF
179 #define IO_INPUT_3_BIT 4
180 #define IO_INPUT_3_DDR DDRF
181 
182 
184 #define IO_ISP_SCK_PORT PORTB
185 #define IO_ISP_SCK_BIT 1
186 #define IO_ISP_SCK_DDR DDRB
187 
189 #define IO_ISP_MOSI_PORT PORTB
190 #define IO_ISP_MOSI_BIT 2
191 #define IO_ISP_MOSI_DDR DDRB
192 
194 #define IO_ISP_MISO_PORT PORTB
195 #define IO_ISP_MISO_PIN PINB
196 #define IO_ISP_MISO_BIT 3
197 #define IO_ISP_MISO_DDR DDRB
198 
200 #define IO_ISP_SS IO_DISPLAY_RST
201 
203 #define IO_I2C_SDA_PORT PORTD
204 #define IO_I2C_SDA_PIN PIND
205 #define IO_I2C_SDA_BIT 1
206 #define IO_I2C_SDA_DDR DDRD
207 
209 #define IO_I2C_SCL_PORT PORTD
210 #define IO_I2C_SCL_PIN PIND
211 #define IO_I2C_SCL_BIT 0
212 #define IO_I2C_SCL_DDR DDRD
213 
214 
216 #define I2C_BUF_SIZE 20
217 #define I2C_TWBR_INIT 72 /* 100 kHz */
218 //#define I2C_TWBR_INIT 12 /* 400 kHz */
219 
220 
221 
223 #define IRCO_I2C_ID 42
224 
226 #define MOTCO_I2C_ID 44
227 
229 #define COPRO_I2C_ID 46
230 
231