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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | #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; } |