Add key matrix handleing

This commit is contained in:
meepingsnesroms
2019-09-22 19:13:21 -07:00
parent 2b982cee22
commit d0292b312f
5 changed files with 55 additions and 9 deletions

View File

@@ -57,10 +57,13 @@ MakePalmBitmap:
Other:
Qt port dosent support Windows touchscreen input
memory dumping dosent work for OS 5 yet
T3 I2C currently has no ACK bits(should work without them its just inaccurate)
make the headers belong to the main file of the target chip being emulated
T3 I2C currently has no ACK bits(should work without them its just inaccurate)(I2C works fine though)
T3 emulation attempts to set GPIO1(reset button) as an output
GPIO lines from misc chips to CPU are not implemented
Fixed:
make the headers belong to the main file of the target chip being emulated for specs
remove specs folder
UART1 USTCNT1
trying to beam anything will lock up the OS

View File

@@ -221,6 +221,8 @@ void pxa260LoadState(uint8_t* data){
void pxa260Execute(bool wantVideo){
uint32_t index;
pxa260gpioUpdateKeyMatrix(&pxa260Gpio);
//pxa260TimingRun(TUNGSTEN_T3_CPU_PLL_FREQUENCY / EMU_FPS * palmClockMultiplier);
pxa260TimingRun(20000);

View File

@@ -11,12 +11,13 @@ static void pxa260gpioOnOutputPinUpdated(Pxa260gpio* gpio, UInt8 gpioNum){
//debugLog("PXA260 GPIO %d set:%d\n", gpioNum, pxa260gpioGetState(gpio, gpioNum));
switch(gpioNum){
/*
case 19:
case 20:
case 21:
case 22:
*/
case 33:
pxa260gpioUpdateKeyMatrix(gpio);
break;
case 24:
//TSC2101 chip select
@@ -30,13 +31,12 @@ static void pxa260gpioOnOutputPinUpdated(Pxa260gpio* gpio, UInt8 gpioNum){
break;
default:
debugLog("Unimplimented PXA260 GPIO %d set:%d\n", gpioNum, pxa260gpioGetState(gpio, gpioNum));
debugLog("Unimplimented PXA260 GPIO %d set:%d, PC:0x%08X\n", gpioNum, pxa260gpioGetState(gpio, gpioNum), pxa260GetPc());
break;
}
}
static void pxa260gpioPrvRecalcValues(Pxa260gpio* gpio, UInt32 which){
UInt8 i;
UInt32 val, bit, newVal, oldVal = gpio->levels[which];
@@ -242,15 +242,54 @@ void pxa260gpioSetState(Pxa260gpio* gpio, UInt8 gpioNum, Boolean on){
}
UInt8 pxa260gpioGetState(Pxa260gpio* gpio, UInt8 gpioNum){
UInt32 sSet = gpioNum >> 5;
UInt32 bSet = gpioNum >> 4;
UInt32 sV = 1UL << (gpioNum & 0x1F);
UInt32 bV = 3UL << (gpioNum & 0x0F);
if(gpioNum >= 85) return PXA260_GPIO_NOT_PRESENT;
if(gpio->AFRs[bSet] & bV) return ((gpio->AFRs[bSet] & bV) >> (gpioNum & 0x0F)) - 1 + PXA260_GPIO_AFR1;
if(gpio->dirs[sSet] & sV) return (gpio->latches[sSet] & sV) ? PXA260_GPIO_HIGH : PXA260_GPIO_LOW;
return PXA260_GPIO_HiZ;
}
void pxa260gpioUpdateKeyMatrix(Pxa260gpio* gpio){
bool inRail0 = true;
bool inRail1 = true;
bool inRail2 = true;
if(!!pxa260gpioGetState(gpio, 19)){
//outRail0
inRail0 &= !palmInput.buttonAddress;
inRail1 &= !palmInput.buttonDown;
}
if(!!pxa260gpioGetState(gpio, 20)){
//outRail1
inRail1 &= !palmInput.buttonLeft;
inRail2 &= !palmInput.buttonNotes;
}
if(!!pxa260gpioGetState(gpio, 21)){
//outRail2
inRail1 &= !palmInput.buttonRight;
inRail2 &= !palmInput.buttonTodo;
}
if(!!pxa260gpioGetState(gpio, 22)){
//outRail3
//TODO: implement this button
//inRail0 &= !palmInput.buttonVoice;
inRail2 &= !palmInput.buttonCenter;
}
if(!!pxa260gpioGetState(gpio, 33)){
//outRail4
inRail0 &= !palmInput.buttonCalendar;
inRail1 &= !palmInput.buttonUp;
}
pxa260gpioSetState(gpio, 0, inRail0);
pxa260gpioSetState(gpio, 10, inRail1);
pxa260gpioSetState(gpio, 11, inRail2);
//TODO: move these to the init routine
pxa260gpioSetState(gpio, 3, true);//set the slider postion
pxa260gpioSetState(gpio, 12, false);//prevent HotSync button from being pressed
}

View File

@@ -43,6 +43,7 @@ void pxa260gpioInit(Pxa260gpio* gpio, Pxa260ic* ic);
//for external use :)
UInt8 pxa260gpioGetState(Pxa260gpio* gpio, UInt8 gpioNum);
void pxa260gpioSetState(Pxa260gpio* gpio, UInt8 gpioNum, Boolean on); //we can only set value (and only of input pins), not direction
void pxa260gpioUpdateKeyMatrix(Pxa260gpio* gpio);
#endif

View File

@@ -163,7 +163,8 @@ static uint16_t tsc2101GetAux1Value(void){
debugLog("TSC2101 AUX1 detect type:%s\n", (tsc2101Registers[TOUCH_CONTROL_MEASUREMENT_CONFIGURATION] & 0x4000) ? "resistance" : "voltage");
if(tsc2101Registers[TOUCH_CONTROL_MEASUREMENT_CONFIGURATION] & 0x4000)
return 0xFFF & tsc2101GetAnalogMask();//resistance
return 0xFFF & tsc2101GetAnalogMask();//voltage
//return 0xFFF & tsc2101GetAnalogMask();//voltage
return 0xE50 & tsc2101GetAnalogMask();//voltage, TODO: this is a hack
}
static uint16_t tsc2101GetAux2Value(void){