Nintendo 3DS >> C/C++
LCD Backlight
參考資訊:
1. sda-cpp
2. libctru doc
3. 3ds-examples
說明:
API |
---|
Result GSPGPU_ReadHWRegs(u32 regAddr, u32* data, u8 size) |
Result GSPGPU_WriteHWRegs(u32 regAddr, const u32* data, u8 size) |
main.c
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <3ds.h> #ifndef REG_LCDBACKLIGHTMAIN #define REG_LCDBACKLIGHTMAIN (u32)(0x1ED02240 - 0x1EB00000) #endif #ifndef REG_LCDBACKLIGHTSUB #define REG_LCDBACKLIGHTSUB (u32)(0x1ED02A40 - 0x1EB00000) #endif int main(void) { u32 brightnessMain = 0, brightnessSub = 0, off = 0; gfxInitDefault(); consoleInit(GFX_TOP, NULL); GSPGPU_ReadHWRegs(REG_LCDBACKLIGHTMAIN, &brightnessMain, 4); GSPGPU_ReadHWRegs(REG_LCDBACKLIGHTSUB, &brightnessSub, 4); printf("backlight main=%d, sub=%d\n", brightnessMain, brightnessSub); svcSleepThread(3000000000LL); GSPGPU_WriteHWRegs(REG_LCDBACKLIGHTMAIN, &off, 4); GSPGPU_WriteHWRegs(REG_LCDBACKLIGHTSUB, &off, 4); svcSleepThread(3000000000LL); GSPGPU_WriteHWRegs(REG_LCDBACKLIGHTMAIN, &brightnessMain, 4); GSPGPU_WriteHWRegs(REG_LCDBACKLIGHTSUB, &brightnessSub, 4); gspWaitForVBlank(); gfxSwapBuffers(); svcSleepThread(3000000000LL); gfxExit(); return 0; }