Skip to content

Commit 225f51a

Browse files
wezburrbull
authored andcommitted
add missing doc comments, use usize for the offsets
1 parent c88f7c5 commit 225f51a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/generate/peripheral.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,13 +413,16 @@ fn register_or_cluster_block(
413413
let name = &reg_block_field.field.ident;
414414
let mut_name = Ident::new(format!("{}_mut", name.as_ref().unwrap()));
415415
let ty = &reg_block_field.field.ty;
416-
let offset = reg_block_field.offset;
416+
let offset = reg_block_field.offset as usize;
417417
accessors.append(quote! {
418+
#[doc = #comment]
418419
pub fn #name(&self) -> &#ty {
419420
unsafe {
420421
&*(((self as *const Self) as *const u8).add(#offset) as *const #ty)
421422
}
422423
}
424+
425+
#[doc = #comment]
423426
pub fn #mut_name(&self) -> &mut #ty {
424427
unsafe {
425428
&mut *(((self as *const Self) as *mut u8).add(#offset) as *mut #ty)

0 commit comments

Comments
 (0)