[X9D] Some switches in simu, not finished

This commit is contained in:
bsongis
2012-12-01 19:07:58 +00:00
parent a2309abc88
commit 72fd306015
2 changed files with 70 additions and 3 deletions
+59 -2
View File
@@ -895,6 +895,64 @@ uint8_t keyDown()
return ~read_keys() & 0x7E ;
}
#if defined(PCBX9D)
extern uint32_t keyState(EnumKeys enuk)
{
register uint32_t a ;
register uint32_t c ;
CPU_UINT xxx = 0;
if (enuk < (int) DIM(keys)) return keys[enuk].state() ? 1 : 0;
a = PIOA->PIO_PDSR ;
c = PIOC->PIO_PDSR ;
// printf("c=%x\n", c); fflush(stdout);
switch ((uint8_t) enuk) {
case SW_SA0:
xxx = c & 0x80000000;
break;
case SW_SA2:
xxx = c & 0x40000000;
break;
case SW_SB0:
xxx = c & 0x08000000;
break;
case SW_SB1:
xxx = c & 0x04000000;
break;
case SW_SB2:
xxx = c & 0x02000000;
break;
case SW_SC0:
xxx = c & 0x00800000;
break;
case SW_SC1:
xxx = c & 0x00400000;
break;
case SW_SC2:
xxx = c & 0x00200000;
break;
default:
break;
}
if (xxx) {
return 1;
}
return 0;
}
#else
extern uint32_t keyState(EnumKeys enuk)
{
register uint32_t a ;
@@ -907,7 +965,6 @@ extern uint32_t keyState(EnumKeys enuk)
a = PIOA->PIO_PDSR ;
c = PIOC->PIO_PDSR ;
#if !defined(PCBX9D)
switch ((uint8_t) enuk) {
#ifdef REVB
case SW_ELE:
@@ -960,13 +1017,13 @@ extern uint32_t keyState(EnumKeys enuk)
default:
break;
}
#endif
if (xxx) {
return 1;
}
return 0;
}
#endif
uint16_t Analog_values[NUMBER_ANALOG] ;
uint8_t temperature = 0; // Raw temp reading
+11 -1
View File
@@ -324,6 +324,7 @@ long Open9xSim::onTimeout(FXObject*,FXSelector,void*)
#else
pind = 0;
#endif
for(unsigned i=0; i<DIM(keys2);i++){
if(getApp()->getKeyState(keys2[i])) {
#if defined(PCBSKY9X)
@@ -378,7 +379,16 @@ long Open9xSim::onTimeout(FXObject*,FXSelector,void*)
#endif
static SwitchKey keys3[] = {
#if defined(PCBSKY9X)
#if defined(PCBX9D)
{ KEY_A, PIOC->PIO_PDSR, 31, 0 },
{ KEY_B, PIOC->PIO_PDSR, 27, 0 },
{ KEY_C, PIOC->PIO_PDSR, 23, 0 },
{ KEY_D, PIOC->PIO_PDSR, 17, 0 },
{ KEY_E, PIOC->PIO_PDSR, 16, 0 },
{ KEY_F, PIOC->PIO_PDSR, 15, 0 },
{ KEY_G, PIOC->PIO_PDSR, 15, 0 },
{ KEY_H, PIOC->PIO_PDSR, 15, 0 } };
#elif defined(PCBSKY9X)
{ KEY_1, PIOC->PIO_PDSR, 20, 0 },
{ KEY_6, PIOA->PIO_PDSR, 2, 0 },
{ KEY_2, PIOA->PIO_PDSR, 15, 0 },