Skip to content

Commit 5d2d1b6

Browse files
authored
Merge branch 'main' into attiny_x17
2 parents e99434a + 232e1cf commit 5d2d1b6

File tree

16 files changed

+4713
-17
lines changed

16 files changed

+4713
-17
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3030
- Better register definitions for peripherals of the ATmega128RFA1 ([#173]).
3131

3232
### Added
33+
- Support for `AT90CAN128`, `AT90CAN64`, and `AT90CAN32` ([#206]).
3334
- Support for `ATtiny204`, `ATtiny804`, and `ATtiny1604` ([#182]).
3435
- Support for `ATtiny1606` ([#183]).
3536
- Support for `ATtiny1626` ([#185]). The `VPORTA.DIR` register is currently
@@ -45,6 +46,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
4546
[#185]: https://github.com/Rahix/avr-device/pull/185
4647
[#189]: https://github.com/Rahix/avr-device/pull/189
4748
[#195]: https://github.com/Rahix/avr-device/pull/195
49+
[#206]: https://github.com/Rahix/avr-device/pull/206
4850

4951

5052
## [0.7.0] - 2025-01-05

Cargo.toml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ features = ["docsrs"]
2727

2828
[features]
2929
device-selected = []
30+
at90can128 = ["device-selected"]
31+
at90can64 = ["device-selected"]
32+
at90can32 = ["device-selected"]
3033
at90usb1286 = ["device-selected"]
3134
atmega1280 = ["device-selected"]
3235
atmega1284p = ["device-selected"]
@@ -100,22 +103,22 @@ docsrs = ["rt", "ufmt", "atmega328p", "atmega32u4", "atmega2560", "attiny85", "a
100103

101104
[dependencies]
102105
bare-metal = "1.0.0"
103-
vcell = "0.1.2"
106+
vcell = "0.1.3"
104107
cfg-if = "1.0.0"
105108
ufmt = { version = "0.2.0", optional = true }
106-
critical-section = { version = "1.1.1", optional = true }
109+
critical-section = { version = "1.2.0", optional = true }
107110

108111
[dependencies.avr-device-macros]
109112
path = "macros/"
110113
version = "=0.7.0"
111114
optional = true
112115

113116
[build-dependencies]
114-
svd2rust = "=0.36.1"
115-
svdtools = "=0.4.6"
117+
svd2rust = { version = "=0.36.1", default-features = false }
118+
svdtools = { version = "=0.5.0", default-features = false }
116119
atdf2svd = { version = "=0.5.1", default-features = false }
117120
prettyplease = "=0.2.32"
118-
svd-rs = "=0.14.12"
119-
yaml-rust2 = "=0.10.1"
121+
svd-rs = { version = "=0.14.12", default-features = false }
122+
yaml-rust2 = { version = "=0.10.2", default-features = false }
120123
syn = { version = "=2.0.101", default-features = false, features = ["full", "parsing"] }
121124
anyhow = "1.0"

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ Via the feature you can select which chip you want the register specifications f
1515
| ATmega | ATmega USB | ATmega 0,1 Series | AT90 | ATtiny |
1616
| :-------------: | :----------: | :---------------: | :-----------: | :-----------: |
1717
| `atmega8` | `atmega8u2` | `atmega3208` | `at90usb1286` | `attiny13a` |
18-
| `atmega48p` | `atmega16u2` | `atmega3209` | | `attiny167` |
19-
| `atmega64` | `atmega32u2` | `atmega4808` | | `attiny202` |
20-
| `atmega644` | `atmega32u4` | `atmega4809` | | `attiny204` |
18+
| `atmega48p` | `atmega16u2` | `atmega3209` | `at90can128` | `attiny167` |
19+
| `atmega64` | `atmega32u2` | `atmega4808` | `at90can64` | `attiny202` |
20+
| `atmega644` | `atmega32u4` | `atmega4809` | `at90can32` | `attiny204` |
2121
| `atmega88p` | `avr64du32` | | | `attiny212` |
2222
| `atmega16` | `avr64du28` | | | `attiny214` |
2323
| `atmega168` | | | | `attiny402` |

build.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ impl InputFinder {
109109
let atdf_file = File::open(&atdf_path)
110110
.map_err(io_error_in_path(&atdf_path))
111111
.context("could not open ATDF file")?;
112-
let atdf = atdf2svd::atdf::parse(atdf_file, &mut HashSet::new())
112+
let atdf = atdf2svd::atdf::parse(atdf_file, &HashSet::new())
113113
.map_err(atdf_error(&atdf_path))?;
114114
let patch_path = patches_dir.join(&mcu_name).with_extension("yaml");
115115
let patch = if patch_path
@@ -222,7 +222,7 @@ impl SvdGenerator {
222222
let svd_path = if let Some(patch) = &inputs.patch {
223223
let mut reader = svdtools::patch::process_reader(
224224
unpatched_reader,
225-
&patch,
225+
patch,
226226
&Default::default(),
227227
&Default::default(),
228228
)
@@ -269,7 +269,7 @@ impl CodeGenerator {
269269
svd2rust_config.ident_formats = IdentFormats::legacy_theme();
270270

271271
let generated_stream =
272-
svd2rust::generate::device::render(&svd, &svd2rust_config, &mut String::new())
272+
svd2rust::generate::device::render(svd, &svd2rust_config, &mut String::new())
273273
.context("failed to generate svd2rust module")?;
274274

275275
let mut syntax_tree: syn::File = syn::parse2(generated_stream)
@@ -293,7 +293,7 @@ impl CodeGenerator {
293293
) -> anyhow::Result<()> {
294294
for item in syntax_tree.items.iter_mut() {
295295
if let syn::Item::Static(statik) = item {
296-
if statik.ident.to_string() == "DEVICE_PERIPHERALS" {
296+
if statik.ident == "DEVICE_PERIPHERALS" {
297297
*item = syn::parse_quote! {use super::DEVICE_PERIPHERALS;};
298298
return Ok(());
299299
}

patch/at90can128.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
_include:
2+
- "common/ac.yaml"
3+
- "common/at90/adc.yaml"
4+
- "common/at90/spi.yaml"
5+
- "common/at90/usart.yaml"

patch/at90can32.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
_include:
2+
- "common/ac.yaml"
3+
- "common/at90/adc.yaml"
4+
- "common/at90/spi.yaml"
5+
- "common/at90/usart.yaml"

patch/at90can64.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
_include:
2+
- "common/ac.yaml"
3+
- "common/at90/adc.yaml"
4+
- "common/at90/spi.yaml"
5+
- "common/at90/usart.yaml"

patch/common/at90/adc.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
2+
_include:
3+
- "../adc.yaml"
4+
5+
ADC:
6+
ADMUX:
7+
MUX:
8+
_replace_enum:
9+
ADC0: [0, "ADC Single Ended Input pin 0"]
10+
ADC1: [1, "ADC Single Ended Input pin 1"]
11+
ADC2: [2, "ADC Single Ended Input pin 2"]
12+
ADC3: [3, "ADC Single Ended Input pin 3"]
13+
ADC4: [4, "ADC Single Ended Input pin 4"]
14+
ADC5: [5, "ADC Single Ended Input pin 5"]
15+
ADC6: [6, "ADC Single Ended Input pin 6"]
16+
ADC7: [7, "ADC Single Ended Input pin 7"]
17+
ADC0_ADC0_10X: [8, "ADC Differential Inputs Positive pin 0 Negative pin 0 10x Gain"]
18+
ADC1_ADC0_10X: [9, "ADC Differential Inputs Positive pin 1 Negative pin 0 10x Gain"]
19+
ADC0_ADC0_200X: [10, "ADC Differential Inputs Positive pin 0 Negative pin 0 200x Gain"]
20+
ADC1_ADC0_200X: [11, "ADC Differential Inputs Positive pin 1 Negative pin 0 200x Gain"]
21+
ADC2_ADC2_10X: [12, "ADC Differential Inputs Positive pin 2 Negative pin 2 10x Gain"]
22+
ADC3_ADC2_10X: [13, "ADC Differential Inputs Positive pin 3 Negative pin 2 10x Gain"]
23+
ADC2_ADC2_200X: [14, "ADC Differential Inputs Positive pin 2 Negative pin 2 200x Gain"]
24+
ADC3_ADC2_200X: [15, "ADC Differential Inputs Positive pin 3 Negative pin 2 200x Gain"]
25+
ADC0_ADC1_1X: [16, "ADC Differential Inputs Positive pin 0 Negative pin 1 1x Gain"]
26+
ADC1_ADC1_1X: [17, "ADC Differential Inputs Positive pin 1 Negative pin 1 1x Gain"]
27+
ADC2_ADC1_1X: [18, "ADC Differential Inputs Positive pin 2 Negative pin 1 1x Gain"]
28+
ADC3_ADC1_1X: [19, "ADC Differential Inputs Positive pin 3 Negative pin 1 1x Gain"]
29+
ADC4_ADC1_1X: [20, "ADC Differential Inputs Positive pin 4 Negative pin 1 1x Gain"]
30+
ADC5_ADC1_1X: [21, "ADC Differential Inputs Positive pin 5 Negative pin 1 1x Gain"]
31+
ADC6_ADC1_1X: [22, "ADC Differential Inputs Positive pin 6 Negative pin 1 1x Gain"]
32+
ADC7_ADC1_1X: [23, "ADC Differential Inputs Positive pin 7 Negative pin 1 1x Gain"]
33+
ADC0_ADC2_1X: [24, "ADC Differential Inputs Positive pin 0 Negative pin 2 1x Gain"]
34+
ADC1_ADC2_1X: [25, "ADC Differential Inputs Positive pin 1 Negative pin 2 1x Gain"]
35+
ADC2_ADC2_1X: [26, "ADC Differential Inputs Positive pin 2 Negative pin 2 1x Gain"]
36+
ADC3_ADC2_1X: [27, "ADC Differential Inputs Positive pin 3 Negative pin 2 1x Gain"]
37+
ADC4_ADC2_1X: [28, "ADC Differential Inputs Positive pin 4 Negative pin 2 1x Gain"]
38+
ADC5_ADC2_1X: [29, "ADC Differential Inputs Positive pin 5 Negative pin 2 1x Gain"]
39+
ADC_VBG: [30, "Internal Reference (VBG)"]
40+
ADC_GND: [31, "0V (GND)"]

patch/common/at90/spi.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Patches for the SPI peripheral
2+
#
3+
# Fix the SP2X status register bit to have write access
4+
SPI*:
5+
SPSR:
6+
_modify:
7+
SPIF:
8+
access: read-only
9+
WCOL:
10+
access: read-only
11+

patch/common/at90/usart.yaml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
USART?:
2+
UCSR?A:
3+
_modify:
4+
UPE?:
5+
access: read-only
6+
DOR?:
7+
access: read-only
8+
FE?:
9+
access: read-only
10+
UDRE?:
11+
access: read-only
12+
TXC?:
13+
description: "USART Transmit Complete"
14+
RXC?:
15+
access: read-only
16+
UCSR?B:
17+
_modify:
18+
RXB8?:
19+
access: read-only
20+
UCSR?C:
21+
UMSEL?:
22+
_replace_enum:
23+
USART_ASYNC: [0, "Asynchronous Operation"]
24+
USART_SYNC: [1, "Synchronous Operation"]
25+
UPM?:
26+
_replace_enum:
27+
DISABLED: [0, "Disabled"]
28+
PARITY_EVEN: [2, "Enabled, Even Parity"]
29+
PARITY_ODD: [3, "Enabled, Odd Parity"]
30+
USBS?:
31+
_replace_enum:
32+
STOP1: [0, "1-bit"]
33+
STOP2: [1, "2-bit"]
34+
UCSZ?:
35+
_replace_enum:
36+
CHR5: [0, "Character Size: 5 bit"]
37+
CHR6: [1, "Character Size: 6 bit"]
38+
CHR7: [2, "Character Size: 7 bit"]
39+
CHR8: [3, "Character Size: 8 bit"]
40+
UCPOL?:
41+
_replace_enum:
42+
RISING_EDGE: [0, "Transmit on Rising XCKn Edge, Receive on Falling XCKn Edge"]
43+
FALLING_EDGE: [1, "Transmit on Falling XCKn Edge, Receive on Rising XCKn Edge"]

0 commit comments

Comments
 (0)