[X9D] Trims

This commit is contained in:
bsongis
2013-01-11 20:47:10 +00:00
parent 7f9092a90e
commit b3d26bc21f
3 changed files with 20 additions and 22 deletions
-2
View File
@@ -127,8 +127,6 @@ void adcRead();
extern volatile uint16_t Analog_values[]; extern volatile uint16_t Analog_values[];
void configure_pins( uint32_t pins, uint16_t config );
#define DEBUG_UART_BAUDRATE 115200 #define DEBUG_UART_BAUDRATE 115200
void uartInit(void); void uartInit(void);
+8 -8
View File
@@ -16,14 +16,14 @@
#define PIN_BUTTON_EXIT GPIO_Pin_2 //SW5 PD.03 #define PIN_BUTTON_EXIT GPIO_Pin_2 //SW5 PD.03
// Trims // Trims
#define PIN_TRIM1_UP GPIO_Pin_3 //PC.03 #define PIN_TRIM1_UP GPIO_Pin_3 //PE.03
#define PIN_TRIM1_DN GPIO_Pin_2 //PC.02 #define PIN_TRIM1_DN GPIO_Pin_4 //PE.04
#define PIN_TRIM2_UP GPIO_Pin_1 //PC.01 #define PIN_TRIM2_UP GPIO_Pin_6 //PE.06
#define PIN_TRIM2_DN GPIO_Pin_13 //PC.13 #define PIN_TRIM2_DN GPIO_Pin_5 //PE.05
#define PIN_TRIM3_UP GPIO_Pin_4 //PE.04 #define PIN_TRIM3_UP GPIO_Pin_2 //PC.02
#define PIN_TRIM3_DN GPIO_Pin_3 //PE.03 #define PIN_TRIM3_DN GPIO_Pin_3 //PC.03
#define PIN_TRIM4_UP GPIO_Pin_6 //PE.06 #define PIN_TRIM4_UP GPIO_Pin_1 //PC.01
#define PIN_TRIM4_DN GPIO_Pin_5 //PE.05 #define PIN_TRIM4_DN GPIO_Pin_13 //PC.13
// Switchs // Switchs
#define PIN_SW_F GPIO_Pin_14 //PE.14 #define PIN_SW_F GPIO_Pin_14 //PE.14
+12 -12
View File
@@ -67,23 +67,23 @@ uint32_t readTrims()
register uint32_t e = GPIOE->IDR; register uint32_t e = GPIOE->IDR;
register uint32_t result = 0; register uint32_t result = 0;
if (c & PIN_TRIM1_UP) if (e & PIN_TRIM1_DN)
result |= 0x02;
if (c & PIN_TRIM1_DN)
result |= 0x01; result |= 0x01;
if (c & PIN_TRIM2_UP) if (e & PIN_TRIM1_UP)
result |= 0x02;
if (e & PIN_TRIM2_UP)
result |= 0x04; result |= 0x04;
if (c & PIN_TRIM2_DN) if (e & PIN_TRIM2_DN)
result |= 0x08; result |= 0x08;
if (e & PIN_TRIM3_UP) if (c & PIN_TRIM3_UP)
result |= 0x10; result |= 0x10;
if (e & PIN_TRIM3_DN) if (c & PIN_TRIM3_DN)
result |= 0x20; result |= 0x20;
if (e & PIN_TRIM4_UP) if (c & PIN_TRIM4_UP)
result |= 0x40;
if (e & PIN_TRIM4_DN)
result |= 0x80; result |= 0x80;
if (c & PIN_TRIM4_DN)
result |= 0x40;
return result; return result;
} }
@@ -107,10 +107,10 @@ void readKeysAndTrims()
in = readTrims(); in = readTrims();
/* for (i = 1; i < 256; i <<= 1) { for (i = 1; i < 256; i <<= 1) {
keys[enuk].input(in & i, (EnumKeys)enuk); keys[enuk].input(in & i, (EnumKeys)enuk);
++enuk; ++enuk;
} */ }
} }
uint32_t keyState(EnumKeys enuk) uint32_t keyState(EnumKeys enuk)