avr-device 0.8.1

Register access crate for AVR microcontrollers
Documentation
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
_include:
  - "common/ac.yaml"
  - "common/eeprom.yaml"
  - "common/spi.yaml"
  - "common/wdt.yaml"

  - "timer/attiny828.yaml"

PORTA:
  DDRA:
    _add:
      PA0:
        description: "Pin A0"
        bitRange: "[0:0]"
        access: read-write
      PA1:
        description: "Pin A1"
        bitRange: "[1:1]"
        access: read-write
      PA2:
        description: "Pin A2"
        bitRange: "[2:2]"
        access: read-write
      PA3:
        description: "Pin A3"
        bitRange: "[3:3]"
        access: read-write
      PA4:
        description: "Pin A4"
        bitRange: "[4:4]"
        access: read-write
      PA5:
        description: "Pin A5"
        bitRange: "[5:5]"
        access: read-write
      PA6:
        description: "Pin A6"
        bitRange: "[6:6]"
        access: read-write
      PA7:
        description: "Pin A7"
        bitRange: "[7:7]"
        access: read-write
  PINA:
    _add:
      PA0:
        description: "Pin A0"
        bitRange: "[0:0]"
        access: read-write
      PA1:
        description: "Pin A1"
        bitRange: "[1:1]"
        access: read-write
      PA2:
        description: "Pin A2"
        bitRange: "[2:2]"
        access: read-write
      PA3:
        description: "Pin A3"
        bitRange: "[3:3]"
        access: read-write
      PA4:
        description: "Pin A4"
        bitRange: "[4:4]"
        access: read-write
      PA5:
        description: "Pin A5"
        bitRange: "[5:5]"
        access: read-write
      PA6:
        description: "Pin A6"
        bitRange: "[6:6]"
        access: read-write
      PA7:
        description: "Pin A7"
        bitRange: "[7:7]"
        access: read-write
  PORTA:
    _add:
      PA0:
        description: "Pin A0"
        bitRange: "[0:0]"
        access: read-write
      PA1:
        description: "Pin A1"
        bitRange: "[1:1]"
        access: read-write
      PA2:
        description: "Pin A2"
        bitRange: "[2:2]"
        access: read-write
      PA3:
        description: "Pin A3"
        bitRange: "[3:3]"
        access: read-write
      PA4:
        description: "Pin A4"
        bitRange: "[4:4]"
        access: read-write
      PA5:
        description: "Pin A5"
        bitRange: "[5:5]"
        access: read-write
      PA6:
        description: "Pin A6"
        bitRange: "[6:6]"
        access: read-write
      PA7:
        description: "Pin A7"
        bitRange: "[7:7]"
        access: read-write

PORTB:
  DDRB:
    _add:
      PB0:
        description: "Pin B0"
        bitRange: "[0:0]"
        access: read-write
      PB1:
        description: "Pin B1"
        bitRange: "[1:1]"
        access: read-write
      PB2:
        description: "Pin B2"
        bitRange: "[2:2]"
        access: read-write
      PB3:
        description: "Pin B3"
        bitRange: "[3:3]"
        access: read-write
      PB4:
        description: "Pin B4"
        bitRange: "[4:4]"
        access: read-write
      PB5:
        description: "Pin B5"
        bitRange: "[5:5]"
        access: read-write
      PB6:
        description: "Pin B6"
        bitRange: "[6:6]"
        access: read-write
      PB7:
        description: "Pin B7"
        bitRange: "[7:7]"
        access: read-write
  PINB:
    _add:
      PB0:
        description: "Pin B0"
        bitRange: "[0:0]"
        access: read-write
      PB1:
        description: "Pin B1"
        bitRange: "[1:1]"
        access: read-write
      PB2:
        description: "Pin B2"
        bitRange: "[2:2]"
        access: read-write
      PB3:
        description: "Pin B3"
        bitRange: "[3:3]"
        access: read-write
      PB4:
        description: "Pin B4"
        bitRange: "[4:4]"
        access: read-write
      PB5:
        description: "Pin B5"
        bitRange: "[5:5]"
        access: read-write
      PB6:
        description: "Pin B6"
        bitRange: "[6:6]"
        access: read-write
      PB7:
        description: "Pin B7"
        bitRange: "[7:7]"
        access: read-write
  PORTB:
    _add:
      PB0:
        description: "Pin B0"
        bitRange: "[0:0]"
        access: read-write
      PB1:
        description: "Pin B1"
        bitRange: "[1:1]"
        access: read-write
      PB2:
        description: "Pin B2"
        bitRange: "[2:2]"
        access: read-write
      PB3:
        description: "Pin B3"
        bitRange: "[3:3]"
        access: read-write
      PB4:
        description: "Pin B4"
        bitRange: "[4:4]"
        access: read-write
      PB5:
        description: "Pin B5"
        bitRange: "[5:5]"
        access: read-write
      PB6:
        description: "Pin B6"
        bitRange: "[6:6]"
        access: read-write
      PB7:
        description: "Pin B7"
        bitRange: "[7:7]"
        access: read-write

PORTC:
  DDRC:
    _add:
      PC0:
        description: "Pin C0"
        bitRange: "[0:0]"
        access: read-write
      PC1:
        description: "Pin C1"
        bitRange: "[1:1]"
        access: read-write
      PC2:
        description: "Pin C2"
        bitRange: "[2:2]"
        access: read-write
      PC3:
        description: "Pin C3"
        bitRange: "[3:3]"
        access: read-write
      PC4:
        description: "Pin C4"
        bitRange: "[4:4]"
        access: read-write
      PC5:
        description: "Pin C5"
        bitRange: "[5:5]"
        access: read-write
      PC6:
        description: "Pin C6"
        bitRange: "[6:6]"
        access: read-write
      PC7:
        description: "Pin C7"
        bitRange: "[7:7]"
        access: read-write
  PINC:
    _add:
      PC0:
        description: "Pin C0"
        bitRange: "[0:0]"
        access: read-write
      PC1:
        description: "Pin C1"
        bitRange: "[1:1]"
        access: read-write
      PC2:
        description: "Pin C2"
        bitRange: "[2:2]"
        access: read-write
      PC3:
        description: "Pin C3"
        bitRange: "[3:3]"
        access: read-write
      PC4:
        description: "Pin C4"
        bitRange: "[4:4]"
        access: read-write
      PC5:
        description: "Pin C5"
        bitRange: "[5:5]"
        access: read-write
      PC6:
        description: "Pin C6"
        bitRange: "[6:6]"
        access: read-write
      PC7:
        description: "Pin C7"
        bitRange: "[7:7]"
        access: read-write
  PORTC:
    _add:
      PC0:
        description: "Pin C0"
        bitRange: "[0:0]"
        access: read-write
      PC1:
        description: "Pin C1"
        bitRange: "[1:1]"
        access: read-write
      PC2:
        description: "Pin C2"
        bitRange: "[2:2]"
        access: read-write
      PC3:
        description: "Pin C3"
        bitRange: "[3:3]"
        access: read-write
      PC4:
        description: "Pin C4"
        bitRange: "[4:4]"
        access: read-write
      PC5:
        description: "Pin C5"
        bitRange: "[5:5]"
        access: read-write
      PC6:
        description: "Pin C6"
        bitRange: "[6:6]"
        access: read-write
      PC7:
        description: "Pin C7"
        bitRange: "[7:7]"
        access: read-write

PORTD:
  DDRD:
    _add:
      PD0:
        description: "Pin D0"
        bitRange: "[0:0]"
        access: read-write
      PD1:
        description: "Pin D1"
        bitRange: "[1:1]"
        access: read-write
      PD2:
        description: "Pin D2"
        bitRange: "[2:2]"
        access: read-write
      PD3:
        description: "Pin D3"
        bitRange: "[3:3]"
        access: read-write
  PIND:
    _add:
      PD0:
        description: "Pin D0"
        bitRange: "[0:0]"
        access: read-write
      PD1:
        description: "Pin D1"
        bitRange: "[1:1]"
        access: read-write
      PD2:
        description: "Pin D2"
        bitRange: "[2:2]"
        access: read-write
      PD3:
        description: "Pin D3"
        bitRange: "[3:3]"
        access: read-write
  PORTD:
    _add:
      PD0:
        description: "Pin D0"
        bitRange: "[0:0]"
        access: read-write
      PD1:
        description: "Pin D1"
        bitRange: "[1:1]"
        access: read-write
      PD2:
        description: "Pin D2"
        bitRange: "[2:2]"
        access: read-write
      PD3:
        description: "Pin D3"
        bitRange: "[3:3]"
        access: read-write


ADC:
  ADCSRA:
    ADPS:
      _replace_enum:
        PRESCALER_2: [1, "Prescaler Value 2"]
        PRESCALER_4: [2, "Prescaler Value 4"]
        PRESCALER_8: [3, "Prescaler Value 8"]
        PRESCALER_16: [4, "Prescaler Value 16"]
        PRESCALER_32: [5, "Prescaler Value 32"]
        PRESCALER_64: [6, "Prescaler Value 64"]
        PRESCALER_128: [7, "Prescaler Value 128"]
  ADCSRB:
    ADTS:
      _replace_enum:
        FREE_RUNNING: [0, "Free Running Mode"]
        ANALOG_COMPARATOR: [1, "Analog Comparator"]
        EXTERNAL_INTERRUPT: [2, "External Interrupt Request 0"]
        TIMER0_COMPARE_MATCH_A: [3, "Timer/Counter0 Compare Match A"]
        TIMER0_OVERFLOW: [4, "Timer/Counter0 Overflow"]
        TIMER1_COMPARE_MATCH_B: [5, "Timer/Counter1 Compare Match B"]
        TIMER1_OVERFLOW: [6, "Timer/Counter1 Overflow"]
        TIMER1_CAPTURE_EVENT: [7, "Timer/Counter1 Capture Event"]
  ADMUXB:
    REFS:
      _replace_enum:
        VCC: [0, "Vcc used as analog reference"]
        INTERNAL: [1, "Internal 1.1V Voltage Reference"]

CPU:
  SMCR:
    SM:
      _replace_enum:
        IDLE: [ 0, "Idle" ]
        ADC: [ 1, "ADC Noise Reduction" ]
        PDOWN: [ 2, "Power Down" ]

# Remove EEAR register duplicate declaration
EEPROM:
  _delete:
    - "EEAR"

EXINT:
  EICRA:
    ISC0:
      _replace_enum:
        LOW: [0, "The low level of INTx generates an interrupt request"]
        TOGGLE: [1, "Any logical change on INTx generates an interrupt request"]
        FALLING: [2, "The falling edge of INTx generates an interrupt request"]
        RISING: [3, "The rising edge of INTx generates an interrupt request"]

# ATtiny828 has only one USART peripheral and it's not is not compatible with common USARTn pattern.
USART:
  UCSRA:
    _modify:
      UPE:
        access: read-only
      DOR:
        access: read-only
      FE:
        access: read-only
      UDRE:
        access: read-only
      TXC:
        description: "USART Transmit Complete"
      RXC:
        access: read-only
  UCSRB:
    _modify:
      RXB8:
        access: read-only
  UCSRC:
    UMSEL:
      _replace_enum:
        USART_ASYNC: [0, "Asynchronous USART"]
        USART_SYNC:  [1, "Synchronous USART"]
        # The following option is missing from atdf file, but it's present in the datasheet
        SPI_MASTER:  [3, "Master SPI (MSPIM)"]
    UPM:
      _replace_enum:
        DISABLED:    [0, "Disabled"]
        PARITY_EVEN: [2, "Enabled, Even Parity"]
        PARITY_ODD:  [3, "Enabled, Odd Parity"]
    USBS:
      _replace_enum:
        STOP1: [0, "1-bit"]
        STOP2: [1, "2-bit"]
    UCSZ:
      _replace_enum:
        CHR5: [0, "Character Size: 5 bit"]
        CHR6: [1, "Character Size: 6 bit"]
        CHR7: [2, "Character Size: 7 bit"]
        CHR8: [3, "Character Size: 8 bit"]
    UCPOL:
      _replace_enum:
        RISING_EDGE:  [0, "Transmit on Rising XCKn Edge, Receive on Falling XCKn Edge"]
        FALLING_EDGE: [1, "Transmit on Falling XCKn Edge, Receive on Rising XCKn Edge"]