forked from schneider42/moodlamp-rf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.h
276 lines (229 loc) · 6.43 KB
/
config.h
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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
/* vim:fdm=marker ts=4 et ai
* {{{
* fnordlicht firmware next generation
*
* for additional information please
* see http://koeln.ccc.de/prozesse/running/fnordlicht
*
* (c) by Alexander Neumann <[email protected]>
* Lars Noschinski <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* For more information on the GPL, please go to:
* http://www.gnu.org/copyleft/gpl.html
}}} */
#ifndef _FNORDLICHT_CONFIG_H
#define _FNORDLICHT_CONFIG_H
#define BOARD_0_1 0 //old moodlamp design
#define BOARD_RF_0_1 1 //proto rf board
#define BOARD_RF_0_2 2 //current rf board
#ifndef BOARD
#define BOARD BOARD_RF_0_2
#endif
#ifndef F_CPU
#define F_CPU 18432000UL
#endif
#ifndef LED_PORT
#define LED_PORT PORTA
#endif
#ifndef LED_PORT_DDR
#define LED_PORT_DDR DDRA
#endif
#ifndef LED_PORT_INVERT
#define LED_PORT_INVERT 0
#endif
/* color <-> channel assignment */
#define CHANNEL_RED 0
#define CHANNEL_GREEN 1
#define CHANNEL_BLUE 2
#define RC5_DECODER 1
#define RS485_CTRL 1
#define SCRIPT_SPEED_CONTROL 1
#define STATIC_SCRIPTS 1
#define USB_CTRL 1
#define UART_BAUDRATE 230400
#define SERIAL_UART 1
#define CONFIG1_PIN PB0
#define CONFIG1_PORT B
#define JUMPER1C1_PIN PC3
#define JUMPER1C1_PORT C
#define JUMPER1C2_PIN PC3
#define JUMPER1C2_PORT C
#define LED3_PIN PA4
#define LED3_PORT A
#define LED2_PIN PA5
#define LED2_PORT A
#define LED1_PIN PA7
#define LED1_PORT A
#define xRC5C2_PORT PORTB
#define xRC5C2_IN PINB
#define xRC5C2 PB1 // IR input low active
#define xRC5C1_PORT PORTD
#define xRC5C1_IN PIND
#define xRC5C1 PD6 // IR input low active
#define ADC_MINBATIDLE 530 //4v
/* debug defines */
#ifndef DEBUG
#define DEBUG 0
#endif
/* include the script intpreter per default */
#ifndef STATIC_SCRIPTS
#define STATIC_SCRIPTS 1
#endif
/* include uart support per default */
#ifndef SERIAL_UART
#define SERIAL_UART 0
#endif
/* disable at keyboard decoder per default (EXPERIMENTAL) */
/* ATTENTION: THIS IS EXPERIMENTAL AND DOES NOT WORK ATM! */
#ifndef AT_KEYBOARD
#define AT_KEYBOARD 0
#endif
/* disable rc5-decoder per default */
#ifndef RC5_DECODER
#define RC5_DECODER 1
#endif
/* disable scripts speed control per default */
#ifndef SCRIPT_SPEED_CONTROL
#define SCRIPT_SPEED_CONTROL 1
#endif
/* fifo size must be a power of 2 and below 128 */
//#define UART_FIFO_SIZE 32
#ifndef UART_BAUDRATE
#define UART_BAUDRATE 19200
#endif
#ifndef PWM_USESCALE
#define PWM_USESCALE
#endif
/* enable this if you want to control a fnordlicht via RS485 */
#if RS485_CTRL
#define TEENSY_SUPPORT
#define RS485_TX_PIN_PORT C
#define RS485_TX_PIN_PIN PC4
#define RS485_NRX_PIN_PORT C
#define RS485_NRX_PIN_PIN PC5
#define ZBUS_BAUDRATE 115200
/*#define RS485_TX_DDR DDRD
#define RS485_RX_DDR DDRD
#define RS485_RX_PORT PORTD
#define RS485_TX_PORT PORTD
#define RS485_TX_PIN PD4
#define RS485_NRX_PIN PD5*/
#endif
/*#if (RS485_CTRL == 1) && (SERIAL_UART == 1) && !(ROLE == ROLE_MASTER)
#error "RS485_CTRL and SERIAL_UART are mutually exclusive!"
#endif*/
#include <avr/version.h>
/* check for avr-libc version */
#if __AVR_LIBC_VERSION__ < 10604UL
#error newer libc version (>= 1.6.4) needed!
#endif
/* check if cpu speed is defined */
#ifndef F_CPU
#error please define F_CPU!
#endif
/* check if this cpu is supported */
#if !(defined(__AVR_ATmega8__) || defined(__AVR_ATmega88__) || defined(__AVR_ATmega168__) || defined(__AVR_ATmega16__) || defined(__AVR_ATmega324P__) || defined(__AVR_ATmega644P__) || defined(__AVR_ATmega32__))
#error "this cpu isn't supported yet!"
#endif
/* cpu specific configuration registers */
#if defined(__AVR_ATmega8__)
/* {{{ */
#define _ATMEGA8
#define _TIMSK_TIMER1 TIMSK
#define _UCSRB_UART0 UCSRB
#define _UDRIE_UART0 UDRIE
#define _TXEN_UART0 TXEN
#define _RXEN_UART0 RXEN
#define _RXCIE_UART0 RXCIE
#define _UBRRH_UART0 UBRRH
#define _UBRRL_UART0 UBRRL
#define _UCSRC_UART0 UCSRC
#define _UCSZ0_UART0 UCSZ0
#define _UCSZ1_UART0 UCSZ1
#define _SIG_UART_RECV_UART0 SIG_UART_RECV
#define _SIG_UART_DATA_UART0 SIG_UART_DATA
#define _UDR_UART0 UDR
#define UCSR0A UCSRA
#define UCSR0C UCSRC
#define MPCM0 MPCM
#define UCSZ00 UCSZ0
#define UCSZ01 UCSZ1
#define UCSZ02 UCSZ2
#define UBRR0H UBRRH
#define UBRR0L UBRRL
#define UCSR0B UCSRB
#define RXEN0 RXEN
#define TXEN0 TXEN
#define RXC0 RXC
#define RXB80 RXB8
#define UDR0 UDR
/* }}} */
#elif defined(__AVR_ATmega16__) || defined(__AVR_ATmega32__)
/* {{{ */
#define _ATMEGA16
#define _EICRA MCUCR
#define _EIMSK GICR
#define _TIMSK_TIMER1 TIMSK
#define _UCSRB_UART0 UCSRB
#define _UDRIE_UART0 UDRIE
#define _TXEN_UART0 TXEN
#define _RXEN_UART0 RXEN
#define _RXCIE_UART0 RXCIE
#define _UBRRH_UART0 UBRRH
#define _UBRRL_UART0 UBRRL
#define _UCSRC_UART0 UCSRC
#define _UCSZ0_UART0 UCSZ0
#define _UCSZ1_UART0 UCSZ1
#define _SIG_UART_RECV_UART0 SIG_UART_RECV
#define _SIG_UART_DATA_UART0 SIG_UART_DATA
#define _UDR_UART0 UDR
#define UCSR0A UCSRA
#define UCSR0C UCSRC
#define MPCM0 MPCM
#define UCSZ00 UCSZ0
#define UCSZ01 UCSZ1
#define UCSZ02 UCSZ2
#define UBRR0H UBRRH
#define UBRR0L UBRRL
#define UCSR0B UCSRB
#define RXEN0 RXEN
#define TXEN0 TXEN
#define RXC0 RXC
#define RXB80 RXB8
#define UDR0 UDR
/* }}} */
#elif defined(__AVR_ATmega88__) || defined(__AVR_ATmega168__)|| defined(__AVR_ATmega324P__) || defined(__AVR_ATmega644P__)
/* {{{ */
#define _ATMEGA88
#define _EICRA EICRA
#define _EIMSK EIMSK
#define _TIMSK_TIMER1 TIMSK1
#define _UCSRB_UART0 UCSR0B
#define _UDRIE_UART0 UDRIE0
#define _TXEN_UART0 TXEN0
#define _RXEN_UART0 RXEN0
#define _RXCIE_UART0 RXCIE0
#define _UBRRH_UART0 UBRR0H
#define _UBRRL_UART0 UBRR0L
#define _UCSRC_UART0 UCSR0C
#define _UCSZ0_UART0 UCSZ00
#define _UCSZ1_UART0 UCSZ01
#define _SIG_UART_RECV_UART0 SIG_USART_RECV
#define _SIG_UART_DATA_UART0 SIG_USART_DATA
#define _UDR_UART0 UDR0
/* }}} */
#endif
#endif /* _FNORDLICHT_CONFIG_H */