mirror of
https://github.com/opentx/opentx.git
synced 2025-07-20 14:55:13 +03:00
Fix T4 issue
This commit is contained in:
parent
ba536194e4
commit
17f9014240
4 changed files with 183 additions and 83 deletions
|
@ -191,6 +191,8 @@ enum TrainerMode {
|
||||||
#if defined(PCBTARANIS)
|
#if defined(PCBTARANIS)
|
||||||
TRAINER_MODE_MASTER_SBUS_EXTERNAL_MODULE,
|
TRAINER_MODE_MASTER_SBUS_EXTERNAL_MODULE,
|
||||||
TRAINER_MODE_MASTER_CPPM_EXTERNAL_MODULE,
|
TRAINER_MODE_MASTER_CPPM_EXTERNAL_MODULE,
|
||||||
|
#endif
|
||||||
|
#if defined(PCBTARANIS) || defined(AUX_SERIAL)
|
||||||
TRAINER_MODE_MASTER_BATTERY_COMPARTMENT,
|
TRAINER_MODE_MASTER_BATTERY_COMPARTMENT,
|
||||||
#endif
|
#endif
|
||||||
TRAINER_MODE_MASTER_BLUETOOTH,
|
TRAINER_MODE_MASTER_BLUETOOTH,
|
||||||
|
|
|
@ -146,6 +146,10 @@ void SDRAM_Init();
|
||||||
// Pulses driver
|
// Pulses driver
|
||||||
#define INTERNAL_MODULE_ON() GPIO_SetBits(INTMODULE_PWR_GPIO, INTMODULE_PWR_GPIO_PIN)
|
#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)
|
#if defined(INTMODULE_USART)
|
||||||
#define INTERNAL_MODULE_OFF() intmoduleStop()
|
#define INTERNAL_MODULE_OFF() intmoduleStop()
|
||||||
#else
|
#else
|
||||||
|
@ -174,6 +178,9 @@ void init_intmodule_heartbeat();
|
||||||
void check_intmodule_heartbeat();
|
void check_intmodule_heartbeat();
|
||||||
|
|
||||||
void intmoduleSerialStart(uint32_t baudrate, uint8_t rxEnable, uint16_t parity, uint16_t stopBits, uint16_t wordLength);
|
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 intmoduleSendByte(uint8_t byte);
|
||||||
void intmoduleSendBuffer(const uint8_t * data, uint8_t size);
|
void intmoduleSendBuffer(const uint8_t * data, uint8_t size);
|
||||||
void intmoduleSendNextFrame();
|
void intmoduleSendNextFrame();
|
||||||
|
@ -379,7 +386,11 @@ enum Analogs {
|
||||||
#define SLIDER2 SLIDER_FRONT_RIGHT
|
#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_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)
|
||||||
|
#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)
|
#define DEFAULT_POTS_CONFIG (POT_WITH_DETENT << 4) + (POT_MULTIPOS_SWITCH << 2) + (POT_WITHOUT_DETENT << 0)
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(PCBX12S)
|
#if defined(PCBX12S)
|
||||||
#define DEFAULT_SLIDERS_CONFIG (SLIDER_WITH_DETENT << 3) + (SLIDER_WITH_DETENT << 2) + (SLIDER_WITH_DETENT << 1) + (SLIDER_WITH_DETENT << 0)
|
#define DEFAULT_SLIDERS_CONFIG (SLIDER_WITH_DETENT << 3) + (SLIDER_WITH_DETENT << 2) + (SLIDER_WITH_DETENT << 1) + (SLIDER_WITH_DETENT << 0)
|
||||||
|
|
|
@ -205,7 +205,7 @@
|
||||||
#define TRIMS_GPIO_PIN_RVU GPIO_Pin_12 // PJ.12
|
#define TRIMS_GPIO_PIN_RVU GPIO_Pin_12 // PJ.12
|
||||||
#define TRIMS_GPIO_REG_RHR GPIOD->IDR
|
#define TRIMS_GPIO_REG_RHR GPIOD->IDR
|
||||||
#define TRIMS_GPIO_PIN_RHR GPIO_Pin_7 // PD.07
|
#define TRIMS_GPIO_PIN_RHR GPIO_Pin_7 // PD.07
|
||||||
#if defined(RADIO_T16)
|
#if defined(RADIO_FAMILY_T16)
|
||||||
#define TRIMS_GPIO_REG_LSU GPIOD->IDR
|
#define TRIMS_GPIO_REG_LSU GPIOD->IDR
|
||||||
#define TRIMS_GPIO_PIN_LSU GPIO_Pin_13 // PD.13
|
#define TRIMS_GPIO_PIN_LSU GPIO_Pin_13 // PD.13
|
||||||
#define TRIMS_GPIO_REG_LSD GPIOJ->IDR
|
#define TRIMS_GPIO_REG_LSD GPIOJ->IDR
|
||||||
|
@ -346,6 +346,16 @@
|
||||||
#define PWR_SWITCH_GPIO_PIN GPIO_Pin_0 // PJ.00
|
#define PWR_SWITCH_GPIO_PIN GPIO_Pin_0 // PJ.00
|
||||||
#endif
|
#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
|
// S.Port update connector
|
||||||
#define SPORT_MAX_BAUDRATE 250000 // < 400000
|
#define SPORT_MAX_BAUDRATE 250000 // < 400000
|
||||||
#if defined(PCBX10) && !defined(RADIO_FAMILY_T16)
|
#if defined(PCBX10) && !defined(RADIO_FAMILY_T16)
|
||||||
|
@ -388,8 +398,9 @@
|
||||||
|
|
||||||
// Serial Port (DEBUG)
|
// Serial Port (DEBUG)
|
||||||
#if defined(PCBX12S) || defined(RADIO_TX16S)
|
#if defined(PCBX12S) || defined(RADIO_TX16S)
|
||||||
#define AUX_SERIAL_RCC_AHB1Periph (RCC_AHB1Periph_GPIOB | RCC_AHB1Periph_DMA1)
|
#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_APB1Periph RCC_APB1Periph_USART3
|
||||||
|
#define AUX_SERIAL_RCC_APB2Periph 0
|
||||||
#define AUX_SERIAL_GPIO GPIOB
|
#define AUX_SERIAL_GPIO GPIOB
|
||||||
#define AUX_SERIAL_GPIO_PIN_TX GPIO_Pin_10 // PB.10
|
#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_PIN_RX GPIO_Pin_11 // PB.11
|
||||||
|
@ -401,9 +412,56 @@
|
||||||
#define AUX_SERIAL_USART_IRQn USART3_IRQn
|
#define AUX_SERIAL_USART_IRQn USART3_IRQn
|
||||||
#define AUX_SERIAL_DMA_Stream_RX DMA1_Stream1
|
#define AUX_SERIAL_DMA_Stream_RX DMA1_Stream1
|
||||||
#define AUX_SERIAL_DMA_Channel_RX DMA_Channel_4
|
#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
|
#else
|
||||||
#define AUX_SERIAL_RCC_AHB1Periph 0
|
#define AUX_SERIAL_RCC_AHB1Periph 0
|
||||||
#define AUX_SERIAL_RCC_APB1Periph 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
|
#endif
|
||||||
|
|
||||||
// Telemetry
|
// Telemetry
|
||||||
|
@ -770,7 +828,7 @@
|
||||||
#define INTMODULE_HEARTBEAT
|
#define INTMODULE_HEARTBEAT
|
||||||
#define INTMODULE_HEARTBEAT_RCC_AHB1Periph RCC_AHB1Periph_GPIOD
|
#define INTMODULE_HEARTBEAT_RCC_AHB1Periph RCC_AHB1Periph_GPIOD
|
||||||
#define INTMODULE_HEARTBEAT_GPIO 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_PortSource EXTI_PortSourceGPIOD
|
||||||
#define INTMODULE_HEARTBEAT_EXTI_PinSource GPIO_PinSource12
|
#define INTMODULE_HEARTBEAT_EXTI_PinSource GPIO_PinSource12
|
||||||
#define INTMODULE_HEARTBEAT_EXTI_LINE EXTI_Line12
|
#define INTMODULE_HEARTBEAT_EXTI_LINE EXTI_Line12
|
||||||
|
@ -823,6 +881,7 @@
|
||||||
|
|
||||||
// Bluetooth
|
// Bluetooth
|
||||||
#define STORAGE_BLUETOOTH
|
#define STORAGE_BLUETOOTH
|
||||||
|
#if defined(BLUETOOTH)
|
||||||
#define BT_RCC_APB2Periph RCC_APB2Periph_USART6
|
#define BT_RCC_APB2Periph RCC_APB2Periph_USART6
|
||||||
#define BT_USART USART6
|
#define BT_USART USART6
|
||||||
#define BT_GPIO_AF GPIO_AF_USART6
|
#define BT_GPIO_AF GPIO_AF_USART6
|
||||||
|
@ -833,6 +892,9 @@
|
||||||
#define BT_TX_GPIO_PinSource GPIO_PinSource14
|
#define BT_TX_GPIO_PinSource GPIO_PinSource14
|
||||||
#define BT_RX_GPIO_PinSource GPIO_PinSource9
|
#define BT_RX_GPIO_PinSource GPIO_PinSource9
|
||||||
#define BT_USART_IRQHandler USART6_IRQHandler
|
#define BT_USART_IRQHandler USART6_IRQHandler
|
||||||
|
#else
|
||||||
|
#define BT_RCC_APB2Periph 0
|
||||||
|
#endif
|
||||||
#if defined(PCBX12S)
|
#if defined(PCBX12S)
|
||||||
#if PCBREV >= 13
|
#if PCBREV >= 13
|
||||||
#define BT_RCC_AHB1Periph (RCC_AHB1Periph_GPIOI | RCC_AHB1Periph_GPIOG)
|
#define BT_RCC_AHB1Periph (RCC_AHB1Periph_GPIOI | RCC_AHB1Periph_GPIOG)
|
||||||
|
@ -857,6 +919,7 @@
|
||||||
#if defined(PCBX12S)
|
#if defined(PCBX12S)
|
||||||
#define GPS_RCC_AHB1Periph RCC_AHB1Periph_GPIOA
|
#define GPS_RCC_AHB1Periph RCC_AHB1Periph_GPIOA
|
||||||
#define GPS_RCC_APB1Periph RCC_APB1Periph_UART4
|
#define GPS_RCC_APB1Periph RCC_APB1Periph_UART4
|
||||||
|
#define GPS_RCC_APB2Periph 0
|
||||||
#define GPS_USART UART4
|
#define GPS_USART UART4
|
||||||
#define GPS_GPIO_AF GPIO_AF_UART4
|
#define GPS_GPIO_AF GPIO_AF_UART4
|
||||||
#define GPS_USART_IRQn UART4_IRQn
|
#define GPS_USART_IRQn UART4_IRQn
|
||||||
|
@ -866,9 +929,10 @@
|
||||||
#define GPS_RX_GPIO_PIN GPIO_Pin_1 // PA.01
|
#define GPS_RX_GPIO_PIN GPIO_Pin_1 // PA.01
|
||||||
#define GPS_TX_GPIO_PinSource GPIO_PinSource0
|
#define GPS_TX_GPIO_PinSource GPIO_PinSource0
|
||||||
#define GPS_RX_GPIO_PinSource GPIO_PinSource1
|
#define GPS_RX_GPIO_PinSource GPIO_PinSource1
|
||||||
#else
|
#elif !defined(INTERNAL_GPS)
|
||||||
#define GPS_RCC_AHB1Periph 0
|
#define GPS_RCC_AHB1Periph 0
|
||||||
#define GPS_RCC_APB1Periph 0
|
#define GPS_RCC_APB1Periph 0
|
||||||
|
#define GPS_RCC_APB2Periph 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // _HAL_H_
|
#endif // _HAL_H_
|
||||||
|
|
|
@ -204,16 +204,39 @@ void keysInit()
|
||||||
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
|
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
|
||||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;
|
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);
|
INIT_KEYS_PINS(GPIOB);
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(KEYS_GPIOC_PINS)
|
#if defined(KEYS_GPIOC_PINS)
|
||||||
INIT_KEYS_PINS(GPIOC);
|
INIT_KEYS_PINS(GPIOC);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(KEYS_GPIOD_PINS)
|
||||||
INIT_KEYS_PINS(GPIOD);
|
INIT_KEYS_PINS(GPIOD);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(KEYS_GPIOE_PINS)
|
||||||
INIT_KEYS_PINS(GPIOE);
|
INIT_KEYS_PINS(GPIOE);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(KEYS_GPIOG_PINS)
|
||||||
INIT_KEYS_PINS(GPIOG);
|
INIT_KEYS_PINS(GPIOG);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(KEYS_GPIOH_PINS)
|
||||||
INIT_KEYS_PINS(GPIOH);
|
INIT_KEYS_PINS(GPIOH);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(KEYS_GPIOI_PINS)
|
||||||
INIT_KEYS_PINS(GPIOI);
|
INIT_KEYS_PINS(GPIOI);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(KEYS_GPIOJ_PINS)
|
||||||
INIT_KEYS_PINS(GPIOJ);
|
INIT_KEYS_PINS(GPIOJ);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue