-
Notifications
You must be signed in to change notification settings - Fork 20
/
world.cfg
546 lines (537 loc) · 12.9 KB
/
world.cfg
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
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
doc: 'This is a sample configuration file. It''s written in YAML because that''s structured
and easy to read.
The "cfg" program can extract single entries from this. It will concatenate list
entries and convert hashes to C flags definitions.
''_ref'' means that whatever key is not here is looked up there, so the value of
test.1.foo is ''bar''. ''_default'' does the same thing, except that the key is
skipped, so the value of test.1.foo.seven is ''six''.
''targets:'' lists the devices that are built by default.
"cfg <file> .cdefs DEVICE" generates -DXXX=yy command-line arguments.
"cfg <file> .cfiles DEVICE" lists the input files required for building.
"cfg <file> .type DEVICE" generates "foo N" stanzas for gen_eeprom''s "type" entry.
"cfg <file> .hdr DEVICE" generates the file ''device/DEVICE/dev_config.h''.
The "cfg_write" program updates or adds values. It does not follow ''_ref'' links
and ''_default'' entries, so only specific values will be overwritten.'
test:
- foo:
one: two
three: four
_default: six
baz: quux
- _ref: test.0
ever:
- you say
- too
foo:
one: five
env:
prog: usbtiny
avrdude: sudo avrdude
codes:
_doc: Do not modify! These are also used by OWFS.
onewire:
moat: F0
boot: F1
ds2408: 29
ds2423: 1D
blocks:
- _list
- _nums
- euid
- rf12
- crypto
- owid
- type
- name
- loader
types:
- config
- alert
- status
- console
- port
- pwm
- count
- adc
- temp
- humid
- pid
- smoke
status:
- _nums
- reboot
- loader
_doc:
codes:
_doc: 'constants for code generation.
NOTE: These values are also defined in OWFS at module/owlib/src/include/ow_moat.h.'
blocks: data types in EPROM, 0-based, values starting with an underscore are special
types: Message types on the bus, 0-based
onewire: unique 1wire ID (starts with 'x' to prevent interpretation as a number,
in case all hex digits happen to be 0-9)
devices:
NAME:
defs:
have_uart: Use serial port
have_uart_irq: Use interrupt-based serial (otherwise poll)
have_uart_sync: Don't buffer serial data (no IRQ, no polling, severe delays)
have_timer: setup timer interrupt
have_tov0: for the IRQ catcher
have_watchdog: enable the watchdog timer (longest possible timeout)
debug_uart: debug UART IRQ/poll
debug_eeprom: debug EEPROM code
debug_onewire: low-level debug onewire comms
uart_debug: send debug output to the serial port
console_debug: send debug output to the console
console_write: 'send to the console buf via 1wire (good for testing); 2: interpret
commands'
console_ping: send a '!' every console_ping tenths-of-a-second
have_dbg_port: Use a port for diag code output
have_dbg_pin: Use a port for diag signalling
is_onewire: OW type (moat, ds2408, ds2423)
is_bootloader: build a reprogrammable version
use_bootloader: build code to load onto a reprogrammable version
use_eeprom: Store writeable config in EEPROM. 1:EEPROM-only, 2:initial load from flash
use_eeprom_crc: additional CRC check for EEPROM contents
conditional_search: Make 1wire device discoverable conditionally (alarms,
changes etc.)
single_device: Add 1wire code for SKIP_ROM and READ_ROM
need_bits: code needs to read/write single bits on 1wire bus
onewire_io: hardware pin to use for 1wire
use_adc_as_digital: do not disable digital logic for ADC pins used as ADC (affects all ADC pins)
pin_irq: 'mapping from pin to INT/PCINT. negative: INT(-n-1), otherwise PCINT(n+pin)'
types:
_doc:
- Emitted as N_XXX=y definitions for y>0 with ".cdefs"
- Emitted as "name
- also see OWFS: ow_moat.h
console: channel present? (only one is supported)
port: binary inputs and outputs
temp: temperature sensors
humid: humidity sensors
adc: analog-to-digital converters
pid: autonomous PID controllers
pwm: outputs that are PWM controlled, i.e. poor man's DAC
smoke: interfaces with Gira Dual detector
count: transition counter
port:
- Port to read/write by default. Like "B2" or "D0". Indexed by port number
- '''^'' : A: 1: output high'
- '''_'' : B: 0: output low'
- '''+'' : C: 1: pull-up resistor'
- '''~'' : D: 0: high-impedance'
- 'Standard behavior: switch between states A/B and C/D when writing 0/1.'
- Add / to switch A/D and B/C instead.
- Add ! to switch A/C and B/D instead. (In that case, CD is 'high'.)
- Add * to alert on state change. Setting a port sets the expected state to
whatever you write.
- 'Note: If some pins are unused, it is recommended to ensure that these pins
have a defined level to reduce current consumption.
The way to do this with the MOAT device is to make them a "port"
input with pull-up enabled (suffix +).'
pwm:
- Number of the port to manage
- Add * to alert if the PWM stops (zero value, i.e. one-shot)
- Add ! to immediately switch if PWM is set
count:
- Number of the port to count transitions on. Default count both rising/falling edges.
- Add * to alert on counter change.
- Add + to only trigger on rising edges.
- Add - to only trigger on falling edges.
adc:
- 0…7: Analog input pin to read
- G: read ground pin (to measure ADC offset)
- R: read bandgap voltage (Do not use "R-", that obviously makes no sense)
- T: read temperature sensor (Do use "T-" instead of "T")
- '-': use bandgap voltage (Vbg) as reference (~1.1V)
temp:
- 'Device to read.'
- 'Format: driver=number'
- drivers:
dummy: 'test, doesn''t do much'
- Add * to alert on value outside thresholds
mcu:
_default:
_doc: 'The default matches the ATmega 88/168/328, mostly'
defs:
onewire_io: D2
pin_irq:
D2: -1
D3: -2
B: 0
C: 8
D: 16
tiny13:
_doc: incomplete and untested
defs:
onewire_io: B1
tiny84:
_doc: untested for some time
mcu: attiny84
flash:
size: 8
prog: t84
defs:
onewire_io: B2
tiny85:
_doc: untested for some time
mcu: attiny85
flash:
size: 8
prog: t85
defs:
onewire_io: B1
mega8:
mcu: atmega8
prog: m8
flash:
size: 8
align: 32
mega88:
mcu: atmega88
prog: m88
flash:
size: 8
align: 32
mega168:
mcu: atmega168
prog: m168
flash:
size: 16
mega328:
mcu: atmega328
prog: m328
flash:
size: 32
defaults:
flags: null
types:
config: -1
alert: -1
console: 0
port: 0
temp: 0
humid: 0
adc: 0
pid: 0
pwm: 0
smoke: 0
count: 0
target:
_default:
defs:
is_onewire: moat
is_bootloader: 0
use_bootloader: 0
have_uart: 0
use_eeprom: 1
conditional_search: 1
single_device: 1
have_timer: 1
have_watchdog: 0
have_uart_irq: 0
have_irq_catcher: 0
have_dbg_port: 0
have_dbg_pin: 0
have_tov0: 1
console_ping: 0
m168:
_doc: basic atmega168 with internal crystal
_ref: mcu.mega168
heiz:
_doc: m88 controlling heating
_ref: defaults.target.m88
types:
console: 1
port: 6
pwm: 2
port:
1: B2_
2: B1_
3: C0~
4: C1~
5: C2~
6: C3~
t85:
_doc: basic attiny85 with internal crystal
_ref: mcu.tiny85
defs:
f_cpu: 8000000
have_timer: 0
have_dbg_port: 0
have_dbg_pin: 0
types:
pwm: 0
fuse:
l: xE2
h: xFF
e: x01
_doc: fuse.e might have to be xFF, depending on what the unused bits do
port:
1: B0~
2: B1~
3: B3~
4: B4~
5: B5~
count:
1: 1
2: 2
3: 3
4: 4
5: 5
adc:
1: 2
2: 3
3: 4
m8x_base:
_doc: basic atmega8/atmega88, to be extended
defs:
f_cpu: 8000000
port:
1: B0~
2: B1~
3: B2~
4: B3~
5: B4~
6: B5~
7: D3~
8: D4~
9: D5~
10: D6~
11: D7~
12: C0~
13: C1~
14: C2~
15: C3~
16: C4~
17: C5~
18: C6~
19: B6~
20: B7~
pwm:
1: 1
2: 2
3: 3
4: 4
5: 5
6: 6
7: 7
8: 8
9: 9
count:
1: 1
2: 2
3: 3
4: 4
5: 5
6: 6
7: 7
8: 8
9: 9
adc:
1: 0
2: 1
3: 2
4: 3
5: 4
6: 5
7: 6
8: 7
9: T-
10: R
11: G
m8:
_doc: basic atmega8 with internal crystal
_ref:
- defaults.target.m8x_base
- mcu.mega8
defs:
have_timer: 0
m88:
_doc: basic atmega88 with internal crystal
_ref:
- defaults.target.m8x_base
- mcu.mega88
fuse:
l: xE2
h: xDC
e: x00
_doc: fuse.e might have to be xF8, depending on what the unused bits do
m88f:
_doc: version of m88 with external crystal
_ref: defaults.target.m88
defs:
f_cpu: 20000000
fuse:
l: FF
devices:
test_ser:
defs:
have_uart: 1
have_uart_irq: 0
have_uart_sync: 1
have_irq_catcher: 0
have_dbg_port: 1
have_dbg_pin: 1
have_tov0: 0
is_onewire: 0
uart_debug: 1
code:
- test
test2:
_ref: devices.test
defs:
is_onewire: ds2408
conditional_search: 1
onewire_id: xdbff6af36f26
heiz1:
_doc: Test board for heating, v2.7
_ref: defaults.target.heiz
onewire_id: x94b934ca233f
test85:
_doc: Test build for ATtiny85
_ref: defaults.target.t85
port:
_doc: 'Test setup: B0 is connected to B3'
1: B0_
2: B1^
3: B3+*
count:
1: 3*
2: 4*+
pwm:
_doc: just to mix things up a bit ;-)
1: 2
2: 1
adc:
_doc: This switches between reference voltages. Connect ADC0 to B0 via a slow
R-C network (10 µF @ 1 MOhm)
1: R
2: T
3: T-
4: 2*
types:
console: 1
port: 3
count: 2
adc: 4
status: 1
onewire_id: x43b794f48007
test:
_doc: '"test8"-Boarduino, using 16MHz crystal osc'
_ref: devices.test8
defs:
f_cpu: 16000000
fuse:
l: DE
onewire_id: x4cff5504bd15
test8b:
_doc: '"test8"-Boarduino, reprogrammable'
_ref: devices.test8
defs:
is_bootloader: 1
onewire_id: x2a87d2ef670b
test8bc:
_doc: '"test8"-Boarduino, code for reprogrammable'
_ref: devices.test8b
defs:
use_bootloader: test8b
onewire_id: x2a87d2ef670c
test8:
_doc: 'Boarduino, ~8MHz internal osc. Ports used: D0+D1 serial D2 1wire D3 debug-bit C0-C4
debug-nibble(and a bit) C5 analog test input B3-B5,C6 Programmer '
defs:
have_uart: 1
have_uart_irq: 0
have_uart_sync: 1
have_dbg_port: 0
have_dbg_pin: 0
have_irq_catcher: 0
have_watchdog: 0
console_write: 2
debug_uart: 0
debug_eeprom: 0
debug_onewire: 0
console_debug: 0
uart_debug: 1
console_ping: 0
use_eeprom: 2
onewire_id: x947476a5f130
fuse:
h: xDC
port:
_doc: 'Test setup: B0 is connected to D6, B1 to D7'
1: B0_
2: B1^
3: D6+*
4: D7~*
count:
1: 3*
2: 4*
pwm:
_doc: just to mix things up a bit ;-)
1: 2
2: 1
adc:
_doc: This switches between reference voltages. Connect ADC0 to B0 via a slow
R-C network (10 µF @ 1 MOhm)
1: R
2: T
3: T-
4: 5*
temp:
- dummy=1
- dummy=10
types:
console: 1
port: 4
pwm: 2
count: 2
adc: 4
status: 1
temp: 2
_default:
_ref: defaults.target.m88
types:
_ref: defaults.types
code: []
two:
_ref: defaults.target.m88f
one:
onewire_id: x7b034e8262c2
test_ds2408:
defs:
is_onewire: ds2408
conditional_search: 0
onewire_id: x3ed0badc460f
test_ds2423:
defs:
is_onewire: ds2423
onewire_id: xcacf2c9d0fef
test_ds2423_m8:
_ref: defaults.target.m8
defs:
analog: 1
is_onewire: ds2423
onewire_id: x13390287799c
load88:
_ref: defaults.target.m88
defs:
is_bootloader: 1
is_onewire: boot
have_uart: 0
use_eeprom: 0
conditional_search: 0
single_device: 0
have_timer: 0
have_watchdog: 0
onewire_id: x07d4aab6c972
test88:
_ref: devices.test8
defs:
use_eeprom: 2
onewire_id: x2fb6640aae69
targets:
- test
- one
- two