aboutsummaryrefslogtreecommitdiff
path: root/src/modules/px4iofirmware/px4io.c
diff options
context:
space:
mode:
authorLorenz Meier <lm@inf.ethz.ch>2014-01-15 07:43:17 +0100
committerLorenz Meier <lm@inf.ethz.ch>2014-01-15 07:43:17 +0100
commitf3cd83e804e8fffc5e71e4d6443729184b3e7909 (patch)
tree13ac8af24705fe5f8107f3f46fd989e49fdd00d4 /src/modules/px4iofirmware/px4io.c
parent9612514a3f59cfedbd7b29c9e4f30c1edf1c7345 (diff)
parentcd72f564eff13d831d6773e85818b65f708d3323 (diff)
downloadpx4-firmware-f3cd83e804e8fffc5e71e4d6443729184b3e7909.tar.gz
px4-firmware-f3cd83e804e8fffc5e71e4d6443729184b3e7909.tar.bz2
px4-firmware-f3cd83e804e8fffc5e71e4d6443729184b3e7909.zip
Merged master into mixer unit tests branch
Diffstat (limited to 'src/modules/px4iofirmware/px4io.c')
-rw-r--r--src/modules/px4iofirmware/px4io.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/modules/px4iofirmware/px4io.c b/src/modules/px4iofirmware/px4io.c
index 745bd5705..0b8c4a6a8 100644
--- a/src/modules/px4iofirmware/px4io.c
+++ b/src/modules/px4iofirmware/px4io.c
@@ -125,6 +125,25 @@ heartbeat_blink(void)
LED_BLUE(heartbeat = !heartbeat);
}
+static uint64_t reboot_time;
+
+/**
+ schedule a reboot in time_delta_usec microseconds
+ */
+void schedule_reboot(uint32_t time_delta_usec)
+{
+ reboot_time = hrt_absolute_time() + time_delta_usec;
+}
+
+/**
+ check for a scheduled reboot
+ */
+static void check_reboot(void)
+{
+ if (reboot_time != 0 && hrt_absolute_time() > reboot_time) {
+ up_systemreset();
+ }
+}
static void
calculate_fw_crc(void)
@@ -249,6 +268,8 @@ user_start(int argc, char *argv[])
heartbeat_blink();
}
+ check_reboot();
+
#if 0
/* check for debug activity */
show_debug_messages();