X9E Trims should now be ok

This commit is contained in:
bsongis
2014-11-25 23:42:06 +01:00
parent ea0d7577c8
commit e5006769be
2 changed files with 154 additions and 136 deletions
+13 -8
View File
@@ -6,7 +6,7 @@
*/ */
#if defined(REV9E) #if defined(REV9E)
#define RCC_AHB1Periph_GPIOBUTTON (RCC_AHB1Periph_GPIOA|RCC_AHB1Periph_GPIOB|RCC_AHB1Periph_GPIOC|RCC_AHB1Periph_GPIOD|RCC_AHB1Periph_GPIOE|RCC_AHB1Periph_GPIOF) #define RCC_AHB1Periph_GPIOBUTTON (RCC_AHB1Periph_GPIOA|RCC_AHB1Periph_GPIOB|RCC_AHB1Periph_GPIOC|RCC_AHB1Periph_GPIOD|RCC_AHB1Periph_GPIOE|RCC_AHB1Periph_GPIOF|RCC_AHB1Periph_GPIOG)
#else #else
#define RCC_AHB1Periph_GPIOBUTTON (RCC_AHB1Periph_GPIOA|RCC_AHB1Periph_GPIOB|RCC_AHB1Periph_GPIOC|RCC_AHB1Periph_GPIOD|RCC_AHB1Periph_GPIOE) #define RCC_AHB1Periph_GPIOBUTTON (RCC_AHB1Periph_GPIOA|RCC_AHB1Periph_GPIOB|RCC_AHB1Periph_GPIOC|RCC_AHB1Periph_GPIOD|RCC_AHB1Periph_GPIOE)
#endif #endif
@@ -18,16 +18,16 @@
#define GPIO_BUTTON_MENU GPIOD->IDR #define GPIO_BUTTON_MENU GPIOD->IDR
#define GPIO_BUTTON_EXIT GPIOD->IDR #define GPIO_BUTTON_EXIT GPIOD->IDR
#define GPIO_BUTTON_PAGE GPIOD->IDR #define GPIO_BUTTON_PAGE GPIOD->IDR
#define PIN_BUTTON_PLUS GPIO_Pin_10 //SW3 PE.10 #define PIN_BUTTON_PLUS GPIO_Pin_10 // PE.10
#define PIN_BUTTON_MINUS GPIO_Pin_11 // PE11 #define PIN_BUTTON_MINUS GPIO_Pin_11 // PE.11
#if defined(REV9E) #if defined(REV9E)
#define PIN_BUTTON_ENTER GPIO_Pin_0 // PF0 #define PIN_BUTTON_ENTER GPIO_Pin_0 // PF.00
#else #else
#define PIN_BUTTON_ENTER GPIO_Pin_12 // PE12 #define PIN_BUTTON_ENTER GPIO_Pin_12 // PE.12
#endif #endif
#define PIN_BUTTON_MENU GPIO_Pin_7 //SW4 PD.07 #define PIN_BUTTON_MENU GPIO_Pin_7 // PD.07
#define PIN_BUTTON_PAGE GPIO_Pin_3 //SW6 PD.02 #define PIN_BUTTON_PAGE GPIO_Pin_3 // PD.02
#define PIN_BUTTON_EXIT GPIO_Pin_2 //SW5 PD.03 #define PIN_BUTTON_EXIT GPIO_Pin_2 // PD.03
// Trims // Trims
#define GPIO_TRIM_LH_L GPIOE->IDR #define GPIO_TRIM_LH_L GPIOE->IDR
@@ -49,8 +49,13 @@
#define PIN_TRIM_LH_L GPIO_Pin_4 // PE.04 #define PIN_TRIM_LH_L GPIO_Pin_4 // PE.04
#define PIN_TRIM_LH_R GPIO_Pin_3 // PE.03 #define PIN_TRIM_LH_R GPIO_Pin_3 // PE.03
#endif #endif
#if defined(REV9E)
#define PIN_TRIM_LV_DN GPIO_Pin_1 // PG.01
#define PIN_TRIM_LV_UP GPIO_Pin_0 // PG.00
#else
#define PIN_TRIM_LV_DN GPIO_Pin_6 // PE.06 #define PIN_TRIM_LV_DN GPIO_Pin_6 // PE.06
#define PIN_TRIM_LV_UP GPIO_Pin_5 // PE.05 #define PIN_TRIM_LV_UP GPIO_Pin_5 // PE.05
#endif
// Switchs // Switchs
#if defined(REV3) #if defined(REV3)
+14 -1
View File
@@ -75,16 +75,27 @@ uint32_t readTrims()
{ {
register uint32_t c = GPIOC->IDR; register uint32_t c = GPIOC->IDR;
register uint32_t e = GPIOE->IDR; register uint32_t e = GPIOE->IDR;
#if defined(REV9E)
register uint32_t g = GPIOG->IDR;
#endif
register uint32_t result = 0; register uint32_t result = 0;
if (~e & PIN_TRIM_LH_L) if (~e & PIN_TRIM_LH_L)
result |= 0x01; // LH_L result |= 0x01; // LH_L
if (~e & PIN_TRIM_LH_R) if (~e & PIN_TRIM_LH_R)
result |= 0x02; // LH_R result |= 0x02; // LH_R
#if defined(REV9E)
if (~g & PIN_TRIM_LV_DN)
result |= 0x04; // LV_DN
if (~g & PIN_TRIM_LV_UP)
result |= 0x08; // LV_UP
#else
if (~e & PIN_TRIM_LV_DN) if (~e & PIN_TRIM_LV_DN)
result |= 0x04; // LV_DN result |= 0x04; // LV_DN
if (~e & PIN_TRIM_LV_UP) if (~e & PIN_TRIM_LV_UP)
result |= 0x08; // LV_UP result |= 0x08; // LV_UP
#endif
if (~c & PIN_TRIM_RV_DN) if (~c & PIN_TRIM_RV_DN)
result |= 0x10; // RV_DN result |= 0x10; // RV_DN
@@ -327,7 +338,6 @@ void keysInit()
| PIN_SW_A_L | PIN_SW_D_L | PIN_SW_F | PIN_SW_C_L | PIN_SW_D_H | PIN_SW_H; | PIN_SW_A_L | PIN_SW_D_L | PIN_SW_F | PIN_SW_C_L | PIN_SW_D_H | PIN_SW_H;
#elif defined(REV9E) #elif defined(REV9E)
GPIO_InitStructure.GPIO_Pin = PIN_BUTTON_PLUS | PIN_BUTTON_MINUS | PIN_TRIM_LH_R | PIN_TRIM_LH_L GPIO_InitStructure.GPIO_Pin = PIN_BUTTON_PLUS | PIN_BUTTON_MINUS | PIN_TRIM_LH_R | PIN_TRIM_LH_L
| PIN_TRIM_LV_DN | PIN_TRIM_LV_UP
| PIN_SW_F | PIN_SW_A_L | PIN_SW_B_H | PIN_SW_B_L | PIN_SW_C_H | PIN_SW_D_H | PIN_SW_D_L | PIN_SW_G_H | PIN_SW_G_L; | PIN_SW_F | PIN_SW_A_L | PIN_SW_B_H | PIN_SW_B_L | PIN_SW_C_H | PIN_SW_D_H | PIN_SW_D_L | PIN_SW_G_H | PIN_SW_G_L;
#elif defined(REVPLUS) #elif defined(REVPLUS)
GPIO_InitStructure.GPIO_Pin = PIN_BUTTON_PLUS | PIN_BUTTON_ENTER | PIN_BUTTON_MINUS | PIN_TRIM_LH_R | PIN_TRIM_LH_L GPIO_InitStructure.GPIO_Pin = PIN_BUTTON_PLUS | PIN_BUTTON_ENTER | PIN_BUTTON_MINUS | PIN_TRIM_LH_R | PIN_TRIM_LH_L
@@ -347,6 +357,9 @@ void keysInit()
#if defined(REV9E) #if defined(REV9E)
GPIO_InitStructure.GPIO_Pin = PIN_BUTTON_ENTER; GPIO_InitStructure.GPIO_Pin = PIN_BUTTON_ENTER;
GPIO_Init(GPIOF, &GPIO_InitStructure); GPIO_Init(GPIOF, &GPIO_InitStructure);
GPIO_InitStructure.GPIO_Pin = PIN_TRIM_LV_DN | PIN_TRIM_LV_UP;
GPIO_Init(GPIOG, &GPIO_InitStructure);
#endif #endif
#if defined(REVPLUS) #if defined(REVPLUS)