[X9D] Some switches in simu, not finished
This commit is contained in:
+59
-2
@@ -895,6 +895,64 @@ uint8_t keyDown()
|
|||||||
return ~read_keys() & 0x7E ;
|
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)
|
extern uint32_t keyState(EnumKeys enuk)
|
||||||
{
|
{
|
||||||
register uint32_t a ;
|
register uint32_t a ;
|
||||||
@@ -907,7 +965,6 @@ extern uint32_t keyState(EnumKeys enuk)
|
|||||||
a = PIOA->PIO_PDSR ;
|
a = PIOA->PIO_PDSR ;
|
||||||
c = PIOC->PIO_PDSR ;
|
c = PIOC->PIO_PDSR ;
|
||||||
|
|
||||||
#if !defined(PCBX9D)
|
|
||||||
switch ((uint8_t) enuk) {
|
switch ((uint8_t) enuk) {
|
||||||
#ifdef REVB
|
#ifdef REVB
|
||||||
case SW_ELE:
|
case SW_ELE:
|
||||||
@@ -960,13 +1017,13 @@ extern uint32_t keyState(EnumKeys enuk)
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
if (xxx) {
|
if (xxx) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
uint16_t Analog_values[NUMBER_ANALOG] ;
|
uint16_t Analog_values[NUMBER_ANALOG] ;
|
||||||
uint8_t temperature = 0; // Raw temp reading
|
uint8_t temperature = 0; // Raw temp reading
|
||||||
|
|||||||
+11
-1
@@ -324,6 +324,7 @@ long Open9xSim::onTimeout(FXObject*,FXSelector,void*)
|
|||||||
#else
|
#else
|
||||||
pind = 0;
|
pind = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for(unsigned i=0; i<DIM(keys2);i++){
|
for(unsigned i=0; i<DIM(keys2);i++){
|
||||||
if(getApp()->getKeyState(keys2[i])) {
|
if(getApp()->getKeyState(keys2[i])) {
|
||||||
#if defined(PCBSKY9X)
|
#if defined(PCBSKY9X)
|
||||||
@@ -378,7 +379,16 @@ long Open9xSim::onTimeout(FXObject*,FXSelector,void*)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
static SwitchKey keys3[] = {
|
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_1, PIOC->PIO_PDSR, 20, 0 },
|
||||||
{ KEY_6, PIOA->PIO_PDSR, 2, 0 },
|
{ KEY_6, PIOA->PIO_PDSR, 2, 0 },
|
||||||
{ KEY_2, PIOA->PIO_PDSR, 15, 0 },
|
{ KEY_2, PIOA->PIO_PDSR, 15, 0 },
|
||||||
|
|||||||
Reference in New Issue
Block a user