summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBluebie <a@creativepony.com>2013-02-08 12:05:50 +1100
committerBluebie <a@creativepony.com>2013-02-08 12:05:50 +1100
commit58deb57f21507d0223720cf39d1734ac01fce380 (patch)
tree185c60a86c6fa5ad85883ba75bbc81f98f302c82
parentb41d8d8708025a88e3d3372b960e9fc8bc29cace (diff)
downloadmicronucleus-58deb57f21507d0223720cf39d1734ac01fce380.tar.gz
micronucleus-58deb57f21507d0223720cf39d1734ac01fce380.tar.bz2
micronucleus-58deb57f21507d0223720cf39d1734ac01fce380.zip
upgrade: now automatically reboots in to new bootloader when it's done doing the upgrade and has beeped.
-rw-r--r--upgrade/upgrade.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/upgrade/upgrade.c b/upgrade/upgrade.c
index dc5d449..2541f09 100644
--- a/upgrade/upgrade.c
+++ b/upgrade/upgrade.c
@@ -50,6 +50,8 @@ int main(void) {
beep();
+ reboot();
+
return 0;
}
@@ -156,6 +158,12 @@ void beep(void) {
}
}
+void reboot(void) {
+ void (*ptrToFunction)(); // pointer to a function
+ ptrToFunction = 0x0000;
+ (*ptrToFunction)(); // reset!
+}
+
////////////// Add padding to start of program so no program code could reasonably be erased while program is running
// this never needs to be called - avr-gcc stuff happening: http://www.nongnu.org/avr-libc/user-manual/mem_sections.html