From 17f9014240bb7a63a4e33a41d61b94038df83c57 Mon Sep 17 00:00:00 2001 From: 3djc Date: Wed, 19 Aug 2020 13:38:23 +0200 Subject: [PATCH] Fix T4 issue --- radio/src/dataconstants.h | 2 + radio/src/targets/horus/board.h | 13 +- radio/src/targets/horus/hal.h | 228 +++++++++++++++--------- radio/src/targets/horus/keys_driver.cpp | 23 +++ 4 files changed, 183 insertions(+), 83 deletions(-) diff --git a/radio/src/dataconstants.h b/radio/src/dataconstants.h index 698d6154b..836e60e88 100644 --- a/radio/src/dataconstants.h +++ b/radio/src/dataconstants.h @@ -191,6 +191,8 @@ enum TrainerMode { #if defined(PCBTARANIS) TRAINER_MODE_MASTER_SBUS_EXTERNAL_MODULE, TRAINER_MODE_MASTER_CPPM_EXTERNAL_MODULE, +#endif +#if defined(PCBTARANIS) || defined(AUX_SERIAL) TRAINER_MODE_MASTER_BATTERY_COMPARTMENT, #endif TRAINER_MODE_MASTER_BLUETOOTH, diff --git a/radio/src/targets/horus/board.h b/radio/src/targets/horus/board.h index 22587abd4..65dc9f83d 100644 --- a/radio/src/targets/horus/board.h +++ b/radio/src/targets/horus/board.h @@ -146,6 +146,10 @@ void SDRAM_Init(); // Pulses driver #define INTERNAL_MODULE_ON() GPIO_SetBits(INTMODULE_PWR_GPIO, INTMODULE_PWR_GPIO_PIN) +#if defined(INTERNAL_MODULE_PXX1) || defined(INTERNAL_MODULE_PXX2) + #define HARDWARE_INTERNAL_RAS +#endif + #if defined(INTMODULE_USART) #define INTERNAL_MODULE_OFF() intmoduleStop() #else @@ -174,6 +178,9 @@ void init_intmodule_heartbeat(); void check_intmodule_heartbeat(); void intmoduleSerialStart(uint32_t baudrate, uint8_t rxEnable, uint16_t parity, uint16_t stopBits, uint16_t wordLength); +#if defined(INTERNAL_MODULE_MULTI) +void intmoduleTimerStart(uint32_t periodMs); +#endif void intmoduleSendByte(uint8_t byte); void intmoduleSendBuffer(const uint8_t * data, uint8_t size); void intmoduleSendNextFrame(); @@ -379,7 +386,11 @@ enum Analogs { #define SLIDER2 SLIDER_FRONT_RIGHT #define DEFAULT_SWITCH_CONFIG (SWITCH_TOGGLE << 14) + (SWITCH_3POS << 12) + (SWITCH_2POS << 10) + (SWITCH_3POS << 8) + (SWITCH_3POS << 6) + (SWITCH_3POS << 4) + (SWITCH_3POS << 2) + (SWITCH_3POS << 0) -#define DEFAULT_POTS_CONFIG (POT_WITH_DETENT << 4) + (POT_MULTIPOS_SWITCH << 2) + (POT_WITHOUT_DETENT << 0) +#if defined(RADIO_FAMILY_T16) + #define DEFAULT_POTS_CONFIG (POT_WITH_DETENT << 4) + (POT_MULTIPOS_SWITCH << 2) + (POT_WITH_DETENT << 0) +#else + #define DEFAULT_POTS_CONFIG (POT_WITH_DETENT << 4) + (POT_MULTIPOS_SWITCH << 2) + (POT_WITHOUT_DETENT << 0) +#endif #if defined(PCBX12S) #define DEFAULT_SLIDERS_CONFIG (SLIDER_WITH_DETENT << 3) + (SLIDER_WITH_DETENT << 2) + (SLIDER_WITH_DETENT << 1) + (SLIDER_WITH_DETENT << 0) diff --git a/radio/src/targets/horus/hal.h b/radio/src/targets/horus/hal.h index 4f350766f..00ad58c2b 100644 --- a/radio/src/targets/horus/hal.h +++ b/radio/src/targets/horus/hal.h @@ -135,24 +135,24 @@ // Gimbal switch left #define STORAGE_SWITCH_I #define HARDWARE_SWITCH_I - #define SWITCHES_GPIO_REG_I GPIOH->IDR - #define SWITCHES_GPIO_PIN_I GPIO_Pin_14 // PH.14 + #define SWITCHES_GPIO_REG_I GPIOH->IDR + #define SWITCHES_GPIO_PIN_I GPIO_Pin_14 // PH.14 // Gimbal switch right #define STORAGE_SWITCH_J #define HARDWARE_SWITCH_J - #define SWITCHES_GPIO_REG_J GPIOH->IDR - #define SWITCHES_GPIO_PIN_J GPIO_Pin_15 // PH.15 + #define SWITCHES_GPIO_REG_J GPIOH->IDR + #define SWITCHES_GPIO_PIN_J GPIO_Pin_15 // PH.15 #elif defined(PCBX12S) // Gimbal switch left #define STORAGE_SWITCH_I #define HARDWARE_SWITCH_I - #define SWITCHES_GPIO_REG_I GPIOB->IDR - #define SWITCHES_GPIO_PIN_I GPIO_Pin_1 // PB.01 + #define SWITCHES_GPIO_REG_I GPIOB->IDR + #define SWITCHES_GPIO_PIN_I GPIO_Pin_1 // PB.01 // Gimbal switch right #define STORAGE_SWITCH_J #define HARDWARE_SWITCH_J - #define SWITCHES_GPIO_REG_J GPIOB->IDR - #define SWITCHES_GPIO_PIN_J GPIO_Pin_0 // PB.00 + #define SWITCHES_GPIO_REG_J GPIOB->IDR + #define SWITCHES_GPIO_PIN_J GPIO_Pin_0 // PB.00 #endif // Trims @@ -182,17 +182,17 @@ #define TRIMS_GPIO_REG_LSU GPIOB->IDR #define TRIMS_GPIO_PIN_LSU GPIO_Pin_13 // PB.13 #elif defined(PCBX10) -#if defined(RADIO_TX16S) - #define TRIMS_GPIO_REG_LHL GPIOA->IDR - #define TRIMS_GPIO_PIN_LHL GPIO_Pin_6 // PA.06 - #define TRIMS_GPIO_REG_LHR GPIOC->IDR - #define TRIMS_GPIO_PIN_LHR GPIO_Pin_4 // PC.04 -#else - #define TRIMS_GPIO_REG_LHL GPIOB->IDR - #define TRIMS_GPIO_PIN_LHL GPIO_Pin_8 // PB.08 - #define TRIMS_GPIO_REG_LHR GPIOB->IDR - #define TRIMS_GPIO_PIN_LHR GPIO_Pin_9 // PB.09 -#endif + #if defined(RADIO_TX16S) + #define TRIMS_GPIO_REG_LHL GPIOA->IDR + #define TRIMS_GPIO_PIN_LHL GPIO_Pin_6 // PA.06 + #define TRIMS_GPIO_REG_LHR GPIOC->IDR + #define TRIMS_GPIO_PIN_LHR GPIO_Pin_4 // PC.04 + #else + #define TRIMS_GPIO_REG_LHL GPIOB->IDR + #define TRIMS_GPIO_PIN_LHL GPIO_Pin_8 // PB.08 + #define TRIMS_GPIO_REG_LHR GPIOB->IDR + #define TRIMS_GPIO_PIN_LHR GPIO_Pin_9 // PB.09 + #endif #define TRIMS_GPIO_REG_LVD GPIOG->IDR #define TRIMS_GPIO_PIN_LVD GPIO_Pin_12 // PG.12 #define TRIMS_GPIO_REG_LVU GPIOJ->IDR @@ -205,16 +205,16 @@ #define TRIMS_GPIO_PIN_RVU GPIO_Pin_12 // PJ.12 #define TRIMS_GPIO_REG_RHR GPIOD->IDR #define TRIMS_GPIO_PIN_RHR GPIO_Pin_7 // PD.07 - #if defined(RADIO_T16) - #define TRIMS_GPIO_REG_LSU GPIOD->IDR - #define TRIMS_GPIO_PIN_LSU GPIO_Pin_13 // PD.13 - #define TRIMS_GPIO_REG_LSD GPIOJ->IDR - #define TRIMS_GPIO_PIN_LSD GPIO_Pin_8 // PJ.08 + #if defined(RADIO_FAMILY_T16) + #define TRIMS_GPIO_REG_LSU GPIOD->IDR + #define TRIMS_GPIO_PIN_LSU GPIO_Pin_13 // PD.13 + #define TRIMS_GPIO_REG_LSD GPIOJ->IDR + #define TRIMS_GPIO_PIN_LSD GPIO_Pin_8 // PJ.08 #else - #define TRIMS_GPIO_REG_LSU GPIOJ->IDR - #define TRIMS_GPIO_PIN_LSU GPIO_Pin_8 // PJ.08 - #define TRIMS_GPIO_REG_LSD GPIOD->IDR - #define TRIMS_GPIO_PIN_LSD GPIO_Pin_13 // PD.13 + #define TRIMS_GPIO_REG_LSU GPIOJ->IDR + #define TRIMS_GPIO_PIN_LSU GPIO_Pin_8 // PJ.08 + #define TRIMS_GPIO_REG_LSD GPIOD->IDR + #define TRIMS_GPIO_PIN_LSD GPIO_Pin_13 // PD.13 #endif #define TRIMS_GPIO_REG_RSU GPIOB->IDR #define TRIMS_GPIO_PIN_RSU GPIO_Pin_14 // PB.14 @@ -233,11 +233,11 @@ #define KEYS_GPIOI_PINS (KEYS_GPIO_PIN_PGDN | KEYS_GPIO_PIN_LEFT | KEYS_GPIO_PIN_DOWN | SWITCHES_GPIO_PIN_A_L | GPIO_Pin_4) #define KEYS_GPIOJ_PINS (SWITCHES_GPIO_PIN_D_H | TRIMS_GPIO_PIN_RVU | TRIMS_GPIO_PIN_LVD | TRIMS_GPIO_PIN_LVU | TRIMS_GPIO_PIN_RSD) #elif defined(PCBX10) -#if defined(RADIO_TX16S) - #define KEYS_GPIOB_PINS (GPIO_Pin_12 | GPIO_Pin_15 | GPIO_Pin_14 | GPIO_Pin_13) -#else - #define KEYS_GPIOB_PINS (GPIO_Pin_12 | GPIO_Pin_15 | GPIO_Pin_14 | GPIO_Pin_13 | GPIO_Pin_8 | GPIO_Pin_9) -#endif + #if defined(RADIO_TX16S) + #define KEYS_GPIOB_PINS (GPIO_Pin_12 | GPIO_Pin_15 | GPIO_Pin_14 | GPIO_Pin_13) + #else + #define KEYS_GPIOB_PINS (GPIO_Pin_12 | GPIO_Pin_15 | GPIO_Pin_14 | GPIO_Pin_13 | GPIO_Pin_8 | GPIO_Pin_9) + #endif #define KEYS_GPIOD_PINS (GPIO_Pin_11 | GPIO_Pin_3 | GPIO_Pin_7 | GPIO_Pin_13) #define KEYS_GPIOE_PINS (GPIO_Pin_3) #define KEYS_GPIOG_PINS (SWITCHES_GPIO_PIN_D_L | SWITCHES_GPIO_PIN_G_H | SWITCHES_GPIO_PIN_G_L | SWITCHES_GPIO_PIN_H | TRIMS_GPIO_PIN_LVD) @@ -320,30 +320,40 @@ #define ADC_DMA_Stream DMA2_Stream0 #define ADC_SET_DMA_FLAGS() ADC_DMA->LIFCR = (DMA_LIFCR_CTCIF0 | DMA_LIFCR_CHTIF0 | DMA_LIFCR_CTEIF0 | DMA_LIFCR_CDMEIF0 | DMA_LIFCR_CFEIF0) #define ADC_TRANSFER_COMPLETE() (ADC_DMA->LISR & DMA_LISR_TCIF0) -#if defined(RADIO_TX16S) - #define ADC_VREF_PREC2 330 -#elif defined(RADIO_T16) || defined(RADIO_T18) - #define ADC_VREF_PREC2 300 -#else - #define ADC_VREF_PREC2 250 -#endif + #if defined(RADIO_TX16S) + #define ADC_VREF_PREC2 330 + #elif defined(RADIO_T16) || defined(RADIO_T18) + #define ADC_VREF_PREC2 300 + #else + #define ADC_VREF_PREC2 250 + #endif #endif // Power #if defined(RADIO_T18) - #define PWR_RCC_AHB1Periph RCC_AHB1Periph_GPIOJ | RCC_AHB1Periph_GPIOB - #define PWR_ON_GPIO GPIOJ - #define PWR_ON_GPIO_PIN GPIO_Pin_1 // PJ.01 - #define PWR_SWITCH_GPIO GPIOJ - #define PWR_SWITCH_GPIO_PIN GPIO_Pin_0 // PJ.00 - #define PWR_EXTRA_SWITCH_GPIO GPIOB - #define PWR_EXTRA_SWITCH_GPIO_PIN GPIO_Pin_0 // PB.00 +#define PWR_RCC_AHB1Periph RCC_AHB1Periph_GPIOJ | RCC_AHB1Periph_GPIOB +#define PWR_ON_GPIO GPIOJ +#define PWR_ON_GPIO_PIN GPIO_Pin_1 // PJ.01 +#define PWR_SWITCH_GPIO GPIOJ +#define PWR_SWITCH_GPIO_PIN GPIO_Pin_0 // PJ.00 +#define PWR_EXTRA_SWITCH_GPIO GPIOB +#define PWR_EXTRA_SWITCH_GPIO_PIN GPIO_Pin_0 // PB.00 #else - #define PWR_RCC_AHB1Periph RCC_AHB1Periph_GPIOJ - #define PWR_ON_GPIO GPIOJ - #define PWR_ON_GPIO_PIN GPIO_Pin_1 // PJ.01 - #define PWR_SWITCH_GPIO GPIOJ - #define PWR_SWITCH_GPIO_PIN GPIO_Pin_0 // PJ.00 +#define PWR_RCC_AHB1Periph RCC_AHB1Periph_GPIOJ +#define PWR_ON_GPIO GPIOJ +#define PWR_ON_GPIO_PIN GPIO_Pin_1 // PJ.01 +#define PWR_SWITCH_GPIO GPIOJ +#define PWR_SWITCH_GPIO_PIN GPIO_Pin_0 // PJ.00 +#endif + +// USB Charger +#if defined(USB_CHARGER) +#define USB_CHARGER_RCC_AHB1Periph RCC_AHB1Periph_GPIOG +#define USB_CHARGER_GPIO GPIOG +#define USB_CHARGER_GPIO_PIN GPIO_Pin_11 // PG.11 +#define USB_USBDet_GPIO_PIN GPIO_Pin_13 // PG.13 +#else +#define USB_CHARGER_RCC_AHB1Periph 0 #endif // S.Port update connector @@ -360,15 +370,15 @@ // PCBREV #if defined(PCBX10) -#define PCBREV_RCC_AHB1Periph RCC_AHB1Periph_GPIOH -#define PCBREV_GPIO_PIN (GPIO_Pin_7 | GPIO_Pin_8) -#define PCBREV_GPIO GPIOH -#define PCBREV_VALUE() (GPIO_ReadInputDataBit(PCBREV_GPIO, GPIO_Pin_7) + (GPIO_ReadInputDataBit(PCBREV_GPIO, GPIO_Pin_8) << 1)) + #define PCBREV_RCC_AHB1Periph RCC_AHB1Periph_GPIOH + #define PCBREV_GPIO_PIN (GPIO_Pin_7 | GPIO_Pin_8) + #define PCBREV_GPIO GPIOH + #define PCBREV_VALUE() (GPIO_ReadInputDataBit(PCBREV_GPIO, GPIO_Pin_7) + (GPIO_ReadInputDataBit(PCBREV_GPIO, GPIO_Pin_8) << 1)) #else -#define PCBREV_RCC_AHB1Periph RCC_AHB1Periph_GPIOI -#define PCBREV_GPIO GPIOI -#define PCBREV_GPIO_PIN GPIO_Pin_11 // PI.11 -#define PCBREV_VALUE() GPIO_ReadInputDataBit(PCBREV_GPIO, PCBREV_GPIO_PIN) + #define PCBREV_RCC_AHB1Periph RCC_AHB1Periph_GPIOI + #define PCBREV_GPIO GPIOI + #define PCBREV_GPIO_PIN GPIO_Pin_11 // PI.11 + #define PCBREV_VALUE() GPIO_ReadInputDataBit(PCBREV_GPIO, PCBREV_GPIO_PIN) #endif // Led @@ -388,22 +398,70 @@ // Serial Port (DEBUG) #if defined(PCBX12S) || defined(RADIO_TX16S) -#define AUX_SERIAL_RCC_AHB1Periph (RCC_AHB1Periph_GPIOB | RCC_AHB1Periph_DMA1) -#define AUX_SERIAL_RCC_APB1Periph RCC_APB1Periph_USART3 -#define AUX_SERIAL_GPIO GPIOB -#define AUX_SERIAL_GPIO_PIN_TX GPIO_Pin_10 // PB.10 -#define AUX_SERIAL_GPIO_PIN_RX GPIO_Pin_11 // PB.11 -#define AUX_SERIAL_GPIO_PinSource_TX GPIO_PinSource10 -#define AUX_SERIAL_GPIO_PinSource_RX GPIO_PinSource11 -#define AUX_SERIAL_GPIO_AF GPIO_AF_USART3 -#define AUX_SERIAL_USART USART3 -#define AUX_SERIAL_USART_IRQHandler USART3_IRQHandler -#define AUX_SERIAL_USART_IRQn USART3_IRQn -#define AUX_SERIAL_DMA_Stream_RX DMA1_Stream1 -#define AUX_SERIAL_DMA_Channel_RX DMA_Channel_4 + #define AUX_SERIAL_RCC_AHB1Periph (RCC_AHB1Periph_GPIOA | RCC_AHB1Periph_GPIOB | RCC_AHB1Periph_DMA1) + #define AUX_SERIAL_RCC_APB1Periph RCC_APB1Periph_USART3 + #define AUX_SERIAL_RCC_APB2Periph 0 + #define AUX_SERIAL_GPIO GPIOB + #define AUX_SERIAL_GPIO_PIN_TX GPIO_Pin_10 // PB.10 + #define AUX_SERIAL_GPIO_PIN_RX GPIO_Pin_11 // PB.11 + #define AUX_SERIAL_GPIO_PinSource_TX GPIO_PinSource10 + #define AUX_SERIAL_GPIO_PinSource_RX GPIO_PinSource11 + #define AUX_SERIAL_GPIO_AF GPIO_AF_USART3 + #define AUX_SERIAL_USART USART3 + #define AUX_SERIAL_USART_IRQHandler USART3_IRQHandler + #define AUX_SERIAL_USART_IRQn USART3_IRQn + #define AUX_SERIAL_DMA_Stream_RX DMA1_Stream1 + #define AUX_SERIAL_DMA_Channel_RX DMA_Channel_4 + #define AUX_SERIAL_PWR_GPIO GPIOA + #define AUX_SERIAL_PWR_GPIO_PIN GPIO_Pin_15 // PB.00 +#if defined(RADIO_TX16S) + #define TRAINER_BATTERY_COMPARTMENT // allows serial port TTL trainer +#endif #else -#define AUX_SERIAL_RCC_AHB1Periph 0 -#define AUX_SERIAL_RCC_APB1Periph 0 + #define AUX_SERIAL_RCC_AHB1Periph 0 + #define AUX_SERIAL_RCC_APB1Periph 0 + #define AUX_SERIAL_RCC_APB2Periph 0 +#endif + +#if defined(AUX2_SERIAL) + #define AUX2_SERIAL_RCC_AHB1Periph (RCC_AHB1Periph_GPIOB | RCC_AHB1Periph_GPIOG | RCC_AHB1Periph_DMA2) + #define AUX2_SERIAL_RCC_APB1Periph 0 + #define AUX2_SERIAL_RCC_APB2Periph RCC_APB2Periph_USART6 + #define AUX2_SERIAL_USART USART6 + #define AUX2_SERIAL_GPIO_AF GPIO_AF_USART6 + #define AUX2_SERIAL_USART_IRQn USART6_IRQn + #define AUX2_SERIAL_GPIO GPIOG + #define AUX2_SERIAL_GPIO_PIN_TX GPIO_Pin_14 // PG.14 + #define AUX2_SERIAL_GPIO_PIN_RX GPIO_Pin_9 // PG.09 + #define AUX2_SERIAL_GPIO_PinSource_TX GPIO_PinSource14 + #define AUX2_SERIAL_GPIO_PinSource_RX GPIO_PinSource9 + #define AUX2_SERIAL_USART_IRQHandler USART6_IRQHandler + #define AUX2_SERIAL_DMA_Stream_RX DMA2_Stream6 + #define AUX2_SERIAL_DMA_Channel_RX DMA_Channel_5 + #define AUX2_SERIAL_PWR_GPIO GPIOB + #define AUX2_SERIAL_PWR_GPIO_PIN GPIO_Pin_0 // PB.00 +#elif defined(RADIO_TX16S) && defined(INTERNAL_GPS) + #define GPS_RCC_AHB1Periph (RCC_AHB1Periph_GPIOB | RCC_AHB1Periph_GPIOG) + #define GPS_RCC_APB1Periph 0 + #define GPS_RCC_APB2Periph RCC_APB2Periph_USART6 + #define GPS_USART USART6 + #define GPS_GPIO_AF GPIO_AF_USART6 + #define GPS_USART_IRQn USART6_IRQn + #define GPS_USART_IRQHandler USART6_IRQHandler + #define GPS_UART_GPIO GPIOG + #define GPS_TX_GPIO_PIN GPIO_Pin_14 // PG.14 + #define GPS_RX_GPIO_PIN GPIO_Pin_9 // PG.09 + #define GPS_TX_GPIO_PinSource GPIO_PinSource14 + #define GPS_RX_GPIO_PinSource GPIO_PinSource9 + #define GPS_PWR_GPIO GPIOB + #define GPS_PWR_GPIO_PIN GPIO_Pin_0 // PB.00 + #define AUX2_SERIAL_RCC_AHB1Periph 0 + #define AUX2_SERIAL_RCC_APB1Periph 0 + #define AUX2_SERIAL_RCC_APB2Periph 0 +#else + #define AUX2_SERIAL_RCC_AHB1Periph 0 + #define AUX2_SERIAL_RCC_APB1Periph 0 + #define AUX2_SERIAL_RCC_APB2Periph 0 #endif // Telemetry @@ -429,8 +487,8 @@ #define TELEMETRY_TIMER_IRQn TIM1_TRG_COM_TIM11_IRQn #define TELEMETRY_TIMER_IRQHandler TIM1_TRG_COM_TIM11_IRQHandler #if defined(PCBX12S) -#define TELEMETRY_DMA_Stream_RX DMA1_Stream5 -#define TELEMETRY_DMA_Channel_RX DMA_Channel_4 + #define TELEMETRY_DMA_Stream_RX DMA1_Stream5 + #define TELEMETRY_DMA_Channel_RX DMA_Channel_4 #endif #define TELEMETRY_DMA_Stream_TX DMA1_Stream6 #define TELEMETRY_DMA_Channel_TX DMA_Channel_4 @@ -461,7 +519,7 @@ #define LCD_GPIO_NRST GPIOI #define LCD_GPIO_PIN_NRST GPIO_Pin_10 // PI.10 #endif - #if defined(PCBX10) && !defined(RADIO_T18) && !defined(SIMU) +#if defined(PCBX10) && !defined(RADIO_T18) && !defined(SIMU) #define LCD_VERTICAL_INVERT #endif #define LTDC_IRQ_PRIO 4 @@ -770,16 +828,16 @@ #define INTMODULE_HEARTBEAT #define INTMODULE_HEARTBEAT_RCC_AHB1Periph RCC_AHB1Periph_GPIOD #define INTMODULE_HEARTBEAT_GPIO GPIOD -#define INTMODULE_HEARTBEAT_GPIO_PIN GPIO_Pin_12 +#define INTMODULE_HEARTBEAT_GPIO_PIN GPIO_Pin_12 // PD.12 #define INTMODULE_HEARTBEAT_EXTI_PortSource EXTI_PortSourceGPIOD #define INTMODULE_HEARTBEAT_EXTI_PinSource GPIO_PinSource12 #define INTMODULE_HEARTBEAT_EXTI_LINE EXTI_Line12 #define INTMODULE_HEARTBEAT_EXTI_IRQn EXTI15_10_IRQn #define INTMODULE_HEARTBEAT_REUSE_INTERRUPT_ROTARY_ENCODER #if defined(PXX2) -#define INTMODULE_HEARTBEAT_TRIGGER EXTI_Trigger_Falling + #define INTMODULE_HEARTBEAT_TRIGGER EXTI_Trigger_Falling #else -#define INTMODULE_HEARTBEAT_TRIGGER EXTI_Trigger_Rising + #define INTMODULE_HEARTBEAT_TRIGGER EXTI_Trigger_Rising #endif // Trainer Port @@ -823,6 +881,7 @@ // Bluetooth #define STORAGE_BLUETOOTH +#if defined(BLUETOOTH) #define BT_RCC_APB2Periph RCC_APB2Periph_USART6 #define BT_USART USART6 #define BT_GPIO_AF GPIO_AF_USART6 @@ -833,6 +892,9 @@ #define BT_TX_GPIO_PinSource GPIO_PinSource14 #define BT_RX_GPIO_PinSource GPIO_PinSource9 #define BT_USART_IRQHandler USART6_IRQHandler +#else +#define BT_RCC_APB2Periph 0 +#endif #if defined(PCBX12S) #if PCBREV >= 13 #define BT_RCC_AHB1Periph (RCC_AHB1Periph_GPIOI | RCC_AHB1Periph_GPIOG) @@ -857,6 +919,7 @@ #if defined(PCBX12S) #define GPS_RCC_AHB1Periph RCC_AHB1Periph_GPIOA #define GPS_RCC_APB1Periph RCC_APB1Periph_UART4 + #define GPS_RCC_APB2Periph 0 #define GPS_USART UART4 #define GPS_GPIO_AF GPIO_AF_UART4 #define GPS_USART_IRQn UART4_IRQn @@ -866,9 +929,10 @@ #define GPS_RX_GPIO_PIN GPIO_Pin_1 // PA.01 #define GPS_TX_GPIO_PinSource GPIO_PinSource0 #define GPS_RX_GPIO_PinSource GPIO_PinSource1 -#else +#elif !defined(INTERNAL_GPS) #define GPS_RCC_AHB1Periph 0 #define GPS_RCC_APB1Periph 0 + #define GPS_RCC_APB2Periph 0 #endif #endif // _HAL_H_ diff --git a/radio/src/targets/horus/keys_driver.cpp b/radio/src/targets/horus/keys_driver.cpp index 888c4dabc..abf7bb961 100644 --- a/radio/src/targets/horus/keys_driver.cpp +++ b/radio/src/targets/horus/keys_driver.cpp @@ -204,16 +204,39 @@ void keysInit() GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN; +#if defined(KEYS_GPIOA_PINS) + INIT_KEYS_PINS(GPIOA); +#endif + +#if defined(KEYS_GPIOB_PINS) INIT_KEYS_PINS(GPIOB); +#endif #if defined(KEYS_GPIOC_PINS) INIT_KEYS_PINS(GPIOC); #endif +#if defined(KEYS_GPIOD_PINS) INIT_KEYS_PINS(GPIOD); +#endif + +#if defined(KEYS_GPIOE_PINS) INIT_KEYS_PINS(GPIOE); +#endif + +#if defined(KEYS_GPIOG_PINS) INIT_KEYS_PINS(GPIOG); +#endif + +#if defined(KEYS_GPIOH_PINS) INIT_KEYS_PINS(GPIOH); +#endif + +#if defined(KEYS_GPIOI_PINS) INIT_KEYS_PINS(GPIOI); +#endif + +#if defined(KEYS_GPIOJ_PINS) INIT_KEYS_PINS(GPIOJ); +#endif }