Closed hdhoang closed 6 years ago
This looks about right to me.
Possibly unsafe { scb.aircr.modify(|v| v | (0x05fa << 16) | 0b100) }
has some bits set in v that you might not want, maybe try just unsafe { scb.aircr.modify(|v| (0x05fa << 16) | 0b100) }
?
Register key:
Reads as 0xFA05
On writes, write 0x5FA to VECTKEY, otherwise the write is ignored.```
Thanks for the review. I started out with write(0x05fa_0004)
, then adapted an SO's answer mask-preserving write into the modify
call. Neither had the desired effect.
However there's a difference between overwriting and modifying:
set_theme
call runsI'll try adding some syst.cvr
waiting to see further effect.
Sounds like the overwrite method is working. Not sure what exactly it resets, maybe it just runs user code again?
Maybe put something into main.rs init so you can see? It should now turn on leds on startup.
I would like to initiate reset to DFU without having to flip the keyboard and poke the reset pin. AIUI, booting with the Escape key down enters DFU mode, so I imagined binding a key-combo with Escape to reset the key MCU would do the job.
In https://github.com/hdhoang/anne-key/commit/13c9604c1b0da2c9d9411ea85422d932fed25a6e I have given the SCB to
Keyboard
, then tried to write the reset request when processingAction::Reset
. Though theset_theme(3)
call worked, the keyboard went on working normally instead of resetting.Some paths I would like to explore next:
Nikkelitous also said people normally reset MCU from the host side instead of requesting it to reset itself :)
Please advise me on how to implement this!