本文整理汇总了C++中DMA_GetFlagStatus函数的典型用法代码示例。如果您正苦于以下问题:C++ DMA_GetFlagStatus函数的具体用法?C++ DMA_GetFlagStatus怎么用?C++ DMA_GetFlagStatus使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了DMA_GetFlagStatus函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DMA1_Stream4_IRQHandler
void DMA1_Stream4_IRQHandler(void) {
if(DMA_GetFlagStatus(DMA1_Stream4, DMA_FLAG_TCIF4) == SET) {
interruptDmaI2c_Tx();
DMA_ClearFlag(DMA1_Stream4, DMA_FLAG_TCIF4);
}
return;
}
示例2: DMA1_Stream5_IRQHandler
void DMA1_Stream5_IRQHandler(void) {
if(DMA_GetFlagStatus(DMA1_Stream5, DMA_FLAG_TCIF5) == SET) {
interruptDmaSpi();
DMA_ClearFlag(DMA1_Stream5, DMA_FLAG_TCIF5);
}
return;
}
示例3: WS2812_send2
/* This function sends data bytes out to a string of WS2812s
* The first argument is a pointer to the first RGB triplet to be sent
* The seconds argument is the number of LEDs in the chain
*
* This will result in the RGB triplet passed by argument 1 being sent to
* the LED that is the furthest away from the controller (the point where
* data is injected into the chain)
*/
void WS2812_send2(const uint8_t (*color)[3], const uint16_t _len)
{
int i, j;
uint8_t led;
uint16_t memaddr;
uint16_t buffersize;
uint16_t len = _len;
// Byte order mapping. 0 is red, 1 is green, 2 is blue
const uint8_t pix_map[3] = {0, 2, 1};
buffersize = (len*24); // number of bytes needed is #LEDs * 24 bytes + 42 trailing bytes
memaddr = 0; // reset buffer memory index
led = 0; // reset led index
// fill transmit buffer with correct compare values to achieve
// correct pulse widths according to color values
while (len)
{
for (i = 0; i < 3; i++)
{
for (j = 0; j < 8; j++) // GREEN data
{
if ( (color[led][pix_map[i]]<<j) & 0x80 ) // data sent MSB first, j = 0 is MSB j = 7 is LSB
{
LED_BYTE_Buffer[memaddr] = TIM_COMPARE_LOGIC_1; // compare value for logical 1
}
else
{
LED_BYTE_Buffer[memaddr] = TIM_COMPARE_LOGIC_0; // compare value for logical 0
}
memaddr++;
}
}
led++;
len--;
}
LED_BYTE_Buffer[memaddr++] = 0;
LED_BYTE_Buffer[memaddr++] = 0;
DMA_SetCurrDataCounter(DMA_STREAM, buffersize + 2); // load number of bytes to be transferred
// PAP: Clear the timer's counter and set the compare value to 0. This
// sets the output low on start and gives us a full cycle to set up DMA.
TIM_SetCounter(PWM_TIMER, 0);
TIM_SetCompare1(PWM_TIMER, 0);
TIM_Cmd(PWM_TIMER, ENABLE); // enable Timer 3
// PAP: Start DMA transfer after starting the timer. This prevents the
// DMA/PWM from dropping the first bit.
DMA_Cmd(DMA_STREAM, ENABLE); // enable DMA channel 6
while(!DMA_GetFlagStatus(DMA_STREAM, DMA_TCIF)); // wait until transfer complete
TIM_Cmd(PWM_TIMER, DISABLE); // disable Timer 3
DMA_Cmd(DMA_STREAM, DISABLE); // disable DMA channel 6
DMA_ClearFlag(DMA_STREAM, DMA_TCIF); // clear DMA1 Channel 6 transfer complete flag
}
示例4: DMA1_USART1_SEND
//DMA---USART1传输
void DMA1_USART1_SEND(u32 SendBuff,u16 len)
{
MYDMA_Config(DMA1_Channel4,(u32)&USART1->DR,(u32)SendBuff,len);//DMA1通道4,外设为串口1,存储器为SendBuff,长度len.
USART_DMACmd(USART1, USART_DMAReq_Tx, ENABLE);
MYDMA_Enable(DMA1_Channel4);
while(DMA_GetFlagStatus(DMA1_FLAG_TC4) != SET);
DMA_ClearFlag(DMA1_FLAG_TC4); //清除发送完成标志
}
示例5: DMAx_R1_M2_IRQHandler
/**
* @brief This function handles second motor DMAx TC interrupt request.
* Required only for R1 with rep rate > 1
* @param None
* @retval None
*/
void DMAx_R1_M2_IRQHandler(void)
{
if (DMA_GetFlagStatus(DMAx_R1_M2_Stream,DMAx_R1_M2_Flag) == SET)
{
DMA_ClearFlag(DMAx_R1_M2_Stream,DMAx_R1_M2_Flag);
Exec_IRQ_Handler(MC_IRQ_PWMNCURRFDBK_2,2);
}
}
示例6: ws2811DMAHandler
void ws2811DMAHandler(DMA_Channel_TypeDef *channel)
{
if (DMA_GetFlagStatus(WS2811_DMA_TC_FLAG)) {
ws2811LedDataTransferInProgress = 0;
DMA_Cmd(channel, DISABLE);
DMA_ClearFlag(WS2811_DMA_TC_FLAG);
}
}
示例7: DMA1_Channel3_IRQHandler
void DMA1_Channel3_IRQHandler(void)
{
if (DMA_GetFlagStatus(DMA1_FLAG_TC3)) {
ws2811LedDataTransferInProgress = 0;
DMA_Cmd(DMA1_Channel3, DISABLE); // disable DMA channel 6
DMA_ClearFlag(DMA1_FLAG_TC3); // clear DMA1 Channel 6 transfer complete flag
}
}
示例8: oled_wait_dma
// Waits for DMA transfer to complete
static void oled_wait_dma(void) {
while(!DMA_GetFlagStatus(DMA2_Stream3, DMA_FLAG_TCIF3)) {
if(!DMA2_Stream3->NDTR) break;
}
DMA_ClearITPendingBit(DMA2_Stream3, DMA_IT_TCIF3);
DMA_Cmd(DMA2_Stream3, DISABLE);
SPI_I2S_DMACmd(OLED_SPI, SPI_I2S_DMAReq_Tx, DISABLE);
}
示例9: transponderDMAHandler
void transponderDMAHandler(DMA_Channel_TypeDef *channel)
{
if (DMA_GetFlagStatus(TRANSPONDER_DMA_TC_FLAG)) {
transponderIrDataTransferInProgress = 0;
DMA_Cmd(channel, DISABLE);
DMA_ClearFlag(TRANSPONDER_DMA_TC_FLAG);
}
}
示例10: USART_DMA_send
void USART_DMA_send(USART_TypeDef* USARTx, DMA_Channel_TypeDef* DMAy_Channelx, char *buf, uint8_t len){
//
DMA_InitTypeDef DMA_InitStructure;
// DMA на запись
DMA_DeInit(DMAy_Channelx); //DMA1_Channel4
DMA_InitStructure.DMA_PeripheralBaseAddr = (uint32_t) &(USARTx->DR);
DMA_InitStructure.DMA_MemoryBaseAddr = (uint32_t) buf;
DMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralDST;
DMA_InitStructure.DMA_BufferSize = len;
DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable;
DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Enable;
DMA_InitStructure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_Byte;
DMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_Byte;
DMA_InitStructure.DMA_Mode = DMA_Mode_Normal;
DMA_InitStructure.DMA_Priority = DMA_Priority_Low;
DMA_InitStructure.DMA_M2M = DMA_M2M_Disable;
DMA_Init(DMA1_Channel4, &DMA_InitStructure);
// старт цикла отправки
USART_ClearFlag(USARTx, USART_FLAG_TC | USART_FLAG_TXE);
USART_DMACmd(USARTx, USART_DMAReq_Tx, ENABLE);
DMA_Cmd(DMAy_Channelx, ENABLE);
// wait until transmission complite from dma
if (DMAy_Channelx == DMA1_Channel1) {
while (DMA_GetFlagStatus(DMA1_FLAG_TC1) == RESET) {
}
}
if (DMAy_Channelx == DMA1_Channel2) {
while (DMA_GetFlagStatus(DMA1_FLAG_TC2) == RESET) {
}
}
if (DMAy_Channelx == DMA1_Channel3) {
while (DMA_GetFlagStatus(DMA1_FLAG_TC3) == RESET) {
}
}
if (DMAy_Channelx == DMA1_Channel4) {
while (DMA_GetFlagStatus(DMA1_FLAG_TC4) == RESET) {
}
}
DMA_Cmd(DMAy_Channelx, DISABLE);
USART_DMACmd(USARTx, USART_DMAReq_Tx, DISABLE);
}
示例11:
uint8_t i2cMgr_t::CheckManyWriting() {
// Check if DMA transfer ended
if (DMA_GetFlagStatus(I2C_DMA_FLAG_TC_TX) == SET)
if (I2C_GetFlagStatus(I2C1, I2C_FLAG_BUSY) == RESET)
return I2C_OK;
if (Delay.Elapsed(&Timer, I2C_TIMEOUT_MS)) return I2C_ERR_TIMEOUT;
return I2C_WAITING;
}
示例12: dmaRcvBytes
// READ (done)
int dmaRcvBytes(SPI_TypeDef *SPIx, void *rbuf, unsigned count, int half) {
DMA_InitTypeDef DMA_InitStructure;
uint16_t dummy[] = {0xffff};
DMA_DeInit(DMA1_Channel4);
DMA_DeInit(DMA1_Channel5);
// Common to both channels
DMA_InitStructure.DMA_PeripheralBaseAddr = (uint32_t)(&(SPIx->DR));
DMA_InitStructure.DMA_PeripheralDataSize = (half) ? DMA_PeripheralDataSize_HalfWord : DMA_PeripheralDataSize_Byte;
DMA_InitStructure.DMA_MemoryDataSize = (half) ? DMA_MemoryDataSize_HalfWord : DMA_MemoryDataSize_Byte;
DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable;
DMA_InitStructure.DMA_BufferSize = count;
DMA_InitStructure.DMA_Mode = DMA_Mode_Normal;
DMA_InitStructure.DMA_Priority = DMA_Priority_VeryHigh;
DMA_InitStructure.DMA_M2M = DMA_M2M_Disable;
// Rx Channel
DMA_InitStructure.DMA_MemoryBaseAddr = (uint32_t)rbuf;
DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Enable;
DMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralSRC;
DMA_Init(DMA1_Channel4, &DMA_InitStructure);
// Tx channel
DMA_InitStructure.DMA_MemoryBaseAddr = (uint32_t) dummy;
DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Disable;
DMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralDST;
DMA_Init(DMA1_Channel5, &DMA_InitStructure);
// Enable channels
DMA_Cmd(DMA1_Channel4, ENABLE);
DMA_Cmd(DMA1_Channel5, ENABLE);
// Enable SPI TX/RX request
SPI_I2S_DMACmd(SPIx, SPI_I2S_DMAReq_Rx | SPI_I2S_DMAReq_Tx, ENABLE);
// Wait for completion
while (DMA_GetFlagStatus(DMA1_FLAG_TC4) == RESET);
// Disable channels
DMA_Cmd(DMA1_Channel4, DISABLE);
DMA_Cmd(DMA1_Channel5, DISABLE);
SPI_I2S_DMACmd(SPIx, SPI_I2S_DMAReq_Rx | SPI_I2S_DMAReq_Tx, DISABLE);
return count;
}
示例13: I2C_RX_DMA_IRQ
/*=====================================================================================================*/
void I2C_RX_DMA_IRQ(void)
{
if (DMA_GetFlagStatus(DMAx_RX_STREAM, DMAx_RX_FLAG_TCIF) != RESET) {
I2C_GenerateSTOP(I2Cx, ENABLE);
DMA_Cmd(DMAx_RX_STREAM, DISABLE);
DMA_ClearFlag(DMAx_RX_STREAM, DMAx_RX_FLAG_TCIF);
*I2C_ReadPtr = 0;
}
}
示例14: DMA1_Stream5_IRQHandler
void DMA1_Stream5_IRQHandler (void)
{
if (DMA_GetITStatus(DMA1_Stream5, DMA_IT_TCIF5)
&& DMA_GetFlagStatus(DMA1_Stream5, DMA_FLAG_TCIF5)) {
DMA_ClearITPendingBit(DMA1_Stream5, DMA_IT_TCIF5);
DMA_ClearFlag(DMA1_Stream5, DMA_FLAG_TCIF5);
}
NVIC_ClearPendingIRQ(DMA1_Stream5_IRQn);
}
示例15: halSPI1_Interrupt_RX_Handler
/**
* Функция обработки прерываний RX
*/
void halSPI1_Interrupt_RX_Handler(void)
{
if (DMA_GetFlagStatus(channel, SPI1_MASTER_Rx_DMA_FLAG_TC) == SET)
{
SPI_error = SPI_TRANSFER_COMPLETE;
DMA_ClearFlag (channel, SPI1_MASTER_Rx_DMA_FLAG_TC);
DMA_ClearITPendingBit(channel, SPI1_MASTER_Rx_DMA_FLAG_TC);
halSPI1_SS_off();
}
if (DMA_GetFlagStatus(channel, SPI1_MASTER_Rx_DMA_FLAG_TE) == SET)
{
SPI_error = SPI_TRANSFER_ERROR_FAIL;
DMA_ClearFlag (channel, SPI1_MASTER_Rx_DMA_FLAG_TE);
DMA_ClearITPendingBit(channel, SPI1_MASTER_Rx_DMA_FLAG_TE);
halSPI1_SS_off();
}
}