Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ SELECT+Y - Dump hardware frame output to `/3ds/open_agb_firm/screenshots/YYYY_MM
* The file name is the current date and time from your real-time clock.
* If the screen output freezes, press HOME to fix it. This is a hard to track down bug that will be fixed.

START+Y - Toggle power LED on/off.

X+UP/DOWN - Adjust screen brightness up or down by `backlightSteps` units.

X+LEFT - Turn off LCD backlight.
Expand Down
21 changes: 20 additions & 1 deletion source/arm11/open_agb_firm.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@


static KHandle g_frameReadyEvent = 0;

static PwrLedPattern g_lastPowerLEDPattern = MCU_PWR_LED_AUTO;


static u32 fixRomPadding(const u32 romFileSize)
Expand Down Expand Up @@ -122,13 +122,32 @@ void changeBacklight(s16 amount)
GFX_setLcdLuminance(newVal);
}

void togglePowerLED()
{
PwrLedPattern currentPattern = MCU_getPowerLedPattern();
if (currentPattern == MCU_PWR_LED_OFF)
{
// Restore last know pattern.
MCU_setPowerLedPattern(g_lastPowerLEDPattern);
}
else
{
MCU_setPowerLedPattern(MCU_PWR_LED_OFF);
}
g_lastPowerLEDPattern = currentPattern;
}

static void updateBacklight(void)
{
// Check for special button combos.
const u32 kHeld = hidKeysHeld();
static bool backlightOn = true;
if(hidKeysDown() && kHeld)
{
// Toggle power LED.
if (kHeld == (KEY_Y | KEY_START))
togglePowerLED();

// Adjust LCD brightness up.
const s16 steps = g_oafConfig.backlightSteps;
if(kHeld == (KEY_X | KEY_DUP))
Expand Down