summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorFlorent Duchon2012-05-03 23:54:14 +0200
committerFlorent Duchon2012-05-04 00:06:29 +0200
commit352d48f377ebfdd17dc57a5b04cec5e71e2a452d (patch)
tree5396698f6f5e273d3799efc7dce58b7f9cd7561a
parent1ead3b0f14353ea5fcb756d4cc99d10d437be08b (diff)
digital/beacon: add avr reset function
-rw-r--r--digital/beacon/src/debug_avr.c4
-rw-r--r--digital/beacon/src/misc.c7
-rw-r--r--digital/beacon/src/misc.h3
3 files changed, 11 insertions, 3 deletions
diff --git a/digital/beacon/src/debug_avr.c b/digital/beacon/src/debug_avr.c
index f324c68a..c862b5c2 100644
--- a/digital/beacon/src/debug_avr.c
+++ b/digital/beacon/src/debug_avr.c
@@ -134,9 +134,7 @@ void usartRXCallback(uint16_t bytesToRead)
// uprintf("TCNT3 = %d\r\n",TCNT3);
TIMSK3 &= ~(1<<OCIE3B);
case 'r':
- led_off(1);
- led_off(2);
- led_off(3);
+ reset_avr();
break;
case 't':
motor_start_stop_control();
diff --git a/digital/beacon/src/misc.c b/digital/beacon/src/misc.c
index 616df71d..04db1de5 100644
--- a/digital/beacon/src/misc.c
+++ b/digital/beacon/src/misc.c
@@ -26,6 +26,13 @@
#include "misc.h"
#include "network.h"
+/* This function resets the avr using the embedded watchdog */
+void reset_avr(void)
+{
+ wdt_enable (WDTO_15MS);
+ while (1);
+}
+
/* This function simulates the jack's state and send it over the air */
void jack_on_off(void)
{
diff --git a/digital/beacon/src/misc.h b/digital/beacon/src/misc.h
index 177fa859..95bba519 100644
--- a/digital/beacon/src/misc.h
+++ b/digital/beacon/src/misc.h
@@ -26,6 +26,9 @@
#ifndef _MISC_H
#define _MISC_H
+/* This function resets the avr using the embedded watchdog */
+void reset_avr(void);
+
/* This function simulates the jack's state and send it over the air */
void jack_on_off(void);