日常更新

This commit is contained in:
2024-03-04 22:33:43 +08:00
parent 4cc3fd8864
commit 8c21e784d8
6 changed files with 32 additions and 28 deletions

View File

@@ -21,9 +21,9 @@ enum bt_order {
*/
void jj_bt_init()
{
uart_init(UART_2, 115200, UART2_MAP1_TX_D5, UART2_MAP1_RX_D6);
uart_init(UART_8, 115200, UART8_MAP0_TX_C4, UART8_MAP0_RX_C5);
// uart_tx_interrupt(UART_2, 1);
uart_rx_interrupt(UART_2, ENABLE);
uart_rx_interrupt(UART_8, ENABLE);
}
/**
*@brief 蓝牙中断回调函数
@@ -39,16 +39,16 @@ void jj_bt_run()
bt_run_flag = !bt_run_flag;
break;
case Fly_up:
bt_fly += 10;
bt_fly += 50;
break;
case Fly_dowm:
bt_fly -= 10;
bt_fly -= 50;
break;
case Speed_up:
bt_run += 10;
bt_run += 50;
break;
case Speed_down:
bt_run -= 10;
bt_run -= 50;
break;
default:
break;
@@ -66,8 +66,8 @@ void bt_printf(const char *format, ...)
va_end(args);
for (uint16_t i = 0; i < strlen(sbuf); i++) {
while (USART_GetFlagStatus((USART_TypeDef *)uart_index[UART_2], USART_FLAG_TC) == RESET)
while (USART_GetFlagStatus((USART_TypeDef *)uart_index[UART_8], USART_FLAG_TC) == RESET)
;
USART_SendData((USART_TypeDef *)uart_index[UART_2], sbuf[i]);
USART_SendData((USART_TypeDef *)uart_index[UART_8], sbuf[i]);
}
}