summaryrefslogtreecommitdiff
path: root/src/system.cc
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2016-01-31 18:55:17 +0100
committerDaniel Friesel <derf@finalrewind.org>2016-01-31 18:55:17 +0100
commite0bc7fae75b59324764abf4680a065caddcc70c2 (patch)
tree15b68e2cf554c59336b5a1c24c4be6d8978f9de4 /src/system.cc
parent49d24d31aebe97a56bb9cb4f1657edbb897ae64b (diff)
add rocket.initialize() function for initial MCU and peripheral setup
Diffstat (limited to 'src/system.cc')
-rw-r--r--src/system.cc19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/system.cc b/src/system.cc
index 15ee0b9..a192b24 100644
--- a/src/system.cc
+++ b/src/system.cc
@@ -6,6 +6,7 @@
#include "display.h"
#include "modem.h"
+#include "storage.h"
#include "system.h"
#define SHUTDOWN_THRESHOLD 2048
@@ -16,6 +17,24 @@ extern animation_t ohai;
uint8_t disp_buf[128];
+void System::initialize()
+{
+ // disable ADC to save power
+ PRR |= _BV(PRADC);
+
+ // dito
+ wdt_disable();
+
+ // Enable pull-ups on PC3 and PC7 (button pins)
+ PORTC |= _BV(PC3) | _BV(PC7);
+
+ display.enable();
+ modem.enable();
+ storage.enable();
+
+ sei();
+}
+
void System::loop()
{
static uint8_t i = 0;