Skip to content

Commit de28e6a

Browse files
committed
Add Attiny417/817/1617/3217 support
1 parent 36b05c7 commit de28e6a

File tree

14 files changed

+23730
-3
lines changed

14 files changed

+23730
-3
lines changed

Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,12 @@ attiny404 = ["device-selected"]
7171
attiny412 = ["device-selected"]
7272
attiny414 = ["device-selected"]
7373
attiny416 = ["device-selected"]
74+
attiny417 = ["device-selected"]
7475
attiny44a = ["device-selected"]
7576
attiny461a = ["device-selected"]
7677
attiny804 = ["device-selected"]
7778
attiny816 = ["device-selected"]
79+
attiny817 = ["device-selected"]
7880
attiny828 = ["device-selected"]
7981
attiny84 = ["device-selected"]
8082
attiny841 = ["device-selected"]
@@ -86,7 +88,9 @@ attiny88 = ["device-selected"]
8688
attiny1604 = ["device-selected"]
8789
attiny1606 = ["device-selected"]
8890
attiny1614 = ["device-selected"]
91+
attiny1617 = ["device-selected"]
8992
attiny1626 = ["device-selected"]
93+
attiny3217 = ["device-selected"]
9094
avr64du32 = ["device-selected"]
9195
avr64du28 = ["device-selected"]
9296
avr128db28 = ["device-selected"]

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: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,15 @@
11
# Nothing needed beyond common config
22
# This is probably good for at least ATtiny202/204/402/404/406, but may not be valid for ATtiny80* and ATtiny160*
33

4-
{}
4+
EVSYS:
5+
# make ASYNCCHx, SYNCCHx, ASYNCUSERx and SYNCUSERx a rust slice
6+
_modify:
7+
"ASYNCUSER*":
8+
description: "Users of asynchronous channels"
9+
"SYNCUSER*":
10+
description: "Users of synchronous channels"
11+
_array:
12+
"ASYNCCH*": {}
13+
"SYNCCH*": {}
14+
"ASYNCUSER*": {}
15+
"SYNCUSER*": {}
Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,22 @@
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"]
10+
11+
EVSYS:
12+
# make ASYNCCHx, SYNCCHx, ASYNCUSERx and SYNCUSERx a rust slice
13+
_modify:
14+
"ASYNCUSER*":
15+
description: "Users of asynchronous channels"
16+
"SYNCUSER*":
17+
description: "Users of synchronous channels"
18+
_array:
19+
"ASYNCCH*": {}
20+
"SYNCCH*": {}
21+
"ASYNCUSER*": {}
22+
"SYNCUSER*": {}

patch/common/attiny-xmega/common.yaml

Lines changed: 102 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,94 @@ 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+
TCB*:
134+
_add:
135+
# FIXME: no idea how to add a write constraint with range [0x0, 0xFF] to
136+
# added registers to prevent bits() from being marked as unsafe
137+
CCMPL:
138+
description: Lower Compare or Capture in 8-bit PWM mode
139+
addressOffset: 0x0C
140+
access: read-write
141+
size: 8
142+
CCMPH:
143+
description: Upper Compare or Capture in 8-bit PWM mode
144+
addressOffset: 0x0D
145+
access: read-write
146+
size: 8
147+
148+
CRCSCAN:
149+
CTRLB:
150+
SRC:
151+
_replace_enum:
152+
FLASH: [0, "CRC on entire flash"]
153+
BOOTAPP: [1, "CRC on boot and appl section of flash"]
154+
BOOT: [2, "CRC on boot section of flash"]
155+
MODE:
156+
_replace_enum:
157+
PRIORITY: [0, "Priority to flash"]
158+
159+
NVMCTRL:
160+
CTRLA:
161+
CMD:
162+
_replace_enum:
163+
NONE: [0, "No command"]
164+
WP: [1, "Write page"]
165+
ER: [2, "Erase page"]
166+
ERWP: [3, "Erase and write page"]
167+
PBC: [4, "Page buffer clear"]
168+
CHER: [5, "Chip erase"]
169+
EEER: [6, "EEPROM erase"]
170+
WFU: [7, "Write fuse (PDI only)"]
171+
172+
SLPCTRL:
173+
CTRLA:
174+
SMODE:
175+
_replace_enum:
176+
IDLE: [0, "Idle mode"]
177+
STANDBY: [1, "Standby Mode"]
178+
PDOWN: [2, "Power-down Mode"]

src/devices.rs

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

216+
/// [ATtiny1617](https://www.microchip.com/wwwproducts/en/ATtiny1617)
217+
#[cfg(feature = "attiny1617")]
218+
pub mod attiny1617 {
219+
include!(concat!(env!("OUT_DIR"), "/pac/attiny1617.rs"));
220+
}
221+
222+
/// [ATtiny3217](https://www.microchip.com/wwwproducts/en/ATtiny3217)
223+
#[cfg(feature = "attiny3217")]
224+
pub mod attiny3217 {
225+
include!(concat!(env!("OUT_DIR"), "/pac/attiny3217.rs"));
226+
}
227+
216228
/// [ATtiny202](https://www.microchip.com/wwwproducts/en/ATtiny202)
217229
#[cfg(feature = "attiny202")]
218230
pub mod attiny202 {
@@ -291,6 +303,12 @@ pub mod attiny416 {
291303
include!(concat!(env!("OUT_DIR"), "/pac/attiny416.rs"));
292304
}
293305

306+
/// [ATtiny417](https://www.microchip.com/wwwproducts/en/ATtiny417)
307+
#[cfg(feature = "attiny417")]
308+
pub mod attiny417 {
309+
include!(concat!(env!("OUT_DIR"), "/pac/attiny417.rs"));
310+
}
311+
294312
/// [ATtiny44a](https://www.microchip.com/en-us/product/ATtiny44a)
295313
#[cfg(feature = "attiny44a")]
296314
pub mod attiny44a {
@@ -315,6 +333,12 @@ pub mod attiny816 {
315333
include!(concat!(env!("OUT_DIR"), "/pac/attiny816.rs"));
316334
}
317335

336+
/// [ATtiny817](https://www.microchip.com/wwwproducts/en/ATtiny817)
337+
#[cfg(feature = "attiny817")]
338+
pub mod attiny817 {
339+
include!(concat!(env!("OUT_DIR"), "/pac/attiny817.rs"));
340+
}
341+
318342
/// [ATtiny828](https://www.microchip.com/wwwproducts/en/ATtiny828)
319343
#[cfg(feature = "attiny828")]
320344
pub mod attiny828 {

src/lib.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@
3333
#![cfg_attr(feature = "attiny1604", doc = "**attiny1604**,")]
3434
#![cfg_attr(feature = "attiny1606", doc = "**attiny1606**,")]
3535
#![cfg_attr(feature = "attiny1614", doc = "**attiny1614**,")]
36+
#![cfg_attr(feature = "attiny1617", doc = "**attiny1617**,")]
3637
#![cfg_attr(feature = "attiny1626", doc = "**attiny1626**,")]
38+
#![cfg_attr(feature = "attiny3217", doc = "**attiny3217**,")]
3739
#![cfg_attr(feature = "attiny202", doc = "**attiny202**,")]
3840
#![cfg_attr(feature = "attiny204", doc = "**attiny204**,")]
3941
#![cfg_attr(feature = "attiny212", doc = "**attiny212**,")]
@@ -47,10 +49,12 @@
4749
#![cfg_attr(feature = "attiny412", doc = "**attiny412**,")]
4850
#![cfg_attr(feature = "attiny414", doc = "**attiny414**,")]
4951
#![cfg_attr(feature = "attiny416", doc = "**attiny416**,")]
52+
#![cfg_attr(feature = "attiny417", doc = "**attiny417**,")]
5053
#![cfg_attr(feature = "attiny44a", doc = "**attiny44a**,")]
5154
#![cfg_attr(feature = "attiny461a", doc = "**attiny461a**,")]
5255
#![cfg_attr(feature = "attiny804", doc = "**attiny804**,")]
5356
#![cfg_attr(feature = "attiny816", doc = "**attiny816**,")]
57+
#![cfg_attr(feature = "attiny817", doc = "**attiny817**,")]
5458
#![cfg_attr(feature = "attiny828", doc = "**attiny828**,")]
5559
#![cfg_attr(feature = "attiny84", doc = "**attiny84**,")]
5660
#![cfg_attr(feature = "attiny841", doc = "**attiny841**,")]
@@ -103,7 +107,9 @@
103107
//! `attiny167`,
104108
//! `attiny1604`,
105109
//! `attiny1614`,
110+
//! `attiny1617`,
106111
//! `attiny1626`,
112+
//! `attiny3217`,
107113
//! `attiny202`,
108114
//! `attiny204`,
109115
//! `attiny212`,
@@ -117,10 +123,12 @@
117123
//! `attiny412`,
118124
//! `attiny414`,
119125
//! `attiny416`,
126+
//! `attiny417`,
120127
//! `attiny44a`,
121128
//! `attiny461a`,
122129
//! `attiny804`,
123130
//! `attiny816`,
131+
//! `attiny817`,
124132
//! `attiny828`,
125133
//! `attiny84`,
126134
//! `attiny841`,
@@ -286,7 +294,9 @@ compile_error!(
286294
* attiny1604
287295
* attiny1606
288296
* attiny1614
297+
* attiny1617
289298
* attiny1626
299+
* attiny3217
290300
* attiny202
291301
* attiny204
292302
* attiny212
@@ -300,10 +310,12 @@ compile_error!(
300310
* attiny412
301311
* attiny414
302312
* attiny416
313+
* attiny417
303314
* attiny44a
304315
* attiny461a
305316
* attiny804
306317
* attiny816
318+
* attiny817
307319
* attiny828
308320
* attiny84
309321
* attiny841
@@ -389,8 +401,12 @@ pub use crate::devices::attiny1604;
389401
pub use crate::devices::attiny1606;
390402
#[cfg(feature = "attiny1614")]
391403
pub use crate::devices::attiny1614;
404+
#[cfg(feature = "attiny1617")]
405+
pub use crate::devices::attiny1617;
392406
#[cfg(feature = "attiny1626")]
393407
pub use crate::devices::attiny1626;
408+
#[cfg(feature = "attiny3217")]
409+
pub use crate::devices::attiny3217;
394410
#[cfg(feature = "attiny167")]
395411
pub use crate::devices::attiny167;
396412
#[cfg(feature = "attiny202")]
@@ -419,6 +435,8 @@ pub use crate::devices::attiny412;
419435
pub use crate::devices::attiny414;
420436
#[cfg(feature = "attiny416")]
421437
pub use crate::devices::attiny416;
438+
#[cfg(feature = "attiny417")]
439+
pub use crate::devices::attiny417;
422440
#[cfg(feature = "attiny44a")]
423441
pub use crate::devices::attiny44a;
424442
#[cfg(feature = "attiny461a")]
@@ -427,6 +445,8 @@ pub use crate::devices::attiny461a;
427445
pub use crate::devices::attiny804;
428446
#[cfg(feature = "attiny816")]
429447
pub use crate::devices::attiny816;
448+
#[cfg(feature = "attiny817")]
449+
pub use crate::devices::attiny817;
430450
#[cfg(feature = "attiny828")]
431451
pub use crate::devices::attiny828;
432452
#[cfg(feature = "attiny84")]

0 commit comments

Comments
 (0)