summaryrefslogtreecommitdiff
path: root/arm7/source/main.c
blob: 78fd06107691f4b8412b7fa9f3313fe7e8913a6c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#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;
}