stm32-rs / stm32l4xx-hal

A Hardware abstraction layer for the stm32l432xx series chips written in rust.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Flash module is preset for 1MB

David-OConnor opened this issue · comments

flash.rs is hardcoded for 1MB flash.
Eg:

            0..=255 => {
                self.cr.cr().modify(|_, w| unsafe {
                    w.bker()
                        .clear_bit()
                        .pnb()
                        .bits(page.0 as u8)
                        .per()
                        .set_bit()
                });
            }
            256..=511 => {
                self.cr.cr().modify(|_, w| unsafe {
                    w.bker()
                        .set_bit()
                        .pnb()
                        .bits((page.0 - 256) as u8)
                        .per()
                        .set_bit()
                });
            }

See Reference manual, Tables 8, 9, 10. The above code is hardcoded for Table 8. Can fix with an enum to select.

Nvm; works fine as-is.