Skip to content

use u8 for field array offset instead of usize #495

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

Closed
wants to merge 1 commit into from
Closed
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

### Changed

- use `u8` for field array offset

- [breaking-change] remove `Variant<U, ENUM_A>`, use `Option<ENUM_A>` instead

- split out register size type (`RawType`) from `ResetValue` trait
Expand Down
6 changes: 3 additions & 3 deletions src/generate/register.rs
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ pub fn fields(
r_impl_items.extend(quote! {
#[doc = #doc]
#inline
pub unsafe fn #name_sc(&self, n: usize) -> #name_pc_r {
pub unsafe fn #name_sc(&self, n: u8) -> #name_pc_r {
#name_pc_r::new ( #value )
}
});
Expand Down Expand Up @@ -675,7 +675,7 @@ pub fn fields(
util::replace_suffix(&f.name, suffixes_str),
description
);
offset_entry = quote! {offset: usize,};
offset_entry = quote! {offset: u8,};
} else {
doc = format!("Field `{}` writer - {}", f.name, description);
offset_entry = quote! {};
Expand All @@ -699,7 +699,7 @@ pub fn fields(
w_impl_items.extend(quote! {
#[doc = #doc]
#inline
pub unsafe fn #name_sc(&mut self, n: usize) -> #name_pc_w {
pub unsafe fn #name_sc(&mut self, n: u8) -> #name_pc_w {
#name_pc_w { w: self, offset: #offset_calc }
}
});
Expand Down