Calculate port number based on address and stride
This allows out of order letter to port mapping
This commit is contained in:
parent
840a83e196
commit
701dd9fa36
1 changed files with 1 additions and 2 deletions
|
@ -415,8 +415,7 @@ pub fn gen(options: Options) {
|
|||
match bi.module.as_str() {
|
||||
"gpio" => {
|
||||
let port_letter = name.chars().skip(4).next().unwrap();
|
||||
let port_num = port_letter as u32 - 'A' as u32;
|
||||
assert_eq!(p.address as u32, gpio_base + gpio_stride * port_num);
|
||||
let port_num = (p.address as u32 - gpio_base) / gpio_stride;
|
||||
|
||||
for pin_num in 0..16 {
|
||||
let pin_name = format!("P{}{}", port_letter, pin_num);
|
||||
|
|
Loading…
Reference in a new issue