mirror of
https://github.com/opentx/opentx.git
synced 2025-07-15 12:25:12 +03:00
[X7D] Rotary encoder initialization
This commit is contained in:
parent
d2f688c7d9
commit
71bb6de3dd
5 changed files with 22 additions and 10 deletions
|
@ -902,7 +902,7 @@ PACK(struct TrainerData {
|
||||||
char switchNames[NUM_SWITCHES][LEN_SWITCH_NAME]; \
|
char switchNames[NUM_SWITCHES][LEN_SWITCH_NAME]; \
|
||||||
char anaNames[NUM_STICKS+NUM_POTS+NUM_SLIDERS][LEN_ANA_NAME];
|
char anaNames[NUM_STICKS+NUM_POTS+NUM_SLIDERS][LEN_ANA_NAME];
|
||||||
#elif defined(PCBTARANIS)
|
#elif defined(PCBTARANIS)
|
||||||
#if defined(PCBX9E)
|
#if defined(PCBX9E) || defined(PCBX7D)
|
||||||
#define BLUETOOTH_FIELDS \
|
#define BLUETOOTH_FIELDS \
|
||||||
uint8_t bluetoothEnable; \
|
uint8_t bluetoothEnable; \
|
||||||
char bluetoothName[LEN_BLUETOOTH_NAME];
|
char bluetoothName[LEN_BLUETOOTH_NAME];
|
||||||
|
|
|
@ -59,6 +59,10 @@ elseif(PCB STREQUAL X7D)
|
||||||
set(FLAVOUR x7d)
|
set(FLAVOUR x7d)
|
||||||
add_definitions(-DPCBX7D -DSOFTWARE_VOLUME)
|
add_definitions(-DPCBX7D -DSOFTWARE_VOLUME)
|
||||||
add_definitions(-DEEPROM_VARIANT=0)
|
add_definitions(-DEEPROM_VARIANT=0)
|
||||||
|
set(FIRMWARE_TARGET_SRC
|
||||||
|
${FIRMWARE_TARGET_SRC}
|
||||||
|
bluetooth_driver.cpp
|
||||||
|
)
|
||||||
set(GUI_DIR 128x64)
|
set(GUI_DIR 128x64)
|
||||||
set(BITMAPS_TARGET 9x_bitmaps)
|
set(BITMAPS_TARGET 9x_bitmaps)
|
||||||
set(LCD_DRIVER lcd_driver_spi.cpp)
|
set(LCD_DRIVER lcd_driver_spi.cpp)
|
||||||
|
|
|
@ -51,22 +51,26 @@ void bluetoothInit(uint32_t baudrate)
|
||||||
|
|
||||||
RCC_AHB1PeriphClockCmd(BT_RCC_AHB1Periph, ENABLE);
|
RCC_AHB1PeriphClockCmd(BT_RCC_AHB1Periph, ENABLE);
|
||||||
RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART6, ENABLE);
|
RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART6, ENABLE);
|
||||||
|
|
||||||
GPIO_InitStructure.GPIO_Pin = BT_BRTS_GPIO_PIN;
|
GPIO_InitStructure.GPIO_Pin = BT_EN_GPIO_PIN;
|
||||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
|
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
|
||||||
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
|
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
|
||||||
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
|
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
|
||||||
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
|
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
|
||||||
GPIO_Init(BT_BRTS_GPIO, &GPIO_InitStructure);
|
|
||||||
GPIO_SetBits(BT_BRTS_GPIO, BT_BRTS_GPIO_PIN);
|
|
||||||
|
|
||||||
GPIO_InitStructure.GPIO_Pin = BT_EN_GPIO_PIN;
|
|
||||||
GPIO_Init(BT_EN_GPIO, &GPIO_InitStructure);
|
GPIO_Init(BT_EN_GPIO, &GPIO_InitStructure);
|
||||||
|
|
||||||
|
#if defined(BT_BRTS_GPIO_PIN)
|
||||||
|
GPIO_InitStructure.GPIO_Pin = BT_BRTS_GPIO_PIN;
|
||||||
|
GPIO_Init(BT_BRTS_GPIO, &GPIO_InitStructure);
|
||||||
|
GPIO_SetBits(BT_BRTS_GPIO, BT_BRTS_GPIO_PIN);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(BT_BCTS_GPIO_PIN)
|
||||||
GPIO_InitStructure.GPIO_Pin = BT_BCTS_GPIO_PIN;
|
GPIO_InitStructure.GPIO_Pin = BT_BCTS_GPIO_PIN;
|
||||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;
|
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;
|
||||||
GPIO_Init(BT_BCTS_GPIO, &GPIO_InitStructure);
|
GPIO_Init(BT_BCTS_GPIO, &GPIO_InitStructure);
|
||||||
|
#endif
|
||||||
|
|
||||||
GPIO_InitStructure.GPIO_Pin = BT_TX_GPIO_PIN|BT_RX_GPIO_PIN;
|
GPIO_InitStructure.GPIO_Pin = BT_TX_GPIO_PIN|BT_RX_GPIO_PIN;
|
||||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
|
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
|
||||||
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
|
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
|
||||||
|
@ -144,7 +148,9 @@ void bluetoothWriteWakeup(void)
|
||||||
if (bluetoothWriteState == BLUETOOTH_WRITE_IDLE) {
|
if (bluetoothWriteState == BLUETOOTH_WRITE_IDLE) {
|
||||||
if (!btTxFifo.isEmpty()) {
|
if (!btTxFifo.isEmpty()) {
|
||||||
bluetoothWriteState = BLUETOOTH_WRITE_INIT;
|
bluetoothWriteState = BLUETOOTH_WRITE_INIT;
|
||||||
|
#if defined(BT_BRTS_GPIO_PIN)
|
||||||
GPIO_ResetBits(BT_BRTS_GPIO, BT_BRTS_GPIO_PIN);
|
GPIO_ResetBits(BT_BRTS_GPIO, BT_BRTS_GPIO_PIN);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (bluetoothWriteState == BLUETOOTH_WRITE_INIT) {
|
else if (bluetoothWriteState == BLUETOOTH_WRITE_INIT) {
|
||||||
|
@ -153,7 +159,9 @@ void bluetoothWriteWakeup(void)
|
||||||
}
|
}
|
||||||
else if (bluetoothWriteState == BLUETOOTH_WRITE_DONE) {
|
else if (bluetoothWriteState == BLUETOOTH_WRITE_DONE) {
|
||||||
bluetoothWriteState = BLUETOOTH_WRITE_IDLE;
|
bluetoothWriteState = BLUETOOTH_WRITE_IDLE;
|
||||||
|
#if defined(BT_BRTS_GPIO_PIN)
|
||||||
GPIO_SetBits(BT_BRTS_GPIO, BT_BRTS_GPIO_PIN);
|
GPIO_SetBits(BT_BRTS_GPIO, BT_BRTS_GPIO_PIN);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -143,7 +143,7 @@ void boardInit()
|
||||||
hapticInit();
|
hapticInit();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PCBX9E)
|
#if defined(PCBX9E) || defined(PCBX7D)
|
||||||
bluetoothInit(BLUETOOTH_DEFAULT_BAUDRATE);
|
bluetoothInit(BLUETOOTH_DEFAULT_BAUDRATE);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -776,7 +776,7 @@
|
||||||
#define BT_RCC_APB1Periph RCC_APB1Periph_USART3
|
#define BT_RCC_APB1Periph RCC_APB1Periph_USART3
|
||||||
#define BT_EN_GPIO GPIOE
|
#define BT_EN_GPIO GPIOE
|
||||||
#define BT_EN_GPIO_PIN GPIO_Pin_12 // PE.12
|
#define BT_EN_GPIO_PIN GPIO_Pin_12 // PE.12
|
||||||
#define BT_GPIO GPIOB
|
#define BT_GPIO_TXRX GPIOB
|
||||||
#define BT_TX_GPIO_PIN GPIO_Pin_10 // PB.10
|
#define BT_TX_GPIO_PIN GPIO_Pin_10 // PB.10
|
||||||
#define BT_RX_GPIO_PIN GPIO_Pin_11 // PB.11
|
#define BT_RX_GPIO_PIN GPIO_Pin_11 // PB.11
|
||||||
#define BT_TX_GPIO_PinSource GPIO_PinSource10
|
#define BT_TX_GPIO_PinSource GPIO_PinSource10
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue