Rename generated _REGISTER to register::REGISTER_SPEC
@@ -21,7 +21,7 @@ pub fn render(
let name = util::name_of(register);
let span = Span::call_site();
let name_pc = Ident::new(&name.to_sanitized_upper_case(), span);
- let u_name_pc = Ident::new(&format!("_{}", &name.to_sanitized_upper_case()), span);
+ let name_uc_spec = Ident::new(&format!("{}_SPEC", &name.to_sanitized_upper_case()), span);
let name_sc = Ident::new(&name.to_sanitized_snake_case(), span);
let rsize = register
.size
@@ -57,7 +57,7 @@ pub fn render(
let desc = format!("Reader of register {}", register.name);
mod_items.extend(quote! {
#[doc = #desc]
- pub type R = crate::R<super::#u_name_pc>;
+ pub type R = crate::R<#name_uc_spec>;
});
methods.push("read");
}
@@ -66,7 +66,7 @@ pub fn render(
let desc = format!("Writer for register {}", register.name);
mod_items.extend(quote! {
#[doc = #desc]
- pub type W = crate::W<super::#u_name_pc>;
+ pub type W = crate::W<#name_uc_spec>;
});
methods.push("write_with_zero");
if can_reset {
@@ -138,49 +138,50 @@ pub fn render(
if name_sc != "cfg" {
doc += format!(
- "\n\nFor information about available fields see [{0}]({0}) module",
+ "\n\nFor information about available fields see [{0}](index.html) module",
&name_sc
)
.as_str();
}
out.extend(quote! {
#[doc = #doc]
- pub type #name_pc = crate::Reg<#u_name_pc>;
-
+ pub type #name_pc = crate::Reg<#name_sc::#name_uc_spec>;
+ });
+ mod_items.extend(quote! {
#[allow(missing_docs)]
#[doc(hidden)]
- pub struct #u_name_pc;
+ pub struct #name_uc_spec;
- impl crate::RegisterSpec for #u_name_pc {
+ impl crate::RegisterSpec for #name_uc_spec {
type Ux = #rty;
}
});
if can_read {
let doc = format!(
- "`read()` method returns [{0}::R]({0}::R) reader structure",
+ "`read()` method returns [{0}::R](R) reader structure",
&name_sc
);
- out.extend(quote! {
+ mod_items.extend(quote! {
#[doc = #doc]
- impl crate::Readable for #u_name_pc {}
+ impl crate::Readable for #name_uc_spec {}
});
}
if can_write {
let doc = format!(
- "`write(|w| ..)` method takes [{0}::W]({0}::W) writer structure",
+ "`write(|w| ..)` method takes [{0}::W](W) writer structure",
&name_sc
);
- out.extend(quote! {
+ mod_items.extend(quote! {
#[doc = #doc]
- impl crate::Writable for #u_name_pc {}
+ impl crate::Writable for #name_uc_spec {}
});
}
if let Some(rv) = res_val.map(util::hex) {
let doc = format!("`reset()` method sets {} to value {}", register.name, &rv);
- out.extend(quote! {
+ mod_items.extend(quote! {
#[doc = #doc]
- impl crate::Resettable for #u_name_pc {
+ impl crate::Resettable for #name_uc_spec {
#[inline(always)]
fn reset_value() -> Self::Ux { #rv }
}
