Skip to content

Commit 353bd31

Browse files
committed
Add Attiny417/817/1617/3217 support
1 parent 6fbb972 commit 353bd31

File tree

14 files changed

+23720
-3
lines changed

14 files changed

+23720
-3
lines changed

Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,11 @@ attiny404 = ["device-selected"]
6767
attiny412 = ["device-selected"]
6868
attiny414 = ["device-selected"]
6969
attiny416 = ["device-selected"]
70+
attiny417 = ["device-selected"]
7071
attiny44a = ["device-selected"]
7172
attiny804 = ["device-selected"]
7273
attiny816 = ["device-selected"]
74+
attiny817 = ["device-selected"]
7375
attiny828 = ["device-selected"]
7476
attiny84 = ["device-selected"]
7577
attiny841 = ["device-selected"]
@@ -80,7 +82,9 @@ attiny88 = ["device-selected"]
8082
attiny1604 = ["device-selected"]
8183
attiny1606 = ["device-selected"]
8284
attiny1614 = ["device-selected"]
85+
attiny1617 = ["device-selected"]
8386
attiny1626 = ["device-selected"]
87+
attiny3217 = ["device-selected"]
8488
avr64du32 = ["device-selected"]
8589
avr64du28 = ["device-selected"]
8690
rt = ["avr-device-macros"]

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ Via the feature you can select which chip you want the register specifications f
3838
| | | | | `attiny1604` |
3939
| | | | | `attiny1606` |
4040
| | | | | `attiny1614` |
41+
| | | | | `attiny1617` |
4142
| | | | | `attiny1626` |
43+
| | | | | `attiny3217` |
4244
| | | | | `attiny2313` |
4345
| | | | | `attiny2313a` |
4446

patch/attiny1617.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
_svd: ../svd/attiny1617.svd
2+
3+
_include:
4+
- common/attiny-xmega/common.yaml
5+
- common/attiny-xmega/1-series.yaml

patch/attiny3217.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
_svd: ../svd/attiny3217.svd
2+
3+
_include:
4+
- common/attiny-xmega/common.yaml
5+
- common/attiny-xmega/1-series.yaml

patch/attiny417.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
_svd: ../svd/attiny417.svd
2+
3+
_include:
4+
- common/attiny-xmega/common.yaml
5+
- common/attiny-xmega/1-series.yaml

patch/attiny817.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
_svd: ../svd/attiny817.svd
2+
3+
_include:
4+
- common/attiny-xmega/common.yaml
5+
- common/attiny-xmega/1-series.yaml
Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
# Nothing needed beyond common config
21
# This is probably good for at least ATtiny212/214/412/414/416, but may not be valid for ATtiny81* and ATtiny161*
32

4-
{}
3+
TCD*:
4+
EVCTRL?:
5+
CFG:
6+
_replace_enum:
7+
NEITHER: [0, "Neither Filter nor Asynchronous Event is enabled"]
8+
FILTERON: [1, "Input Capture Noise Cancellation Filter enabled"]
9+
ASYNCON: [2, "Asynchronous Event output qualification enabled"]

patch/common/attiny-xmega/common.yaml

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,17 @@ PORT[A-Z]:
6262
IN:
6363
name: INPUT
6464

65+
DIR:
66+
"P*":
67+
# Make all Pins use the same enum
68+
_replace_enum:
69+
Input: [0, "Input"]
70+
Output: [1, "Output"]
71+
72+
# make PINxCTRL a rust slice
73+
_array:
74+
"PIN?CTRL": {}
75+
6576
SPI*:
6677
CTRLA:
6778
PRESC:
@@ -74,3 +85,107 @@ SPI*:
7485
[2, "Peripheral clock / 64 if CLK2X == 0 else Peripheral clock / 32"]
7586
CLK_PER_128_64:
7687
[3, "Peripheral clock / 128 if CLK2X == 0 else Peripheral clock / 64"]
88+
89+
DORD:
90+
# Make it an enum
91+
_replace_enum:
92+
MsbFirst: [0, "Most significant byte first"]
93+
LsbFirst: [1, "Least significant byte first"]
94+
95+
"USART*":
96+
STATUS:
97+
_modify:
98+
# The RXSIF bit is actually writable to clear the flag
99+
RXSIF:
100+
access: read-write
101+
# The WFB bit is write-only
102+
WFB:
103+
access: write-only
104+
105+
CPUINT:
106+
CTRLA:
107+
IVSEL:
108+
_replace_enum:
109+
AFTERBOOT: [0, "Interrupt vectors are placed after the BOOT section of the Flash"]
110+
INBOOT: [1, "Interrupt vectors are placed at the start of the BOOT section of the Flash"]
111+
CVT:
112+
_replace_enum:
113+
NORMAL: [0, "Compact Vector Table function is disabled"]
114+
COMPACT: [1, "Compact Vector Table function is enabled"]
115+
LVL0RR:
116+
_replace_enum:
117+
FIXED: [0, "Priority is fixed for priority level 0 interrupt requests: The lowest interrupt vector address has the highest priority."]
118+
ROUNDROBIN: [1, "The round robin priority scheme is enabled for priority level 0 interrupt requests"]
119+
120+
CCL:
121+
_cluster:
122+
"LUT%s":
123+
description: "CCL LUT configuration cluster"
124+
"LUT?CTRLA": {}
125+
"LUT?CTRLB": {}
126+
"LUT?CTRLC": {}
127+
"TRUTH?": {}
128+
129+
# turn all SEQCTRL-registers into slices
130+
_array:
131+
"SEQCTRL?": {}
132+
133+
EVSYS:
134+
# make ASYNCCHx, SYNCCHx, ASYNCUSERx and SYNCUSERx a rust slice
135+
_modify:
136+
"ASYNCUSER*":
137+
description: "Users of asynchronous channels"
138+
"SYNCUSER*":
139+
description: "Users of synchronous channels"
140+
_array:
141+
"ASYNCCH*": {}
142+
"SYNCCH*": {}
143+
"ASYNCUSER*": {}
144+
"SYNCUSER*": {}
145+
146+
TCB*:
147+
_add:
148+
# FIXME: no idea how to add a write constraint with range [0x0, 0xFF] to
149+
# added registers to prevent bits() from being marked as unsafe
150+
CCMPL:
151+
description: Lower Compare or Capture in 8-bit PWM mode
152+
addressOffset: 0x0C
153+
access: read-write
154+
size: 8
155+
CCMPH:
156+
description: Upper Compare or Capture in 8-bit PWM mode
157+
addressOffset: 0x0D
158+
access: read-write
159+
size: 8
160+
161+
CRCSCAN:
162+
CTRLB:
163+
SRC:
164+
_replace_enum:
165+
FLASH: [0, "CRC on entire flash"]
166+
BOOTAPP: [1, "CRC on boot and appl section of flash"]
167+
BOOT: [2, "CRC on boot section of flash"]
168+
MODE:
169+
_replace_enum:
170+
PRIORITY: [0, "Priority to flash"]
171+
172+
NVMCTRL:
173+
CTRLA:
174+
CMD:
175+
_replace_enum:
176+
NONE: [0, "No command"]
177+
WP: [1, "Write page"]
178+
ER: [2, "Erase page"]
179+
ERWP: [3, "Erase and write page"]
180+
PBC: [4, "Page buffer clear"]
181+
CHER: [5, "Chip erase"]
182+
EEER: [6, "EEPROM erase"]
183+
WFU: [7, "Write fuse (PDI only)"]
184+
185+
SLPCTRL:
186+
CTRLA:
187+
SMODE:
188+
_replace_enum:
189+
IDLE: [0, "Idle mode"]
190+
STANDBY: [1, "Standby Mode"]
191+
PDOWN: [2, "Power-down Mode"]

src/devices.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,18 @@ pub mod attiny1626 {
195195
include!(concat!(env!("OUT_DIR"), "/pac/attiny1626.rs"));
196196
}
197197

198+
/// [ATtiny1617](https://www.microchip.com/wwwproducts/en/ATtiny1617)
199+
#[cfg(feature = "attiny1617")]
200+
pub mod attiny1617 {
201+
include!(concat!(env!("OUT_DIR"), "/pac/attiny1617.rs"));
202+
}
203+
204+
/// [ATtiny3217](https://www.microchip.com/wwwproducts/en/ATtiny3217)
205+
#[cfg(feature = "attiny3217")]
206+
pub mod attiny3217 {
207+
include!(concat!(env!("OUT_DIR"), "/pac/attiny3217.rs"));
208+
}
209+
198210
/// [ATtiny202](https://www.microchip.com/wwwproducts/en/ATtiny202)
199211
#[cfg(feature = "attiny202")]
200212
pub mod attiny202 {
@@ -267,6 +279,12 @@ pub mod attiny416 {
267279
include!(concat!(env!("OUT_DIR"), "/pac/attiny416.rs"));
268280
}
269281

282+
/// [ATtiny417](https://www.microchip.com/wwwproducts/en/ATtiny417)
283+
#[cfg(feature = "attiny417")]
284+
pub mod attiny417 {
285+
include!(concat!(env!("OUT_DIR"), "/pac/attiny417.rs"));
286+
}
287+
270288
/// [ATtiny44a](https://www.microchip.com/en-us/product/ATtiny44a)
271289
#[cfg(feature = "attiny44a")]
272290
pub mod attiny44a {
@@ -285,6 +303,12 @@ pub mod attiny816 {
285303
include!(concat!(env!("OUT_DIR"), "/pac/attiny816.rs"));
286304
}
287305

306+
/// [ATtiny817](https://www.microchip.com/wwwproducts/en/ATtiny817)
307+
#[cfg(feature = "attiny817")]
308+
pub mod attiny817 {
309+
include!(concat!(env!("OUT_DIR"), "/pac/attiny817.rs"));
310+
}
311+
288312
/// [ATtiny828](https://www.microchip.com/wwwproducts/en/ATtiny828)
289313
#[cfg(feature = "attiny828")]
290314
pub mod attiny828 {

src/lib.rs

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
//! This crate contains register definitions for
2-
32
#![cfg_attr(feature = "at90usb1286", doc = "**at90usb1286**,")]
43
#![cfg_attr(feature = "atmega1280", doc = "**atmega1280**,")]
54
#![cfg_attr(feature = "atmega1284p", doc = "**atmega1284p**,")]
@@ -31,7 +30,9 @@
3130
#![cfg_attr(feature = "attiny1604", doc = "**attiny1604**,")]
3231
#![cfg_attr(feature = "attiny1606", doc = "**attiny1606**,")]
3332
#![cfg_attr(feature = "attiny1614", doc = "**attiny1614**,")]
33+
#![cfg_attr(feature = "attiny1617", doc = "**attiny1617**,")]
3434
#![cfg_attr(feature = "attiny1626", doc = "**attiny1626**,")]
35+
#![cfg_attr(feature = "attiny3217", doc = "**attiny3217**,")]
3536
#![cfg_attr(feature = "attiny202", doc = "**attiny202**,")]
3637
#![cfg_attr(feature = "attiny204", doc = "**attiny204**,")]
3738
#![cfg_attr(feature = "attiny212", doc = "**attiny212**,")]
@@ -44,9 +45,11 @@
4445
#![cfg_attr(feature = "attiny412", doc = "**attiny412**,")]
4546
#![cfg_attr(feature = "attiny414", doc = "**attiny414**,")]
4647
#![cfg_attr(feature = "attiny416", doc = "**attiny416**,")]
48+
#![cfg_attr(feature = "attiny417", doc = "**attiny417**,")]
4749
#![cfg_attr(feature = "attiny44a", doc = "**attiny44a**,")]
4850
#![cfg_attr(feature = "attiny804", doc = "**attiny804**,")]
4951
#![cfg_attr(feature = "attiny816", doc = "**attiny816**,")]
52+
#![cfg_attr(feature = "attiny817", doc = "**attiny817**,")]
5053
#![cfg_attr(feature = "attiny828", doc = "**attiny828**,")]
5154
#![cfg_attr(feature = "attiny84", doc = "**attiny84**,")]
5255
#![cfg_attr(feature = "attiny841", doc = "**attiny841**,")]
@@ -94,7 +97,9 @@
9497
//! `attiny167`,
9598
//! `attiny1604`,
9699
//! `attiny1614`,
100+
//! `attiny1617`,
97101
//! `attiny1626`,
102+
//! `attiny3217`,
98103
//! `attiny202`,
99104
//! `attiny204`,
100105
//! `attiny212`,
@@ -107,9 +112,11 @@
107112
//! `attiny412`,
108113
//! `attiny414`,
109114
//! `attiny416`,
115+
//! `attiny417`,
110116
//! `attiny44a`,
111117
//! `attiny804`,
112118
//! `attiny816`,
119+
//! `attiny817`,
113120
//! `attiny828`,
114121
//! `attiny84`,
115122
//! `attiny841`,
@@ -273,7 +280,9 @@ compile_error!(
273280
* attiny1604
274281
* attiny1606
275282
* attiny1614
283+
* attiny1617
276284
* attiny1626
285+
* attiny3217
277286
* attiny202
278287
* attiny204
279288
* attiny212
@@ -286,9 +295,11 @@ compile_error!(
286295
* attiny412
287296
* attiny414
288297
* attiny416
298+
* attiny417
289299
* attiny44a
290300
* attiny804
291301
* attiny816
302+
* attiny817
292303
* attiny828
293304
* attiny84
294305
* attiny841
@@ -366,8 +377,12 @@ pub use crate::devices::attiny1604;
366377
pub use crate::devices::attiny1606;
367378
#[cfg(feature = "attiny1614")]
368379
pub use crate::devices::attiny1614;
380+
#[cfg(feature = "attiny1617")]
381+
pub use crate::devices::attiny1617;
369382
#[cfg(feature = "attiny1626")]
370383
pub use crate::devices::attiny1626;
384+
#[cfg(feature = "attiny3217")]
385+
pub use crate::devices::attiny3217;
371386
#[cfg(feature = "attiny167")]
372387
pub use crate::devices::attiny167;
373388
#[cfg(feature = "attiny202")]
@@ -394,12 +409,16 @@ pub use crate::devices::attiny412;
394409
pub use crate::devices::attiny414;
395410
#[cfg(feature = "attiny416")]
396411
pub use crate::devices::attiny416;
412+
#[cfg(feature = "attiny417")]
413+
pub use crate::devices::attiny417;
397414
#[cfg(feature = "attiny44a")]
398415
pub use crate::devices::attiny44a;
399416
#[cfg(feature = "attiny804")]
400417
pub use crate::devices::attiny804;
401418
#[cfg(feature = "attiny816")]
402419
pub use crate::devices::attiny816;
420+
#[cfg(feature = "attiny817")]
421+
pub use crate::devices::attiny817;
403422
#[cfg(feature = "attiny828")]
404423
pub use crate::devices::attiny828;
405424
#[cfg(feature = "attiny84")]

0 commit comments

Comments
 (0)