From 532c178c0205e6f0b359c4ec368f17482bdd3c92 Mon Sep 17 00:00:00 2001 From: Rodrigo Alfonso Date: Sun, 12 Jan 2025 09:14:09 -0300 Subject: [PATCH] Standarizing usage of libugba interrupt handler instead of tonc in examples and docs --- README.md | 4 ++++ examples/LinkCableMultiboot_demo/src/main.cpp | 5 +++-- examples/LinkCable_basic/src/main.cpp | 9 +++----- examples/LinkCable_full/src/main.cpp | 21 +++++++------------ examples/LinkCable_stress/src/main.cpp | 18 ++++++---------- examples/LinkCube_demo/src/main.cpp | 8 ++----- examples/LinkGPIO_demo/src/main.cpp | 5 +++-- examples/LinkMobile_demo/src/main.cpp | 9 +++----- examples/LinkPS2Keyboard_demo/src/main.cpp | 7 ++----- examples/LinkPS2Mouse_demo/src/main.cpp | 12 +++-------- examples/LinkRawCable_demo/src/main.cpp | 8 ++----- examples/LinkRawWireless_demo/src/main.cpp | 9 +++----- examples/LinkSPI_demo/src/main.cpp | 6 ++---- examples/LinkUART_demo/src/main.cpp | 8 ++----- examples/LinkUniversal_basic/src/main.cpp | 12 ++++------- .../LinkWirelessMultiboot_demo/src/main.cpp | 6 ++---- examples/LinkWireless_demo/src/main.cpp | 9 +++----- examples/_lib/interrupt.cpp | 5 +++++ examples/_lib/interrupt.h | 1 + lib/LinkCable.hpp | 8 +++---- lib/LinkCube.hpp | 4 ++-- lib/LinkMobile.hpp | 8 +++---- lib/LinkPS2Keyboard.hpp | 6 +++--- lib/LinkPS2Mouse.hpp | 4 ++-- lib/LinkRawCable.hpp | 5 +++-- lib/LinkSPI.hpp | 4 ++-- lib/LinkUART.hpp | 4 ++-- lib/LinkUniversal.hpp | 8 +++---- lib/LinkWireless.hpp | 8 +++---- lib/LinkWirelessOpenSDK.hpp | 4 ++-- 30 files changed, 92 insertions(+), 133 deletions(-) diff --git a/README.md b/README.md index d10fcba..2391820 100644 --- a/README.md +++ b/README.md @@ -316,6 +316,8 @@ https://github.com/afska/gba-link-connection/assets/1631752/9a648bff-b14f-4a85-9 - After calling this method, call `getAsyncState()` and `getAsyncCommandResult()`. - Note that until you retrieve the async command result, next command requests will fail! +⚠️ advanced usage only; if you're building a game, use `LinkWireless`! + # 🔧🏛 LinkWirelessOpenSDK [⬆️](#gba-link-connection) All first-party games, including the Multiboot 'bootloader' sent by the adapter, use an official software-level protocol. This class provides methods for creating and reading packets that adhere to this protocol. It's supposed to be used in conjunction with [🔧📻 LinkRawWireless](#-LinkRawWireless). @@ -333,6 +335,8 @@ Additionally, there's a `LinkWirelessOpenSDK::MultiTransfer` class for file tran | `createClientBuffer(fullPayload, fullPayloadSize, sequence, [offset])` | **LinkWirelessOpenSDK::SendBuffer** | Creates a buffer for the client to send a `fullPayload` with a valid header. If `fullPayloadSize` is higher than `14` (the maximum payload size), the buffer will only contain the **first** `14` bytes (unless an `offset` > 0 is used). A `sequence` number must be created by using `LinkWirelessOpenSDK::SequenceNumber::fromPacketId(...)`. | | `createClientACKBuffer(serverHeader)` | **LinkWirelessOpenSDK::SendBuffer** | Creates a buffer for the client to acknowledge a header received from the host. | +⚠️ advanced usage only; you only need this if you want to interact with N software. + # 🌎 LinkUniversal [⬆️](#gba-link-connection) A multiuse library that doesn't care whether you plug a Link Cable or a Wireless Adapter. It continuously switches between both and tries to connect to other peers, supporting the hot swapping of cables and adapters and all the features from [👾 LinkCable](#-LinkCable) and [📻 LinkWireless](#-LinkWireless). diff --git a/examples/LinkCableMultiboot_demo/src/main.cpp b/examples/LinkCableMultiboot_demo/src/main.cpp index e39c41c..6a65833 100644 --- a/examples/LinkCableMultiboot_demo/src/main.cpp +++ b/examples/LinkCableMultiboot_demo/src/main.cpp @@ -3,6 +3,7 @@ #include #include "../../_lib/common.h" +#include "../../_lib/interrupt.h" extern "C" { #include "../../_lib/libgbfs/gbfs.h" @@ -30,8 +31,8 @@ void selectRight() { void init() { Common::initTTE(); - irq_init(NULL); - irq_add(II_VBLANK, NULL); + interrupt_init(); + interrupt_add(INTR_VBLANK, []() {}); } int main() { diff --git a/examples/LinkCable_basic/src/main.cpp b/examples/LinkCable_basic/src/main.cpp index 4f5b465..ae81e0c 100644 --- a/examples/LinkCable_basic/src/main.cpp +++ b/examples/LinkCable_basic/src/main.cpp @@ -15,12 +15,9 @@ void init() { // (2) Add the required interrupt service routines interrupt_init(); - interrupt_set_handler(INTR_VBLANK, LINK_CABLE_ISR_VBLANK); - interrupt_enable(INTR_VBLANK); - interrupt_set_handler(INTR_SERIAL, LINK_CABLE_ISR_SERIAL); - interrupt_enable(INTR_SERIAL); - interrupt_set_handler(INTR_TIMER3, LINK_CABLE_ISR_TIMER); - interrupt_enable(INTR_TIMER3); + interrupt_add(INTR_VBLANK, LINK_CABLE_ISR_VBLANK); + interrupt_add(INTR_SERIAL, LINK_CABLE_ISR_SERIAL); + interrupt_add(INTR_TIMER3, LINK_CABLE_ISR_TIMER); // (3) Initialize the library linkCable->activate(); diff --git a/examples/LinkCable_full/src/main.cpp b/examples/LinkCable_full/src/main.cpp index 7a99549..2db8d55 100644 --- a/examples/LinkCable_full/src/main.cpp +++ b/examples/LinkCable_full/src/main.cpp @@ -66,27 +66,20 @@ inline void setUpInterrupts() { #ifndef USE_LINK_UNIVERSAL // LinkCable - interrupt_set_handler(INTR_VBLANK, LINK_CABLE_ISR_VBLANK); - interrupt_enable(INTR_VBLANK); - interrupt_set_handler(INTR_SERIAL, LINK_CABLE_ISR_SERIAL); - interrupt_enable(INTR_SERIAL); - interrupt_set_handler(INTR_TIMER3, LINK_CABLE_ISR_TIMER); - interrupt_enable(INTR_TIMER3); + interrupt_add(INTR_VBLANK, LINK_CABLE_ISR_VBLANK); + interrupt_add(INTR_SERIAL, LINK_CABLE_ISR_SERIAL); + interrupt_add(INTR_TIMER3, LINK_CABLE_ISR_TIMER); #else // LinkUniversal - interrupt_set_handler(INTR_VBLANK, LINK_UNIVERSAL_ISR_VBLANK); - interrupt_enable(INTR_VBLANK); - interrupt_set_handler(INTR_SERIAL, LINK_UNIVERSAL_ISR_SERIAL); - interrupt_enable(INTR_SERIAL); - interrupt_set_handler(INTR_TIMER3, LINK_UNIVERSAL_ISR_TIMER); - interrupt_enable(INTR_TIMER3); + interrupt_add(INTR_VBLANK, LINK_UNIVERSAL_ISR_VBLANK); + interrupt_add(INTR_SERIAL, LINK_UNIVERSAL_ISR_SERIAL); + interrupt_add(INTR_TIMER3, LINK_UNIVERSAL_ISR_TIMER); #endif // A+B+START+SELECT = SoftReset #if MULTIBOOT_BUILD == 0 REG_KEYCNT = 0b1100000000001111; - interrupt_set_handler(INTR_KEYPAD, Common::ISR_reset); - interrupt_enable(INTR_KEYPAD); + interrupt_add(INTR_KEYPAD, Common::ISR_reset); #endif } diff --git a/examples/LinkCable_stress/src/main.cpp b/examples/LinkCable_stress/src/main.cpp index 8cfa0e4..8ea1471 100644 --- a/examples/LinkCable_stress/src/main.cpp +++ b/examples/LinkCable_stress/src/main.cpp @@ -75,20 +75,14 @@ void init() { #ifndef USE_LINK_UNIVERSAL // LinkCable - interrupt_set_handler(INTR_VBLANK, LINK_CABLE_ISR_VBLANK); - interrupt_enable(INTR_VBLANK); - interrupt_set_handler(INTR_SERIAL, LINK_CABLE_ISR_SERIAL); - interrupt_enable(INTR_SERIAL); - interrupt_set_handler(INTR_TIMER3, LINK_CABLE_ISR_TIMER); - interrupt_enable(INTR_TIMER3); + interrupt_add(INTR_VBLANK, LINK_CABLE_ISR_VBLANK); + interrupt_add(INTR_SERIAL, LINK_CABLE_ISR_SERIAL); + interrupt_add(INTR_TIMER3, LINK_CABLE_ISR_TIMER); #else // LinkUniversal - interrupt_set_handler(INTR_VBLANK, LINK_UNIVERSAL_ISR_VBLANK); - interrupt_enable(INTR_VBLANK); - interrupt_set_handler(INTR_SERIAL, LINK_UNIVERSAL_ISR_SERIAL); - interrupt_enable(INTR_SERIAL); - interrupt_set_handler(INTR_TIMER3, LINK_UNIVERSAL_ISR_TIMER); - interrupt_enable(INTR_TIMER3); + interrupt_add(INTR_VBLANK, LINK_UNIVERSAL_ISR_VBLANK); + interrupt_add(INTR_SERIAL, LINK_UNIVERSAL_ISR_SERIAL); + interrupt_add(INTR_TIMER3, LINK_UNIVERSAL_ISR_TIMER); #endif } diff --git a/examples/LinkCube_demo/src/main.cpp b/examples/LinkCube_demo/src/main.cpp index f1c92c9..8dc02ab 100644 --- a/examples/LinkCube_demo/src/main.cpp +++ b/examples/LinkCube_demo/src/main.cpp @@ -4,8 +4,6 @@ #include "../../_lib/common.h" #include "../../_lib/interrupt.h" -inline void VBLANK() {} - bool a = false, b = false, l = false; // (1) Create a LinkCube instance @@ -16,10 +14,8 @@ void init() { // (2) Add the interrupt service routines interrupt_init(); - interrupt_set_handler(INTR_VBLANK, VBLANK); - interrupt_enable(INTR_VBLANK); - interrupt_set_handler(INTR_SERIAL, LINK_CUBE_ISR_SERIAL); - interrupt_enable(INTR_SERIAL); + interrupt_add(INTR_VBLANK, []() {}); + interrupt_add(INTR_SERIAL, LINK_CUBE_ISR_SERIAL); } int main() { diff --git a/examples/LinkGPIO_demo/src/main.cpp b/examples/LinkGPIO_demo/src/main.cpp index d791978..7a14fc8 100644 --- a/examples/LinkGPIO_demo/src/main.cpp +++ b/examples/LinkGPIO_demo/src/main.cpp @@ -2,6 +2,7 @@ #include "../../../lib/LinkGPIO.hpp" #include "../../_lib/common.h" +#include "../../_lib/interrupt.h" std::string mode(std::string name, LinkGPIO::Pin pin); std::string value(std::string name, LinkGPIO::Pin pin, bool isHigh); @@ -12,8 +13,8 @@ LinkGPIO* linkGPIO = new LinkGPIO(); void init() { Common::initTTE(); - irq_init(NULL); - irq_add(II_VBLANK, NULL); + interrupt_init(); + interrupt_add(INTR_VBLANK, []() {}); // (2) Initialize the library linkGPIO->reset(); diff --git a/examples/LinkMobile_demo/src/main.cpp b/examples/LinkMobile_demo/src/main.cpp index 0e11e45..2ac9ca7 100644 --- a/examples/LinkMobile_demo/src/main.cpp +++ b/examples/LinkMobile_demo/src/main.cpp @@ -49,12 +49,9 @@ start: // (2) Add the required interrupt service routines interrupt_init(); - interrupt_set_handler(INTR_VBLANK, LINK_MOBILE_ISR_VBLANK); - interrupt_enable(INTR_VBLANK); - interrupt_set_handler(INTR_SERIAL, LINK_MOBILE_ISR_SERIAL); - interrupt_enable(INTR_SERIAL); - interrupt_set_handler(INTR_TIMER3, LINK_MOBILE_ISR_TIMER); - interrupt_enable(INTR_TIMER3); + interrupt_add(INTR_VBLANK, LINK_MOBILE_ISR_VBLANK); + interrupt_add(INTR_SERIAL, LINK_MOBILE_ISR_SERIAL); + interrupt_add(INTR_TIMER3, LINK_MOBILE_ISR_TIMER); // (3) Initialize the library linkMobile->activate(); diff --git a/examples/LinkPS2Keyboard_demo/src/main.cpp b/examples/LinkPS2Keyboard_demo/src/main.cpp index 0a0c54c..7402c30 100644 --- a/examples/LinkPS2Keyboard_demo/src/main.cpp +++ b/examples/LinkPS2Keyboard_demo/src/main.cpp @@ -7,7 +7,6 @@ static std::string scanCodes = ""; static std::string output = ""; static u32 irqs = 0; -inline void VBLANK() {} void SERIAL() { LINK_PS2_KEYBOARD_ISR_SERIAL(); irqs++; @@ -24,10 +23,8 @@ void init() { // (2) Add the interrupt service routines interrupt_init(); - interrupt_set_handler(INTR_VBLANK, VBLANK); - interrupt_enable(INTR_VBLANK); - interrupt_set_handler(INTR_SERIAL, SERIAL); - interrupt_enable(INTR_SERIAL); + interrupt_add(INTR_VBLANK, []() {}); + interrupt_add(INTR_SERIAL, SERIAL); } int main() { diff --git a/examples/LinkPS2Mouse_demo/src/main.cpp b/examples/LinkPS2Mouse_demo/src/main.cpp index 1d30998..edcde3b 100644 --- a/examples/LinkPS2Mouse_demo/src/main.cpp +++ b/examples/LinkPS2Mouse_demo/src/main.cpp @@ -4,9 +4,6 @@ #include "../../_lib/common.h" #include "../../_lib/interrupt.h" -inline void VBLANK() {} -inline void TIMER() {} - // (1) Create a LinkPS2Mouse instance LinkPS2Mouse* linkPS2Mouse = new LinkPS2Mouse(2); @@ -15,15 +12,12 @@ void init() { // (2) Add the interrupt service routines interrupt_init(); - interrupt_set_handler(INTR_VBLANK, VBLANK); - interrupt_enable(INTR_VBLANK); - interrupt_set_handler(INTR_TIMER2, TIMER); - interrupt_enable(INTR_TIMER2); + interrupt_add(INTR_VBLANK, []() {}); + interrupt_add(INTR_TIMER2, []() {}); // B = SoftReset REG_KEYCNT = 0b10 | (1 << 14); - interrupt_set_handler(INTR_KEYPAD, Common::ISR_reset); - interrupt_enable(INTR_KEYPAD); + interrupt_add(INTR_KEYPAD, Common::ISR_reset); } int main() { diff --git a/examples/LinkRawCable_demo/src/main.cpp b/examples/LinkRawCable_demo/src/main.cpp index b27cf1f..7a42445 100644 --- a/examples/LinkRawCable_demo/src/main.cpp +++ b/examples/LinkRawCable_demo/src/main.cpp @@ -4,8 +4,6 @@ #include "../../_lib/common.h" #include "../../_lib/interrupt.h" -inline void VBLANK() {} - // (1) Create a LinkRawCable instance LinkRawCable* linkRawCable = new LinkRawCable(); @@ -14,10 +12,8 @@ void init() { // (2) Add the interrupt service routines interrupt_init(); - interrupt_set_handler(INTR_VBLANK, VBLANK); - interrupt_enable(INTR_VBLANK); - interrupt_set_handler(INTR_SERIAL, LINK_RAW_CABLE_ISR_SERIAL); - interrupt_enable(INTR_SERIAL); + interrupt_add(INTR_VBLANK, []() {}); + interrupt_add(INTR_SERIAL, LINK_RAW_CABLE_ISR_SERIAL); } int main() { diff --git a/examples/LinkRawWireless_demo/src/main.cpp b/examples/LinkRawWireless_demo/src/main.cpp index beb48bf..988c53f 100644 --- a/examples/LinkRawWireless_demo/src/main.cpp +++ b/examples/LinkRawWireless_demo/src/main.cpp @@ -31,15 +31,12 @@ int main() { inline void setUpInterrupts() { interrupt_init(); - interrupt_set_handler(INTR_VBLANK, [] {}); - interrupt_enable(INTR_VBLANK); - interrupt_set_handler(INTR_SERIAL, LINK_RAW_WIRELESS_ISR_SERIAL); - interrupt_enable(INTR_SERIAL); + interrupt_add(INTR_VBLANK, [] {}); + interrupt_add(INTR_SERIAL, LINK_RAW_WIRELESS_ISR_SERIAL); // A+B+START+SELECT = SoftReset #if MULTIBOOT_BUILD == 0 REG_KEYCNT = 0b1100000000001111; - interrupt_set_handler(INTR_KEYPAD, Common::ISR_reset); - interrupt_enable(INTR_KEYPAD); + interrupt_add(INTR_KEYPAD, Common::ISR_reset); #endif } diff --git a/examples/LinkSPI_demo/src/main.cpp b/examples/LinkSPI_demo/src/main.cpp index ba3a619..901a790 100644 --- a/examples/LinkSPI_demo/src/main.cpp +++ b/examples/LinkSPI_demo/src/main.cpp @@ -14,10 +14,8 @@ void init() { // (2) Add the interrupt service routines interrupt_init(); - interrupt_set_handler(INTR_VBLANK, VBLANK); - interrupt_enable(INTR_VBLANK); - interrupt_set_handler(INTR_SERIAL, LINK_SPI_ISR_SERIAL); - interrupt_enable(INTR_SERIAL); + interrupt_add(INTR_VBLANK, VBLANK); + interrupt_add(INTR_SERIAL, LINK_SPI_ISR_SERIAL); } int main() { diff --git a/examples/LinkUART_demo/src/main.cpp b/examples/LinkUART_demo/src/main.cpp index 7989527..5637873 100644 --- a/examples/LinkUART_demo/src/main.cpp +++ b/examples/LinkUART_demo/src/main.cpp @@ -4,8 +4,6 @@ #include "../../_lib/common.h" #include "../../_lib/interrupt.h" -inline void VBLANK() {} - std::string received = ""; u32 lines = 0; @@ -17,10 +15,8 @@ void init() { // (2) Add the interrupt service routines interrupt_init(); - interrupt_set_handler(INTR_VBLANK, VBLANK); - interrupt_enable(INTR_VBLANK); - interrupt_set_handler(INTR_SERIAL, LINK_UART_ISR_SERIAL); - interrupt_enable(INTR_SERIAL); + interrupt_add(INTR_VBLANK, []() {}); + interrupt_add(INTR_SERIAL, LINK_UART_ISR_SERIAL); } int main() { diff --git a/examples/LinkUniversal_basic/src/main.cpp b/examples/LinkUniversal_basic/src/main.cpp index d64feae..390386e 100644 --- a/examples/LinkUniversal_basic/src/main.cpp +++ b/examples/LinkUniversal_basic/src/main.cpp @@ -61,17 +61,13 @@ int main() { // (2) Add the required interrupt service routines interrupt_init(); - interrupt_set_handler(INTR_VBLANK, LINK_UNIVERSAL_ISR_VBLANK); - interrupt_enable(INTR_VBLANK); - interrupt_set_handler(INTR_SERIAL, LINK_UNIVERSAL_ISR_SERIAL); - interrupt_enable(INTR_SERIAL); - interrupt_set_handler(INTR_TIMER3, LINK_UNIVERSAL_ISR_TIMER); - interrupt_enable(INTR_TIMER3); + interrupt_add(INTR_VBLANK, LINK_UNIVERSAL_ISR_VBLANK); + interrupt_add(INTR_SERIAL, LINK_UNIVERSAL_ISR_SERIAL); + interrupt_add(INTR_TIMER3, LINK_UNIVERSAL_ISR_TIMER); // B+START+SELECT = SoftReset REG_KEYCNT = 0b1100000000001110; - interrupt_set_handler(INTR_KEYPAD, Common::ISR_reset); - interrupt_enable(INTR_KEYPAD); + interrupt_add(INTR_KEYPAD, Common::ISR_reset); // (3) Initialize the library linkUniversal->activate(); diff --git a/examples/LinkWirelessMultiboot_demo/src/main.cpp b/examples/LinkWirelessMultiboot_demo/src/main.cpp index 854b3cd..4566351 100644 --- a/examples/LinkWirelessMultiboot_demo/src/main.cpp +++ b/examples/LinkWirelessMultiboot_demo/src/main.cpp @@ -31,13 +31,11 @@ int main() { inline void setUpInterrupts() { interrupt_init(); - interrupt_set_handler(INTR_VBLANK, [] {}); - interrupt_enable(INTR_VBLANK); + interrupt_add(INTR_VBLANK, [] {}); // A+B+START+SELECT = SoftReset #if MULTIBOOT_BUILD == 0 REG_KEYCNT = 0b1100000000001111; - interrupt_set_handler(INTR_KEYPAD, Common::ISR_reset); - interrupt_enable(INTR_KEYPAD); + interrupt_add(INTR_KEYPAD, Common::ISR_reset); #endif } diff --git a/examples/LinkWireless_demo/src/main.cpp b/examples/LinkWireless_demo/src/main.cpp index a9f8bb2..08ce544 100644 --- a/examples/LinkWireless_demo/src/main.cpp +++ b/examples/LinkWireless_demo/src/main.cpp @@ -77,12 +77,9 @@ start: // (2) Add the required interrupt service routines interrupt_init(); - interrupt_set_handler(INTR_VBLANK, LINK_WIRELESS_ISR_VBLANK); - interrupt_enable(INTR_VBLANK); - interrupt_set_handler(INTR_SERIAL, LINK_WIRELESS_ISR_SERIAL); - interrupt_enable(INTR_SERIAL); - interrupt_set_handler(INTR_TIMER3, LINK_WIRELESS_ISR_TIMER); - interrupt_enable(INTR_TIMER3); + interrupt_add(INTR_VBLANK, LINK_WIRELESS_ISR_VBLANK); + interrupt_add(INTR_SERIAL, LINK_WIRELESS_ISR_SERIAL); + interrupt_add(INTR_TIMER3, LINK_WIRELESS_ISR_TIMER); // (3) Initialize the library if (isRestoringFromMultiboot) { diff --git a/examples/_lib/interrupt.cpp b/examples/_lib/interrupt.cpp index 57f3797..dfefe30 100644 --- a/examples/_lib/interrupt.cpp +++ b/examples/_lib/interrupt.cpp @@ -5,6 +5,11 @@ void interrupt_init(void) { IRQ_Init(); } +void interrupt_add(interrupt_index index, interrupt_vector function) { + interrupt_set_handler(index, function); + interrupt_enable(index); +} + void interrupt_set_handler(interrupt_index index, interrupt_vector function) { IRQ_SetHandler((irq_index)index, function); } diff --git a/examples/_lib/interrupt.h b/examples/_lib/interrupt.h index 1974864..c768c7a 100644 --- a/examples/_lib/interrupt.h +++ b/examples/_lib/interrupt.h @@ -22,6 +22,7 @@ typedef enum { typedef void (*interrupt_vector)(void); void interrupt_init(void); +void interrupt_add(interrupt_index index, interrupt_vector function); void interrupt_set_handler(interrupt_index index, interrupt_vector function); void interrupt_enable(interrupt_index index); void interrupt_disable(interrupt_index index); diff --git a/lib/LinkCable.hpp b/lib/LinkCable.hpp index d399a07..d182063 100644 --- a/lib/LinkCable.hpp +++ b/lib/LinkCable.hpp @@ -8,10 +8,10 @@ // - 1) Include this header in your main.cpp file and add: // LinkCable* linkCable = new LinkCable(); // - 2) Add the required interrupt service routines: (*) -// irq_init(NULL); -// irq_add(II_VBLANK, LINK_CABLE_ISR_VBLANK); -// irq_add(II_SERIAL, LINK_CABLE_ISR_SERIAL); -// irq_add(II_TIMER3, LINK_CABLE_ISR_TIMER); +// interrupt_init(); +// interrupt_add(INTR_VBLANK, LINK_CABLE_ISR_VBLANK); +// interrupt_add(INTR_SERIAL, LINK_CABLE_ISR_SERIAL); +// interrupt_add(INTR_TIMER3, LINK_CABLE_ISR_TIMER); // - 3) Initialize the library with: // linkCable->activate(); // - 4) Sync: diff --git a/lib/LinkCube.hpp b/lib/LinkCube.hpp index 1d89e82..c5b3ccc 100644 --- a/lib/LinkCube.hpp +++ b/lib/LinkCube.hpp @@ -8,8 +8,8 @@ // - 1) Include this header in your main.cpp file and add: // LinkCube* linkCube = new LinkCube(); // - 2) Add the required interrupt service routines: (*) -// irq_init(NULL); -// irq_add(II_SERIAL, LINK_CUBE_ISR_SERIAL); +// interrupt_init(); +// interrupt_add(INTR_SERIAL, LINK_CUBE_ISR_SERIAL); // - 3) Initialize the library with: // linkCube->activate(); // - 4) Send 32-bit values: diff --git a/lib/LinkMobile.hpp b/lib/LinkMobile.hpp index 981c7d5..bbf43b1 100644 --- a/lib/LinkMobile.hpp +++ b/lib/LinkMobile.hpp @@ -9,10 +9,10 @@ // - 1) Include this header in your main.cpp file and add: // LinkMobile* linkMobile = new LinkMobile(); // - 2) Add the required interrupt service routines: (*) -// irq_init(NULL); -// irq_add(II_VBLANK, LINK_MOBILE_ISR_VBLANK); -// irq_add(II_SERIAL, LINK_MOBILE_ISR_SERIAL); -// irq_add(II_TIMER3, LINK_MOBILE_ISR_TIMER); +// interrupt_init(); +// interrupt_add(INTR_VBLANK, LINK_MOBILE_ISR_VBLANK); +// interrupt_add(INTR_SERIAL, LINK_MOBILE_ISR_SERIAL); +// interrupt_add(INTR_TIMER3, LINK_MOBILE_ISR_TIMER); // - 3) Initialize the library with: // linkMobile->activate(); // // (do something until `linkMobile->isSessionActive()` returns `true`) diff --git a/lib/LinkPS2Keyboard.hpp b/lib/LinkPS2Keyboard.hpp index 595c8bc..17c3bba 100644 --- a/lib/LinkPS2Keyboard.hpp +++ b/lib/LinkPS2Keyboard.hpp @@ -10,9 +10,9 @@ // // handle event (check example scan codes below) // }); // - 2) Add the required interrupt service routines: (*) -// irq_init(NULL); -// irq_add(II_VBLANK, LINK_PS2_KEYBOARD_ISR_VBLANK); -// irq_add(II_SERIAL, LINK_PS2_KEYBOARD_ISR_SERIAL); +// interrupt_init(); +// interrupt_add(INTR_VBLANK, LINK_PS2_KEYBOARD_ISR_VBLANK); +// interrupt_add(INTR_SERIAL, LINK_PS2_KEYBOARD_ISR_SERIAL); // - 3) Initialize the library with: // linkPS2Keyboard->activate(); // - 4) Handle events in the callback sent to LinkPS2Keyboard's constructor! diff --git a/lib/LinkPS2Mouse.hpp b/lib/LinkPS2Mouse.hpp index dd4e100..6f85ae5 100644 --- a/lib/LinkPS2Mouse.hpp +++ b/lib/LinkPS2Mouse.hpp @@ -9,8 +9,8 @@ // - 1) Include this header in your main.cpp file and add: // LinkPS2Mouse* linkPS2Mouse = new LinkPS2Mouse(); // - 2) Add the required interrupt service routines: -// irq_init(NULL); -// irq_add(II_TIMER2, NULL); +// interrupt_init(); +// interrupt_add(INTR_TIMER2, []() {}); // - 3) Initialize the library with: // linkPS2Mouse->activate(); // - 4) Get a report: diff --git a/lib/LinkRawCable.hpp b/lib/LinkRawCable.hpp index f38b9ec..4ef16ba 100644 --- a/lib/LinkRawCable.hpp +++ b/lib/LinkRawCable.hpp @@ -8,8 +8,8 @@ // - 1) Include this header in your main.cpp file and add: // LinkRawCable* linkRawCable = new LinkRawCable(); // - 2) (Optional) Add the interrupt service routines: (*) -// irq_init(NULL); -// irq_add(II_SERIAL, LINK_RAW_CABLE_ISR_SERIAL); +// interrupt_init(); +// interrupt_add(INTR_SERIAL, LINK_RAW_CABLE_ISR_SERIAL); // // (this is only required for `transferAsync`) // - 3) Initialize the library with: // linkRawCable->activate(); @@ -52,6 +52,7 @@ static volatile char LINK_RAW_CABLE_VERSION[] = "LinkRawCable/v7.1.0"; /** * @brief A low level handler for the Link Port (Multi-Play Mode). + * \warning Advanced usage only! * \warning If you're building a game, use `LinkCable`. */ class LinkRawCable { diff --git a/lib/LinkSPI.hpp b/lib/LinkSPI.hpp index 52d4273..c82e67a 100644 --- a/lib/LinkSPI.hpp +++ b/lib/LinkSPI.hpp @@ -8,8 +8,8 @@ // - 1) Include this header in your main.cpp file and add: // LinkSPI* linkSPI = new LinkSPI(); // - 2) (Optional) Add the interrupt service routines: (*) -// irq_init(NULL); -// irq_add(II_SERIAL, LINK_SPI_ISR_SERIAL); +// interrupt_init(); +// interrupt_add(INTR_SERIAL, LINK_SPI_ISR_SERIAL); // // (this is only required for `transferAsync`) // - 3) Initialize the library with: // linkSPI->activate(LinkSPI::Mode::MASTER_256KBPS); diff --git a/lib/LinkUART.hpp b/lib/LinkUART.hpp index cf225f0..551e620 100644 --- a/lib/LinkUART.hpp +++ b/lib/LinkUART.hpp @@ -8,8 +8,8 @@ // - 1) Include this header in your main.cpp file and add: // LinkUART* linkUART = new LinkUART(); // - 2) Add the required interrupt service routines: (*) -// irq_init(NULL); -// irq_add(II_SERIAL, LINK_UART_ISR_SERIAL); +// interrupt_init(); +// interrupt_add(INTR_SERIAL, LINK_UART_ISR_SERIAL); // - 3) Initialize the library with: // linkUART->activate(); // - 4) Send/read data by using: diff --git a/lib/LinkUniversal.hpp b/lib/LinkUniversal.hpp index 930c18d..082498a 100644 --- a/lib/LinkUniversal.hpp +++ b/lib/LinkUniversal.hpp @@ -8,10 +8,10 @@ // - 1) Include this header in your main.cpp file and add: // LinkUniversal* linkUniversal = new LinkUniversal(); // - 2) Add the required interrupt service routines: (*) -// irq_init(NULL); -// irq_add(II_VBLANK, LINK_UNIVERSAL_ISR_VBLANK); -// irq_add(II_SERIAL, LINK_UNIVERSAL_ISR_SERIAL); -// irq_add(II_TIMER3, LINK_UNIVERSAL_ISR_TIMER); +// interrupt_init(); +// interrupt_add(INTR_VBLANK, LINK_UNIVERSAL_ISR_VBLANK); +// interrupt_add(INTR_SERIAL, LINK_UNIVERSAL_ISR_SERIAL); +// interrupt_add(INTR_TIMER3, LINK_UNIVERSAL_ISR_TIMER); // - 3) Initialize the library with: // linkUniversal->activate(); // - 4) Sync: diff --git a/lib/LinkWireless.hpp b/lib/LinkWireless.hpp index ced35b7..45935ed 100644 --- a/lib/LinkWireless.hpp +++ b/lib/LinkWireless.hpp @@ -8,10 +8,10 @@ // - 1) Include this header in your main.cpp file and add: // LinkWireless* linkWireless = new LinkWireless(); // - 2) Add the required interrupt service routines: (*) -// irq_init(NULL); -// irq_add(II_VBLANK, LINK_WIRELESS_ISR_VBLANK); -// irq_add(II_SERIAL, LINK_WIRELESS_ISR_SERIAL); -// irq_add(II_TIMER3, LINK_WIRELESS_ISR_TIMER); +// interrupt_init(); +// interrupt_add(INTR_VBLANK, LINK_WIRELESS_ISR_VBLANK); +// interrupt_add(INTR_SERIAL, LINK_WIRELESS_ISR_SERIAL); +// interrupt_add(INTR_TIMER3, LINK_WIRELESS_ISR_TIMER); // - 3) Initialize the library with: // linkWireless->activate(); // - 4) Start a server: diff --git a/lib/LinkWirelessOpenSDK.hpp b/lib/LinkWirelessOpenSDK.hpp index ae76167..43db28a 100644 --- a/lib/LinkWirelessOpenSDK.hpp +++ b/lib/LinkWirelessOpenSDK.hpp @@ -4,8 +4,8 @@ // -------------------------------------------------------------------------- // An open-source implementation of the "official" Wireless Adapter protocol. // -------------------------------------------------------------------------- -// - Advanced usage only! -// - You only need this if you want to interact with N software. +// - advanced usage only; you only need this if you want to interact with N +// software. // -------------------------------------------------------------------------- #ifndef LINK_DEVELOPMENT