projects
/
gps-watch.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
8483f69
)
bootloader: Only begin serial communication if PTE24 is held down.
author
Tilman Sauerbeck
<tilman@code-monkey.de>
Sun, 7 Jul 2019 18:29:48 +0000
(20:29 +0200)
committer
Tilman Sauerbeck
<tilman@code-monkey.de>
Sun, 5 Jan 2020 19:38:11 +0000
(20:38 +0100)
src/bootloader/main.rs
patch
|
blob
|
history
diff --git
a/src/bootloader/main.rs
b/src/bootloader/main.rs
index 2e43b67eb9dc3762f3301d39d07ecdc79090fe45..d81da1532baa5b0b41f3a05f5f1adc7e1cf3d084 100644
(file)
--- a/
src/bootloader/main.rs
+++ b/
src/bootloader/main.rs
@@
-42,6
+42,18
@@
extern {
const APPLICATION_ADDR: u32 = 0x0;
const APPLICATION_ADDR: u32 = 0x0;
+fn bootloader_requested() -> bool {
+ let start_ticks = systick::now();
+
+ while !systick::has_timeout_ms(start_ticks, 3000) {
+ if (gpio::get(gpio::GPIOE) & (1 << 24)) == 0 {
+ return true;
+ }
+ }
+
+ false
+}
+
#[no_mangle]
pub unsafe extern fn main() {
clock::configure();
#[no_mangle]
pub unsafe extern fn main() {
clock::configure();
@@
-52,7
+64,7
@@
pub unsafe extern fn main() {
port::set_af(port::PORTE, 24, 1);
port::set_pull(port::PORTE, 24, port::Pull::Up);
port::set_af(port::PORTE, 24, 1);
port::set_pull(port::PORTE, 24, port::Pull::Up);
- if
true
{
+ if
bootloader_requested()
{
usb_serial::init(0xf055, 0x635c);
let mut b = bootloader::Bootloader::new();
usb_serial::init(0xf055, 0x635c);
let mut b = bootloader::Bootloader::new();
@@
-61,5
+73,5
@@
pub unsafe extern fn main() {
}
}
}
}
- jump_to_application(
__application_addr
);
+ jump_to_application(
APPLICATION_ADDR
);
}
}