Compare commits
1 Commits
Author | SHA1 | Date |
---|---|---|
LTS | 2002eb2d00 |
|
@ -1,6 +1,3 @@
|
|||
# HFUT-Git-Training
|
||||
|
||||
苍穹竞技机器人队 电控组 Git学习与训练仓库
|
||||
|
||||
训练任务截止时间 2023.10.5
|
||||
每人至少创建一个分支 提交一个自己的源代码文件,修改一个别人的源代码文件
|
||||
LTS test
|
38
bsp_usart.c
38
bsp_usart.c
|
@ -1,38 +0,0 @@
|
|||
#include "bsp_usart.h"
|
||||
#include "main.h"
|
||||
|
||||
extern UART_HandleTypeDef huart1;
|
||||
extern DMA_HandleTypeDef hdma_usart1_tx;
|
||||
void usart1_tx_dma_init(void)
|
||||
{
|
||||
//enable the DMA transfer for the receiver request
|
||||
//使能DMA串口接收
|
||||
SET_BIT(huart1.Instance->CR3, USART_CR3_DMAT);
|
||||
}
|
||||
void usart1_tx_dma_enable(uint8_t *data, uint16_t len)
|
||||
{
|
||||
|
||||
//disable DMA
|
||||
//失效DMA
|
||||
__HAL_DMA_DISABLE(&hdma_usart1_tx);
|
||||
while(hdma_usart1_tx.Instance->CR & DMA_SxCR_EN)
|
||||
{
|
||||
__HAL_DMA_DISABLE(&hdma_usart1_tx);
|
||||
}
|
||||
|
||||
//clear flag
|
||||
//清除标志位
|
||||
__HAL_DMA_CLEAR_FLAG(&hdma_usart1_tx, DMA_HISR_TCIF7);
|
||||
__HAL_DMA_CLEAR_FLAG(&hdma_usart1_tx, DMA_HISR_HTIF7);
|
||||
|
||||
//set data address
|
||||
//设置数据地址
|
||||
hdma_usart1_tx.Instance->M0AR = (uint32_t)(data);
|
||||
//set data length
|
||||
//设置数据长度
|
||||
hdma_usart1_tx.Instance->NDTR = len;
|
||||
|
||||
//enable DMA
|
||||
//使能DMA
|
||||
__HAL_DMA_ENABLE(&hdma_usart1_tx);
|
||||
}
|
|
@ -4,5 +4,5 @@
|
|||
#include <iostream>
|
||||
|
||||
int main(){
|
||||
printf("hello git --sjq");
|
||||
}
|
||||
printf("hello git --lts");
|
||||
}
|
Loading…
Reference in New Issue