mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2025-07-29 17:19:54 -06:00
DSi power button and volume switch support (#1630)
* Add proper BPTWL interrupts * Added DSi power button and volume switch hotkeys * Added hardware reset workaround * Adjusted syntax to follow guidelines * Added DSi output volume synchronization * Fix trivial member function error
This commit is contained in:
@ -42,6 +42,56 @@ enum
|
||||
|
||||
u8 GetBatteryLevel();
|
||||
void SetBatteryLevel(u8 batteryLevel);
|
||||
|
||||
// 0-31
|
||||
u8 GetVolumeLevel();
|
||||
void SetVolumeLevel(u8 volume);
|
||||
|
||||
// 0-4
|
||||
u8 GetBacklightLevel();
|
||||
void SetBacklightLevel(u8 backlight);
|
||||
|
||||
void DoHardwareReset(bool direct);
|
||||
void DoShutdown();
|
||||
|
||||
enum
|
||||
{
|
||||
volumeKey_Up,
|
||||
volumeKey_Down,
|
||||
};
|
||||
|
||||
// Used by hotkeys
|
||||
void SetPowerButtonHeld(double time);
|
||||
void SetPowerButtonReleased(double time);
|
||||
void SetVolumeSwitchHeld(u32 key);
|
||||
void SetVolumeSwitchReleased(u32 key);
|
||||
s32 ProcessVolumeSwitchInput(double time);
|
||||
|
||||
void DoPowerButtonPress();
|
||||
void DoPowerButtonReset();
|
||||
void DoPowerButtonShutdown();
|
||||
void DoPowerButtonForceShutdown();
|
||||
void DoVolumeSwitchPress(u32 key);
|
||||
|
||||
enum
|
||||
{
|
||||
IRQ_PowerButtonReset = 0x01, // Triggered after releasing the power button quickly
|
||||
IRQ_PowerButtonShutdown = 0x02, // Triggered after holding the power button for less than a second
|
||||
IRQ_PowerButtonPressed = 0x08, // Triggered after pressing the power button
|
||||
IRQ_BatteryEmpty = 0x10, //
|
||||
IRQ_BatteryLow = 0x20, // Triggered when the battery level reaches 1
|
||||
IRQ_VolumeSwitchPressed = 0x40, // Triggered once when the volume sliders are first pressed and repeatedly when held down
|
||||
/*
|
||||
Bit 2 (0x04) could be set when holding the power button for more than 5 seconds? (forced power off)
|
||||
It is unknown whether it is set as the console powers off immediately.
|
||||
Bit 7 (0x80) is unused?
|
||||
Both bits are never used by the official ARM7 libraries, but could have some undocumented hardware functionality (?).
|
||||
*/
|
||||
IRQ_ValidMask = 0x7B,
|
||||
};
|
||||
|
||||
void SetIRQ(u8 irqFlag);
|
||||
|
||||
}
|
||||
|
||||
namespace DSi_I2C
|
||||
|
Reference in New Issue
Block a user