|
|
@ -22,7 +22,7 @@ int length = 0; |
|
|
|
|
|
|
|
void motor_drive_hex_to_str(char *hex, int hex_len, char *str); |
|
|
|
|
|
|
|
void ble_uart_init(uart_port_t uart_num, int tx_io_num, int rx_io_num) |
|
|
|
void pc_uart_init(uart_port_t uart_num, int tx_io_num, int rx_io_num) |
|
|
|
{ |
|
|
|
uart_config_t uart_config = { |
|
|
|
.baud_rate = 115200, |
|
|
@ -39,7 +39,7 @@ void ble_uart_init(uart_port_t uart_num, int tx_io_num, int rx_io_num) |
|
|
|
ESP_ERROR_CHECK(uart_set_pin(uart_num, tx_io_num, rx_io_num, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE)); |
|
|
|
} |
|
|
|
|
|
|
|
void ble_receive(uart_port_t uart_num) |
|
|
|
void pc_uart_receive(uart_port_t uart_num) |
|
|
|
{ |
|
|
|
ESP_ERROR_CHECK(uart_get_buffered_data_len(uart_num, (size_t *)&length)); |
|
|
|
if (length != 0) |
|
|
@ -56,12 +56,12 @@ void app_main(void) |
|
|
|
key_init(); |
|
|
|
key_ble_send_cmd_reg(ble_key_cb); |
|
|
|
|
|
|
|
ble_uart_init(UART_NUM_2, 18, 23); |
|
|
|
pc_uart_init(UART_NUM_2, 18, 23); |
|
|
|
|
|
|
|
while (true) |
|
|
|
{ |
|
|
|
key_schedule(); |
|
|
|
ble_receive(UART_NUM_2); |
|
|
|
pc_uart_receive(UART_NUM_2); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|