From 33a728fdc172f59a313cee92da153b37c14c450e Mon Sep 17 00:00:00 2001 From: chen <15335560115@163.com> Date: 星期四, 12 六月 2025 15:25:33 +0800 Subject: [PATCH] 修改sleep引脚版本,并且成功打印log版本 --- pin_config.c | 45 +++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 43 insertions(+), 2 deletions(-) diff --git a/pin_config.c b/pin_config.c index 3b07f6c..653766c 100644 --- a/pin_config.c +++ b/pin_config.c @@ -40,6 +40,22 @@ #include "mk_io.h" #include "board.h" +extern void (*Usart0ParseDataCallback)(uint8_t); +extern void Usart0ParseDataHandler(uint8_t data); +struct UART_CFG_T test_uart_cfg = +{ + .parity = UART_PARITY_NONE, + .stop = UART_STOP_BITS_1, + .data = UART_DATA_BITS_8, + .flow = UART_FLOW_CONTROL_NONE, + .rx_level = UART_RXFIFO_CHAR_1, + .tx_level = UART_TXFIFO_EMPTY, + .baud = BAUD_115200, + .dma_en = true, + .int_rx = false, + .int_tx = false, +}; + void boot_deinit(void) { //将boot中串口返回普通gpio @@ -79,6 +95,15 @@ #else + //增加SPI初始化 + //SPI0/MOSI/MISO/CLK/CS + io_pin_mux_set(LORA_CS, IO_FUNC0); + io_pin_mux_set(LORA_MOSI, IO_FUNC2); + io_pin_mux_set(LORA_MISO, IO_FUNC2); + io_pin_mux_set(LORA_CLK, IO_FUNC2); + io_pin_mux_set(LORA_IRQ, IO_FUNC0); + io_pin_mux_set(LORA_NRST, IO_FUNC0); + //初始化lora引脚 // UART0 TX/RX io_pin_mux_set(IO_PIN_5, IO_FUNC4); io_pin_mux_set(IO_PIN_6, IO_FUNC4); @@ -89,9 +114,12 @@ #if BOARD_TYPE == MK8000_EVK // UART1 RX/TX - io_pin_mux_set(IO_PIN_0, IO_FUNC4); + io_pin_mux_set(IO_PIN_14, IO_FUNC4); io_pin_mux_set(IO_PIN_1, IO_FUNC4); - + +// //PA引脚开启 + io_pin_mux_set(IO_PIN_9, IO_FUNC6); + io_pin_mux_set(IO_PIN_10, IO_FUNC6); #elif BOARD_TYPE == MK8000_DK @@ -102,3 +130,16 @@ #endif #endif } +void Board_LORA_NVIC_Init(GPIO_IRQ_HANDLER_T irq_handler) //LORA 中断配置 +{ +// io_pin_mux_set(_4G_USART_RX_Pin,IO_FUNC0);//把原先io 变为普通GPIO + gpio_pin_set_dir(LORA_IRQ , GPIO_DIR_IN, 0); + io_pull_set(LORA_IRQ, IO_HIGH_Z, IO_PULL_UP_NONE); + gpio_enable_irq(LORA_IRQ, GPIO_IRQ_TYPE_RISING_EDGE, irq_handler); +} +void uart0_Init_normal(void) +{ + Usart0ParseDataCallback = Usart0ParseDataHandler;//确认与蓝牙串口0处理回调 + uart_open(UART_ID0, &test_uart_cfg); + +} \ No newline at end of file -- Gitblit v1.9.3