summaryrefslogtreecommitdiffstats
path: root/util.c
diff options
context:
space:
mode:
authorJames McKenzie <git@madingley.org>2014-12-15 12:10:09 +0000
committerJames McKenzie <git@madingley.org>2014-12-15 12:10:09 +0000
commitdcfe43860be2daf118e81a59029a34f018926ae5 (patch)
tree5d662969a51473eaaab6a8994e9f07b868c8ffa6 /util.c
downloadclock-dcfe43860be2daf118e81a59029a34f018926ae5.tar.gz
clock-dcfe43860be2daf118e81a59029a34f018926ae5.tar.bz2
clock-dcfe43860be2daf118e81a59029a34f018926ae5.zip
Diffstat (limited to 'util.c')
-rw-r--r--util.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/util.c b/util.c
new file mode 100644
index 0000000..a23b6f6
--- /dev/null
+++ b/util.c
@@ -0,0 +1,13 @@
+#include "project.h"
+
+void
+setup_clocks (void)
+{
+#ifdef __AVR_ATtiny10__
+ CCP = 0xD8; // configuration change protection, write signature
+ CLKPSR = 0; // set cpu clock prescaler =1 (8Mhz) (attiny 4/5/9/10)
+#else
+ CLKPR = _BV (CLKPCE);
+ CLKPR = 1; // set clock prescaler to 1 (attiny 25/45/85/24/44/84/13/13A)
+#endif
+}