void Arduboy::start() { #if F_CPU == 8000000L slowCPU(); #endif SPI.begin(); fastMode(DC, OUTPUT); fastMode(CS, OUTPUT); fastMode(RST, OUTPUT); fastMode(PIN_LEFT_BUTTON, INPUT); fastWrite(PIN_LEFT_BUTTON, HIGH); fastMode(PIN_RIGHT_BUTTON, INPUT); fastWrite(PIN_RIGHT_BUTTON, HIGH); fastMode(PIN_UP_BUTTON, INPUT); fastWrite(PIN_UP_BUTTON, HIGH); fastMode(PIN_DOWN_BUTTON, INPUT); fastWrite(PIN_DOWN_BUTTON, HIGH); fastMode(PIN_A_BUTTON, INPUT); fastWrite(PIN_A_BUTTON, HIGH); fastMode(PIN_B_BUTTON, INPUT); fastWrite(PIN_B_BUTTON, HIGH); /* // TODO: Initialize elsewhere, only if asked for (requires lots of flash) startAudio(); */ //csport = portOutputRegister(digitalPinToPort(CS)); //cspinmask = digitalPinToBitMask(CS); //dcport = portOutputRegister(digitalPinToPort(DC)); //dcpinmask = digitalPinToBitMask(DC); /** * Setup reset pin direction (used by both SPI and I2C) */ // fastWrite(RST, HIGH); // delay(1); // VDD (3.3V) goes high at start, lets just chill for a ms // fastWrite(RST, LOW); // bring reset low delay(10); // wait 10ms fastWrite(RST, HIGH); // bring out of reset bootLCD(); #ifdef SAFE_MODE if(getInput() & (LEFT_BUTTON+UP_BUTTON)) safeMode(); #endif saveMuchPower(); }
void Arduboy::start() { SPI.begin(); pinMode(DC, OUTPUT); pinMode(CS, OUTPUT); pinMode(PIN_LEFT_BUTTON, INPUT_PULLUP); pinMode(PIN_RIGHT_BUTTON, INPUT_PULLUP); pinMode(PIN_UP_BUTTON, INPUT_PULLUP); pinMode(PIN_DOWN_BUTTON, INPUT_PULLUP); pinMode(PIN_A_BUTTON, INPUT_PULLUP); pinMode(PIN_B_BUTTON, INPUT_PULLUP); tunes.initChannel(A2); // Speaker Pin 1 tunes.initChannel(A3); // Speaker Pin 2 csport = portOutputRegister(digitalPinToPort(CS)); cspinmask = digitalPinToBitMask(CS); dcport = portOutputRegister(digitalPinToPort(DC)); dcpinmask = digitalPinToBitMask(DC); /** * Setup reset pin direction (used by both SPI and I2C) */ pinMode(RST, OUTPUT); digitalWrite(RST, HIGH); delay(1); // VDD (3.3V) goes high at start, lets just chill for a ms digitalWrite(RST, LOW); // bring reset low delay(10); // wait 10ms digitalWrite(RST, HIGH); // bring out of reset bootLCD(); #ifdef SAFE_MODE if (pressed(LEFT_BUTTON+UP_BUTTON)) safeMode(); #endif }