示例#1
0
void dma_usart2_nputs(const char* pString, int stringSize){
	DMA_Cmd(DMA1_Channel7, DISABLE);
	DMA_ClearFlag(DMA1_FLAG_TC7);
	DMA1_Channel7->CMAR =(uint32_t) pString;
	DMA_SetCurrDataCounter(DMA1_Channel7, stringSize);

	USART_ClearFlag(USART2, USART_FLAG_TC);
	DMA_ClearFlag(DMA1_FLAG_TC7);
	dma_usart2_tx_complete = 0;

	dma_usart2_irq_enable();
	DMA_Cmd(DMA1_Channel7,ENABLE);
}
void dma_usart2_nputs(const char* pString, int stringSize, void (*tx_complete_callback)(void)){
	DMA_Cmd(DMA1_Channel4, DISABLE);
	DMA_ClearFlag(DMA1_FLAG_TC4);
	DMA1_Channel4->CMAR =(uint32_t) pString;
	DMA_SetCurrDataCounter(DMA1_Channel4, stringSize);

	USART_ClearFlag(USART2, USART_FLAG_TC);
	DMA_ClearFlag(DMA1_FLAG_TC4);
	dma_usart2_tx_callback = tx_complete_callback;
	dma_usart2_tx_complete = 0;

	dma_usart2_irq_enable();
	DMA_Cmd(DMA1_Channel4,ENABLE);
}