4dsdev
Views: 614,232 Main | Rules/FAQ | Memberlist | Active users | Last posts | Calendar | Stats | Online users | Search 11-24-17 09:15 PM
Guest:

Main - Posts by kasai07


kasai07
Posted on 09-11-16 09:56 AM, in Code for HID (rev. 2 of 09-14-16 10:08 AM) Link | #1088
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();
}

missing buttons works


kasai07
Posted on 09-11-16 09:59 AM, in Code for HID (rev. 9 of 09-11-16 12:56 PM) Link | #1089
Hello
sorry for my english
i'm french and I do not know too much English
here's what I did

Code HID for A9LH

"fs.c"

size_t Level3D()
{
return i2cReadRegister(I2C_DEV_MCU, 0x08);
}
size_t VolumeLevel()
{
return i2cReadRegister(I2C_DEV_MCU, 0x09);
}
size_t HID_Flag()
{
return i2cReadRegister(I2C_DEV_MCU, 0x10);
}
size_t BatteryLevel()
{
return i2cReadRegister(I2C_DEV_MCU, 0x0B);
}

"hid.h"
#define BUTTON_POWER 1
#define BUTTON_HOME 2
#define BUTTON_WIFI 3
u32 padflag_state;

"hid.c"
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;

}
}


"menu.c"
} else if (padflag_state == BUTTON_POWER) {
DeinitFS();
PowerOff();
} else if (padflag_state == BUTTON_HOME) {
DeinitFS();
Reboot();
}

missing buttons works


http://3dbrew.org/wiki/I2C_Registers

kasai07
Posted on 09-11-16 02:26 PM, in Code for HID Link | #1091

sorry
it worked before
but not the stop button and home


Main - Posts by kasai07

Page rendered in 0.029 seconds. (2048KB of memory used)
MySQL - queries: 22, rows: 65/65, time: 0.021 seconds.
[powered by Acmlm] Acmlmboard 2.064 (2017-11-20)
© 2005-2008 Acmlm, Xkeeper, blackhole89 et al.