fix(reading): change register which from MCU read data (PORTx -> PINx)
This commit is contained in:
parent
28396774cd
commit
03b047f9af
|
@ -32,6 +32,7 @@ pub fn impl_static_pin(pin: TokenStream) -> TokenStream {
|
||||||
let target_field_port =
|
let target_field_port =
|
||||||
proc_macro2::TokenStream::from_str(&port.to_ascii_lowercase()).unwrap();
|
proc_macro2::TokenStream::from_str(&port.to_ascii_lowercase()).unwrap();
|
||||||
|
|
||||||
|
let target_pin = format_ident!("pin{}", port_register_name.to_ascii_lowercase());
|
||||||
let target_data_direction = format_ident!("ddr{}", port_register_name.to_ascii_lowercase());
|
let target_data_direction = format_ident!("ddr{}", port_register_name.to_ascii_lowercase());
|
||||||
|
|
||||||
let trait_name = proc_macro2::TokenStream::from_str("StaticPin").unwrap();
|
let trait_name = proc_macro2::TokenStream::from_str("StaticPin").unwrap();
|
||||||
|
@ -54,7 +55,7 @@ pub fn impl_static_pin(pin: TokenStream) -> TokenStream {
|
||||||
fn read() -> u8 {
|
fn read() -> u8 {
|
||||||
unsafe {
|
unsafe {
|
||||||
(*Self::Port::ptr())
|
(*Self::Port::ptr())
|
||||||
.#target_field_port
|
.#target_pin
|
||||||
.read()
|
.read()
|
||||||
.bits()
|
.bits()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue