Views: 1,609,243 | Main | Rules/FAQ | Memberlist | Active users | Last posts | Calendar | Stats | Online users | Search | 11-21-24 11:50 AM |
Guest: |
0 users reading Code for HID | 1 bot |
Main - Homebrew discussion - Code for HID | Hide post layouts | New reply |
kasai07 |
| ||
Newcomer Normal user Level: 5 Posts: 1/3 EXP: 284 Next: 245 Since: 09-10-16 Last post: 2992 days ago Last view: 2975 days ago |
Hello
sorry for my english i'm french and I do not know too much English here's what I did size_t HID_Flag()
{ return i2cReadRegister(I2C_DEV_MCU, 0x10); } size_t Level3D() { return i2cReadRegister(I2C_DEV_MCU, 0x08); } size_t VolumeLevel() { return i2cReadRegister(I2C_DEV_MCU, 0x09); } size_t BatteryLevel() { return i2cReadRegister(I2C_DEV_MCU, 0x0B); } #define BUTTON_POWER 1
#define BUTTON_HOME 8 #define BUTTON_WIFI10 u32 padflag_state; u32 InputWait() { static u64 delay = 0; u32 pad_state_old = HID_STATE; delay = (delay) ? 72 : 128; timer_start(); u32 HIDFlag = 0; while (true) { padflag_state = 0; HIDFlag = HID_Flag(); if (HIDFlag == 0x01){padflag_state = BUTTON_POWER;return 0;} if (HIDFlag == 0x04){padflag_state = BUTTON_HOME;return 0;} if (HIDFlag == 0x10){padflag_state = BUTTON_WIFI;return 0;} u32 pad_state = HID_STATE; if (!(~pad_state & BUTTON_ANY)) { // no buttons pressed pad_state_old = pad_state; delay = 0; continue; } if ((pad_state == pad_state_old) && (!(~pad_state & BUTTON_ARROW) || (delay && (timer_msec() < delay)))) continue; //Make sure the key is pressed u32 t_pressed = 0; for(; (t_pressed < 0x13000) && (pad_state == HID_STATE); t_pressed++); if (t_pressed >= 0x13000)return ~pad_state; } } } else if (padflag_state == BUTTON_POWER) { DeinitFS(); PowerOff(); } else if (padflag_state == BUTTON_HOME) { DeinitFS(); Reboot(); } |
profi200 |
| ||
Member Who knows? Level: 19 Posts: 70/70 EXP: 34507 Next: 1270 Since: 05-21-15 From: Germany Last post: 2992 days ago Last view: 2860 days ago |
...and what does not work? |
kasai07 |
| ||
Newcomer Normal user Level: 5 Posts: 3/3 EXP: 284 Next: 245 Since: 09-10-16 Last post: 2992 days ago Last view: 2975 days ago |
sorry it worked before but not the stop button and home |
Main - Homebrew discussion - Code for HID | Hide post layouts | New reply |
Page rendered in 0.021 seconds. (2048KB of memory used) MySQL - queries: 28, rows: 69/69, time: 0.009 seconds. Acmlmboard 2.064 (2018-07-20) © 2005-2008 Acmlm, Xkeeper, blackhole89 et al. |