[X9D] Switches now OK on both HW and simu

This commit is contained in:
bernet.andre@gmail.com
2013-01-07 08:42:12 +00:00
parent 5e940e56f4
commit 97595efa83
6 changed files with 24 additions and 17 deletions
+10 -5
View File
@@ -438,17 +438,22 @@ void menuMainView(uint8_t event)
// Switches
for (uint8_t i=0; i<8; i++) {
uint8_t sw;
int16_t val;
switch(i) {
case 0:
sw = getValue(MIXSRC_SA-1) > 0 ? 2 : 1;
case 5:
sw = getValue(MIXSRC_SF-1) > 0 ? 3*i+2 : 3*i+1;
break;
case 6:
val = getValue(MIXSRC_SG-1);
sw = ((val < 0) ? 3*i : ((val == 0) ? 3*i+1 : 3*i+2));
break;
case 7:
sw = getValue(MIXSRC_SH-1) > 0 ? 2+2+3*6 : 1+2+3*6;
sw = getValue(MIXSRC_SH-1) > 0 ? 3*i+1 : 3*i;
break;
default:
{
int16_t val = getValue(MIXSRC_SA+i-1);
sw = ((val < 0) ? 3*i : ((val == 0) ? 3*i+1 : 3*i+2));
val = getValue(MIXSRC_SA+i-1);
sw = ((val < 0) ? 3*i+1 : ((val == 0) ? 3*i+2 : 3*i+3));
break;
}
}
+5 -5
View File
@@ -103,8 +103,8 @@ void setSwitch(int8_t swtch)
GPIOB->IDR &= ~PIN_SW_A_H;
break;
case DSW(SW_SA1):
GPIOE->IDR |= PIN_SW_A_H;
GPIOB->IDR |= PIN_SW_A_L;
GPIOB->IDR |= PIN_SW_A_H;
GPIOE->IDR |= PIN_SW_A_L;
break;
case DSW(SW_SA2):
GPIOE->IDR &= ~PIN_SW_A_L;
@@ -165,15 +165,15 @@ void setSwitch(int8_t swtch)
GPIOE->IDR |= PIN_SW_F;
break;
case DSW(SW_SG0):
GPIOE->IDR |= PIN_SW_G_L;
GPIOB->IDR |= PIN_SW_G_L;
GPIOA->IDR &= ~PIN_SW_G_H;
break;
case DSW(SW_SG1):
GPIOA->IDR |= PIN_SW_G_H;
GPIOE->IDR |= PIN_SW_G_L;
GPIOB->IDR |= PIN_SW_G_L;
break;
case DSW(SW_SG2):
GPIOE->IDR &= ~PIN_SW_G_L;
GPIOB->IDR &= ~PIN_SW_G_L;
GPIOA->IDR |= PIN_SW_G_H;
break;
case DSW(SW_SH0):
+2 -2
View File
@@ -444,12 +444,12 @@ long Open9xSim::onTimeout(FXObject*,FXSelector,void*)
#endif
#if defined(PCBX9D)
SWITCH_KEY(A, SA0, 2);
SWITCH_KEY(A, SA0, 3);
SWITCH_KEY(B, SB0, 3);
SWITCH_KEY(C, SC0, 3);
SWITCH_KEY(D, SD0, 3);
SWITCH_KEY(E, SE0, 3);
SWITCH_KEY(F, SF0, 3);
SWITCH_KEY(F, SF0, 2);
SWITCH_KEY(G, SG0, 3);
SWITCH_KEY(H, SH0, 2);
#else
+3 -1
View File
@@ -48,5 +48,7 @@ void delaysInit(void) {
void delay_01us(uint16_t nb){
TIM13->CNT = 0;
while(TIM13->CNT < nb);
TIM13->EGR = 1;
while(((uint16_t)TIM13->CNT) < nb);
TIM13->EGR = 0;
}
+1 -1
View File
@@ -12,7 +12,7 @@
#include "../open9x.h"
#define I2C_delay() delay_01us(15);
#define I2C_delay() delay_01us(30);
/**
* @brief Configure the used I/O ports pin
+3 -3
View File
@@ -124,13 +124,13 @@ uint32_t keyState(EnumKeys enuk)
switch ((uint8_t) enuk) {
case SW_SA0:
xxx = (~b & PIN_SW_A_H) && (b & PIN_SW_A_L);
xxx = (~b & PIN_SW_A_H) && (e & PIN_SW_A_L);
break;
case SW_SA1:
xxx = (b & PIN_SW_A_H) && (b & PIN_SW_A_L);
xxx = (b & PIN_SW_A_H) && (e & PIN_SW_A_L);
break;
case SW_SA2:
xxx = (b & PIN_SW_A_H) && (~b & PIN_SW_A_L);
xxx = (b & PIN_SW_A_H) && (~e & PIN_SW_A_L);
break;
case SW_SB0: