Esempio n. 1
0
void main(void) {
  //Disable WDT
  IEN2&=~IEN2_WDTIE;
  IEN0&=~EA;
  
  xtalClock(); // fastest speed
  setIOPorts();
  configureSPI();
  LCDReset();
  setDisplayStart(0);
  
  //Start the game right-off.
  zombiegotcha();
}
Esempio n. 2
0
int main(void)
{
	int i;
	xtalClock();
	setIOPorts();
	configureSPI();
	LCDReset();

	clear();
	SSN = LOW;
	for (i = 0; i < 8; i++) {
		setCursor(i, i*8);
		printf("KEEP HACKING");
	}
	SSN = HIGH;

	while (1);
}
Esempio n. 3
0
void main(void) {
	u16 i;
    pktbuf = radio_getbuf();
    ch = 0;

reset:
	centerFreq = DEFAULT_FREQ;
	userFreq = centerFreq;
	sleepy = 0;
    packetDone = 0;

	xtalClock();
	setIOPorts();
	configureSPI();
	LCDReset();
	radio_init();
    clear();
    printDebugHeader();
    setFrequency(centerFreq);
    printDebugFrequency(centerFreq, ch);

	while (1) {
		poll_keyboard();
        pollPacket();

        /* Show current RSSI */
        SSN = LOW;
        setCursor(5, 78);
        printf("%3u", (RSSI ^ 0x80));
        SSN = HIGH;

        /* TODO Mod this when more than one channel */
		if (userFreq != centerFreq) {
			centerFreq = setFrequency(userFreq);
            chan_table[ch].ss = 0;
            chan_table[ch].max = 0;
            printDebugFrequency(centerFreq, ch);
        }

		/* Go to sleep (more or less a shutdown) if power button pressed */
		if (sleepy) {
			clear();
			sleepMillis(1000);
			SSN = LOW;
			LCDPowerSave();
			SSN = HIGH;

			while (1) {
				sleep();

				/* Power button depressed long enough to wake? */
				sleepy = 0;
				for (i = 0; i < DEBOUNCE_COUNT; i++) {
					sleepMillis(DEBOUNCE_PERIOD);
					if (keyscan() != KPWR) sleepy = 1;
				}
				if (!sleepy) break;
			}

			/* Reset on wake */
			goto reset;
		}
    }
}