summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--digital/zigbit/bitcloud/makefiles/Makefile_All_ZigBit_Atmega1281_Rf230_8Mhz_Gcc1
-rw-r--r--digital/zigbit/common/reset.c31
-rw-r--r--digital/zigbit/common/reset.h32
3 files changed, 64 insertions, 0 deletions
diff --git a/digital/zigbit/bitcloud/makefiles/Makefile_All_ZigBit_Atmega1281_Rf230_8Mhz_Gcc b/digital/zigbit/bitcloud/makefiles/Makefile_All_ZigBit_Atmega1281_Rf230_8Mhz_Gcc
index 3aae01ef..9877ec9f 100644
--- a/digital/zigbit/bitcloud/makefiles/Makefile_All_ZigBit_Atmega1281_Rf230_8Mhz_Gcc
+++ b/digital/zigbit/bitcloud/makefiles/Makefile_All_ZigBit_Atmega1281_Rf230_8Mhz_Gcc
@@ -72,6 +72,7 @@ SRCS = \
$(BITCLOUD_PATH)/Components/ConfigServer/src/csMem.c \
$(BITCLOUD_PATH)/Components/ConfigServer/src/configServer.c \
$(BITCLOUD_COMMON_SOURCES)/print.c \
+ $(BITCLOUD_COMMON_SOURCES)/reset.c \
$(APB_AVR_PATH)/modules/twi/twi_hard.avr.c \
$(APB_AVR_PATH)/modules/twi/twi.c
diff --git a/digital/zigbit/common/reset.c b/digital/zigbit/common/reset.c
new file mode 100644
index 00000000..fcdce5a3
--- /dev/null
+++ b/digital/zigbit/common/reset.c
@@ -0,0 +1,31 @@
+/* reset.c */
+/* reset related functions. {{{
+ *
+ * Copyright (C) 2012 Florent Duchon
+ *
+ * APBTeam:
+ * Web: http://apbteam.org/
+ * Email: team AT apbteam DOT org
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * }}} */
+
+/* This function resets the avr using the embedded watchdog */
+void reset_avr(void)
+{
+ wdt_enable (WDTO_15MS);
+ while (1);
+}
diff --git a/digital/zigbit/common/reset.h b/digital/zigbit/common/reset.h
new file mode 100644
index 00000000..79a526cc
--- /dev/null
+++ b/digital/zigbit/common/reset.h
@@ -0,0 +1,32 @@
+/* reset.h */
+/* reset related functions. {{{
+ *
+ * Copyright (C) 2012 Florent Duchon
+ *
+ * APBTeam:
+ * Web: http://apbteam.org/
+ * Email: team AT apbteam DOT org
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * }}} */
+
+#ifndef _RESET_H
+#define _RESET_H
+
+/* This function resets the avr using the embedded watchdog */
+void reset_avr(void);
+
+#endif