1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-15 04:15:26 +03:00

[X7D] Rotary encoder initialization

This commit is contained in:
Bertrand Songis 2016-10-20 18:54:51 +02:00
parent d2f688c7d9
commit 71bb6de3dd
5 changed files with 22 additions and 10 deletions

View file

@ -902,7 +902,7 @@ PACK(struct TrainerData {
char switchNames[NUM_SWITCHES][LEN_SWITCH_NAME]; \
char anaNames[NUM_STICKS+NUM_POTS+NUM_SLIDERS][LEN_ANA_NAME];
#elif defined(PCBTARANIS)
#if defined(PCBX9E)
#if defined(PCBX9E) || defined(PCBX7D)
#define BLUETOOTH_FIELDS \
uint8_t bluetoothEnable; \
char bluetoothName[LEN_BLUETOOTH_NAME];

View file

@ -59,6 +59,10 @@ elseif(PCB STREQUAL X7D)
set(FLAVOUR x7d)
add_definitions(-DPCBX7D -DSOFTWARE_VOLUME)
add_definitions(-DEEPROM_VARIANT=0)
set(FIRMWARE_TARGET_SRC
${FIRMWARE_TARGET_SRC}
bluetooth_driver.cpp
)
set(GUI_DIR 128x64)
set(BITMAPS_TARGET 9x_bitmaps)
set(LCD_DRIVER lcd_driver_spi.cpp)

View file

@ -52,20 +52,24 @@ void bluetoothInit(uint32_t baudrate)
RCC_AHB1PeriphClockCmd(BT_RCC_AHB1Periph, 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_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
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);
#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_Mode = GPIO_Mode_IN;
GPIO_Init(BT_BCTS_GPIO, &GPIO_InitStructure);
#endif
GPIO_InitStructure.GPIO_Pin = BT_TX_GPIO_PIN|BT_RX_GPIO_PIN;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
@ -144,7 +148,9 @@ void bluetoothWriteWakeup(void)
if (bluetoothWriteState == BLUETOOTH_WRITE_IDLE) {
if (!btTxFifo.isEmpty()) {
bluetoothWriteState = BLUETOOTH_WRITE_INIT;
#if defined(BT_BRTS_GPIO_PIN)
GPIO_ResetBits(BT_BRTS_GPIO, BT_BRTS_GPIO_PIN);
#endif
}
}
else if (bluetoothWriteState == BLUETOOTH_WRITE_INIT) {
@ -153,7 +159,9 @@ void bluetoothWriteWakeup(void)
}
else if (bluetoothWriteState == BLUETOOTH_WRITE_DONE) {
bluetoothWriteState = BLUETOOTH_WRITE_IDLE;
#if defined(BT_BRTS_GPIO_PIN)
GPIO_SetBits(BT_BRTS_GPIO, BT_BRTS_GPIO_PIN);
#endif
}
}

View file

@ -143,7 +143,7 @@ void boardInit()
hapticInit();
#endif
#if defined(PCBX9E)
#if defined(PCBX9E) || defined(PCBX7D)
bluetoothInit(BLUETOOTH_DEFAULT_BAUDRATE);
#endif

View file

@ -776,7 +776,7 @@
#define BT_RCC_APB1Periph RCC_APB1Periph_USART3
#define BT_EN_GPIO GPIOE
#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_RX_GPIO_PIN GPIO_Pin_11 // PB.11
#define BT_TX_GPIO_PinSource GPIO_PinSource10