Skip to content

update svd-parser #571

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,15 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]

### Changed

- Use `svd-parser` v0.13.1
- Replace suffix in fields' name before converting to snake case when generating methods #563

### Fixed

- Don't cast if field same type as register
- Fix ValidateLevel usage in lib.rs
- Parenthesizing `#offset_calc` to avoid clippy's warning of operator precedence
- Replace suffix in fields' name before converting to snake case when generating methods #563

## [v0.20.0] - 2021-12-07

Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ thiserror = "1.0"

[dependencies.svd-parser]
features = ["derive-from"]
version = "0.12"
version = "0.13.1"

[dependencies.syn]
version = "1.0"
Expand Down
10 changes: 5 additions & 5 deletions src/generate/register.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ pub fn render(
let mut w_impl_items = TokenStream::new();
let mut methods = vec![];

let can_read = [Access::ReadOnly, Access::ReadWriteOnce, Access::ReadWrite].contains(&access);
let can_write = access != Access::ReadOnly;
let can_read = access.can_read();
let can_write = access.can_write();
let can_reset = properties.reset_value.is_some();

if can_read {
Expand Down Expand Up @@ -297,8 +297,8 @@ pub fn fields(
config: &Config,
) -> Result<()> {
let span = Span::call_site();
let can_read = [Access::ReadOnly, Access::ReadWriteOnce, Access::ReadWrite].contains(&access);
let can_write = access != Access::ReadOnly;
let can_read = access.can_read();
let can_write = access.can_write();

// TODO enumeratedValues
let inline = quote! { #[inline(always)] };
Expand Down Expand Up @@ -1267,7 +1267,7 @@ fn lookup_in_peripherals<'p>(
all_peripherals: &'p [Peripheral],
) -> Result<(&'p EnumeratedValues, Option<Base<'p>>)> {
if let Some(peripheral) = all_peripherals.iter().find(|p| p.name == base_peripheral) {
let all_registers = peripheral.reg_iter().collect::<Vec<_>>();
let all_registers = peripheral.all_registers().collect::<Vec<_>>();
lookup_in_peripheral(
Some(base_peripheral),
base_register,
Expand Down