if (HAL_IS_BIT_SET(hcan->Instance->TSR, CAN_TSR_TME2) != SET) { /* Return function status */ return -RT_ERROR; } break; default: RT_ASSERT(0); break; } if (RT_CAN_STDID == pmsg->ide) { txheader.IDE = CAN_ID_STD; RT_ASSERT(IS_CAN_STDID(pmsg->...
/* Disable the UART DMA Rx request if enabled */ if (HAL_IS_BIT_SET(huart->Instance->CR3, USART_CR3_DMAR)) { CLEAR_BIT(huart->Instance->CR3, USART_CR3_DMAR); /* Abort the UART DMA Rx channel */ if (huart->hdmarx != NULL) { /* Set the UART DMA Abort callback : will...
_BIT(hspi->Instance->CR1, SPI_CR1_RCRCINI); } /* 使能33/17 bit CRC计算 */ if (((!IS_SPI_HIGHEND_INSTANCE(hspi->Instance)) && (crc_length == SPI_CRC_LENGTH_16BIT)) || ((IS_SPI_HIGHEND_INSTANCE(hspi->Instance)) && (crc_length == SPI_CRC_LENGTH_32BIT))) { SET_BIT(...
This bit is set by hardware when no transmit request is pending for mailbox 2. Bit 27 TME1: Transmit mailbox 1 empty This bit is set by hardware when no transmit request is pending for mailbox 1. Bit 26 TME0: Transmit mailbox 0 empty This bit is set by hardware when no transmit ...
SET_BIT(QUADSPI ->CR, QUADSPI_CR_EN)。 QSPI_InitTypeDef Init 这个参数是用户接触最多的,在本章节3.2小节已经进行了详细说明。 MDMA_HandleTypeDef *hmdma 用于QSPI句柄关联MDMA句柄,方便操作调用。 其它参数 其它参数基本都是在函数内部调用,用户基本不用管。
{ 13 huart->RxISR = UART_RxISR_16BIT_FIFOEN; /* 字长为9位 */ 14 } 15 else 16 { 17 huart->RxISR = UART_RxISR_8BIT_FIFOEN; /* 字长为7或者8位*/ 18 } 19 __HAL_UNLOCK(huart); 20SET_BIT(huart->Instance->CR1, USART_CR1_PEIE); 21SET_BIT(huart->Instance->CR3, ...
SET_BIT(heth->Instance->MACVIR, ETH_MACVIR_VLTI); /* if inner VLAN is enabled */ if(READ_BIT(pTxConfig->Attributes, ETH_TX_PACKETS_FEATURES_INNERVLANTAG) != 0U) { /* Set inner vlan tag value */ MODIFY_REG(dmatxdesc->DESC2, ETH_DMATXCDESC_IVT, (pTxConfig->InnerVlanTag << ...
SET_BIT(huart->Instance->CR3, USART_CR3_DMAR); return HAL_OK; } else { return HAL_BUSY; } } 看着很长,但是这部分对理解整个过程很关键(重点关注”看这里“)。解释一下这段程序: 函数的参数有三个,简单的说就是:UART的结构体 、接收数据的数组指针、接收数据的多少 ...
= hspi_lcd); pData[0] = data; if (is_cmd) HAL_GPIO_WritePin(LCD_DC_GPIO_Port, LCD_DC_Pin, GPIO_PIN_RESET); else HAL_GPIO_WritePin(LCD_DC_GPIO_Port, LCD_DC_Pin, GPIO_PIN_SET); return HAL_SPI_Transmit(hspi_lcd, pData, 1, HAL_MAX_DELAY); } /*** * * LcdWriteReg *...
/* Configure the interrupt mask */if((GPIO_Init->Mode & GPIO_MODE_IT) == GPIO_MODE_IT){SET_BIT(EXTI->IMR, iocurrent);}else{CLEAR_BIT(EXTI->IMR, iocurrent);}}} 这段代码是用于配置GPIO外部中断的相关设置。让我们逐行分析这段代码的...