summaryrefslogtreecommitdiff
path: root/arm7
diff options
context:
space:
mode:
authorBen Bridle <ben@derelict.engineering>2024-11-18 14:57:19 +1300
committerBen Bridle <ben@derelict.engineering>2024-11-18 14:57:19 +1300
commit722d5509178fa5bdaa488fbbd9196f21377f8775 (patch)
tree112b39cd80cb8e074d9e71d1def4d8de33c9eefa /arm7
downloadbedrock-nds-722d5509178fa5bdaa488fbbd9196f21377f8775.zip
Initial commit
Diffstat (limited to 'arm7')
-rw-r--r--arm7/source/main.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/arm7/source/main.c b/arm7/source/main.c
new file mode 100644
index 0000000..78fd061
--- /dev/null
+++ b/arm7/source/main.c
@@ -0,0 +1,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;
+}