summaryrefslogblamecommitdiff
path: root/arm7/source/main.c
blob: 78fd06107691f4b8412b7fa9f3313fe7e8913a6c (plain) (tree)




























                                                                       
#include <nds.h>
#include <time.h>

// Send ARM7 input information (X, Y, touch, lid) to ARM9 via FIFO.
void vblank_handler(void) {
    inputGetAndSend();
}

int main(void) {
    readUserSettings();   // Read user settings from firmware
    touchInit();          // Calibrate touch input from user settings
    irqInit();            // Initialise ARM7 interrupts
    fifoInit();           // Initialise FIFO system
    installSoundFIFO();   // Install FIFO handler for sound
    installSystemFIFO();  // Install FIFO handler for sleep mode
    initClockIRQTimer(0); // Read RTC then update seconds with timer 0

    // TODO: Consider writing a custom system FIFO handler to deal with
    //       the white screen flash when resuming from sleep.

    // Start sending input data to ARM9 on vblank.
    irqSet(IRQ_VBLANK, vblank_handler);
    irqEnable(IRQ_VBLANK);

    while (1) {
        swiWaitForVBlank();
    }

    return 0;
}