void biz_uart_set_baud_rate(bsp_uart_t uart, uint32_t baud) { if (uart == BSP_UART_0) { #if BS_UART0_EN huart0.USART_BaudRate = baud; #endif } else if (uart == BSP_UART_1) { #if BS_UART1_EN huart1.USART_BaudRate = baud; #endif } else if (uart == BSP_UART_2...
};// 定义串口缓存区uint8_tbsp_uart1_tx_buff[BS_UART1_CACHE_SIZE] = {0};uint8_tbsp_uart1_rx_buff[BS_UART1_CACHE_SIZE] = {0};// 定义串口初始化标记位 0--未初始化 1--初始化完成boolg_uart1_init =false;// 定义串口发送标记位 0--free闲 1--bus忙boolg_uart1_send_lock =false...
#include<stdio.h>#include<string.h>#include"n32g4fr.h"#include"stdarg.h"#include"bsp_uart.h"#ifBOOT#defineENTER_CRITICAL()#defineEXIT_CRITICAL(VAL)#else#include"sys_cmsis.h"#defineENTER_CRITICAL() sys_enter_critical();#defineEXIT_CRITICAL(VAL) sys_exit_critical(VAL);#endif/***BSP_UA...
static uint8_t bsp_uart2_rx_buf[N32_UART2_BUF_SIZE]; static bsp_uart_recv_cb_t bsp_uart2_recv_cb = NULL; /** * @brief usart init * @param null * @retval null */ void bsp_uart_init(bsp_uart_t uart) { if (uart == BSP_UART0) { memset(bsp_uart0_tx_buf, 0, N32_UA...
if BSP_USING_UART config BSP_USING_UART1 bool "Enable UART1" default y config BSP_UART1_RX_USING_DMAbool "Enable UART1 RX DMA" depends on BSP_USING_UART1 && RT_SERIAL_USING_DMA default n endif menuconfig BSP_USING_SPI bool "Enable SPI BUS" ...
if BSP_USING_UART config BSP_USING_UART0 bool "Enable UART0" default n config BSP_UART0_RX_USING_DMA bool "Enable UART0 RX DMA" depends on BSP_USING_UART0 select RT_SERIAL_USING_DMA default n config BSP_USING_UART1 bool "Enable UART1" ...
运行自带的shell命令hwtimer_sample,该命令会运行5s的定时,查看readme文档 四、总结 1、基础篇包含UART、PIN、SPI/QSPI、HWTIMER、PWM、RTC、ADC、DAC、WDT这些外设,本文以先楫适配的HWTIMER驱动进行说明,能感受到先楫对于rtthread驱动适配的完整性。 2、除了本文阐述的外设,其他基础外设同样适配完整。
其中OEMReadDebugByte, OEMWriteDebugByte, OEMWriteDebugString不用做修改,需要注意的是OEMInitDebugSerial,选UART0,UART1的寄存器配置不一样,若选用UART0,使用配置: s2410IOP->rGPHCON &= ~((3 << 4) | (3 << 6)); s2410IOP->rGPHCON |= ((2 << 4) | (2 << 6)); 而选择UART1,则...
config BSP_UART1_RX_USING_DMA bool "Enable UART1 RX DMA" depends on BSP_USING_UART1 && RT_SERIAL_USING_DMA default n endif menuconfig BSP_USING_SPI bool "Enable SPI BUS" default n select RT_USING_SPI if BSP_USING_SPI config BSP_USING_SPI1 ...
\n");// printf("\r\n");return CL_OK;}int bsw_drv_flash_read ( uint32_t address , ...