| | |
| | | |
| | | #include "mk_io.h" |
| | | #include "board.h" |
| | | |
| | | #include "Usart.h" |
| | | extern struct UART_CFG_T test_uart_cfg; |
| | | extern void uart_receive_callback(void *dev, uint32_t err_code); |
| | | void board_pins_config(void) |
| | | { |
| | | // UART0 TX/RX |
| | | io_pin_mux_set(IO_PIN_5, IO_FUNC4); |
| | | io_pin_mux_set(IO_PIN_6, IO_FUNC4); |
| | | |
| | | // // UART1 RX/TX已修改复用引脚为ADC留出空间调试串口 |
| | | // io_pin_mux_set(IO_PIN_10, IO_FUNC4); |
| | | // io_pin_mux_set(IO_PIN_9, IO_FUNC4); |
| | | // // UART1 TX/RX已修改复用引脚为ADC留出空间调试串口 |
| | | io_pin_mux_set(IO_PIN_1, IO_FUNC4); |
| | | io_pin_mux_set(IO_PIN_14, IO_FUNC4); |
| | | |
| | | //开启pca中断输入 |
| | | io_pin_mux_set(IO_PIN_17, IO_FUNC0); |
| | | // // UART1 RX/TX GPS端口 |
| | | // io_pin_mux_set(IO_PIN_14, IO_FUNC4); |
| | | // io_pin_mux_set(IO_PIN_13, IO_FUNC4); |
| | | |
| | | // //测试 |
| | | // io_pin_mux_set(IO_PIN_14, IO_FUNC0); |
| | | // io_pull_set(IO_PIN_14 , IO_HIGH_Z, IO_PULL_UP_NONE); |
| | | // gpio_pin_set_dir(IO_PIN_14 ,GPIO_DIR_IN, 0); |
| | | // io_pin_mux_set(IO_PIN_13, IO_FUNC0); |
| | | // io_pull_set(IO_PIN_13 , IO_HIGH_Z, IO_PULL_UP_NONE); |
| | | // gpio_pin_set_dir(IO_PIN_13 ,GPIO_DIR_IN, 0); |
| | | |
| | | // UART1 RX/TX GPS端口 |
| | | io_pin_mux_set(IO_PIN_14, IO_FUNC4); |
| | | io_pin_mux_set(IO_PIN_13, IO_FUNC4); |
| | | // Single ADC, If IO0 is set to negative input, the positive input is Vref, and vice versa |
| | | io_pin_mux_set(IO_PIN_0, IO_FUNC1); |
| | | io_pull_set(IO_PIN_0, IO_HIGH_Z, IO_PULL_UP_NONE); |
| | | |
| | | //PA控制引脚开启 |
| | | io_pin_mux_set(IO_PIN_9, IO_FUNC6); |
| | | io_pin_mux_set(IO_PIN_10, IO_FUNC6); |
| | | |
| | | // //5V输入检测,下拉GPIO |
| | | // gpio_pin_set_dir(INPUT_5V_Pin , GPIO_DIR_IN, 0); |
| | | // io_pull_set(INPUT_5V_Pin , IO_HIGH_Z, IO_PULL_UP_NONE); |
| | | } |
| | | void uart1_change_from_gps_to_debug(void) |
| | | void Uart1GpsRecDebugSend(void) |
| | | { |
| | | io_pin_mux_set(IO_PIN_14, IO_FUNC0);//把原先uart变为普通GPIO |
| | | io_pin_mux_set(IO_PIN_13, IO_FUNC0); |
| | | uart_close(UART_ID1);//解绑原来串口1 |
| | | // UART1 RX/TX已修改复用引脚为ADC留出空间调试串口 |
| | | io_pin_mux_set(IO_PIN_10,IO_FUNC4); |
| | | // io_pin_mux_set(IO_PIN_10,IO_FUNC4); |
| | | io_pin_mux_set(IO_PIN_14,IO_FUNC4); |
| | | io_pin_mux_set(IO_PIN_9,IO_FUNC4); |
| | | uart_open(UART_ID1, &test_uart_cfg); |
| | | |
| | | // uart_open(UART_ID1, &test_uart_cfg); |
| | | board_debug_console_open(TRACE_PORT_UART1); |
| | | uart_receive(UART_ID1,m_EUART_DMA_RXBuf,EUART_RX_BUF_SIZE,uart_receive_callback);//开启dma |
| | | } |
| | | void uart1_change_from_gps_to_debug(void) |
| | | { io_pin_mux_set(IO_PIN_1,IO_FUNC4);//恢复发数据 |
| | | board_debug_console_open_baud(TRACE_PORT_UART1,BAUD_115200); |
| | | uart_receive(UART_ID1,m_EUART_DMA_RXBuf,EUART_RX_BUF_SIZE,uart_receive_callback);//开启dma |
| | | } |
| | | void uart1_change_from_debug_to_gps(void) |
| | | { |
| | | io_pin_mux_set(IO_PIN_10,IO_FUNC0);//把原先uart变为普通GPIO |
| | | io_pin_mux_set(IO_PIN_9,IO_FUNC0); |
| | | uart_close(UART_ID1);//解绑原来串口1 |
| | | // UART1 RX/TX GPS端口 |
| | | io_pin_mux_set(IO_PIN_14, IO_FUNC4); |
| | | io_pin_mux_set(IO_PIN_13, IO_FUNC4); |
| | | uart_open(UART_ID1, &test_uart_cfg); |
| | | io_pin_mux_set(IO_PIN_1,IO_FUNC4);//不要给GPS发数据 |
| | | uart_open(UART_ID1, &test_uart_cfg); |
| | | uart_receive(UART_ID1,m_EUART_DMA_RXBuf,EUART_RX_BUF_SIZE,uart_receive_callback);//开启dma |
| | | } |