Compare commits

..

4 Commits

Author SHA1 Message Date
李天硕 aeec9e4f48 更新 sjq.cpp
lts-test
2023-10-03 11:27:37 +08:00
宋家齐 4c981bcabb 更新 sjqbranch.cpp 2023-10-02 17:05:47 +08:00
宋家齐 e844b7430e update SJQ_branch 2023-10-02 16:56:21 +08:00
宋家齐 3310ff2f27 add SJQ_branch 2023-10-02 16:29:04 +08:00
3 changed files with 20 additions and 45 deletions

View File

@ -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);
}

17
sjq.cpp
View File

@ -1,8 +1,11 @@
//
// Created by SJQ on 2023/10/2.
//
#include <iostream>
int main(){
printf("hello git --sjq");
//
// Created by SJQ on 2023/10/2.
//
#include <iostream>
int main(){
printf("hello git --sjq");
printf("hello git --lts");
printf("this is SJQ branch");
}

10
sjqbranch.cpp Normal file
View File

@ -0,0 +1,10 @@
//
// Created by SJQ on 2023/10/2.
//
#include <iostream>
int main(){
printf("hello git --sjq");
printf("this is SJQ branch");
printf("SPH is the grandfather of SJQ");
}