/************************************************************************************************** * @fn Hal_UART_RxBufLen() * * @brief Calculate Rx Buffer length - the number of bytes in the buffer. * * @param port - UART port * * @return length of current Rx Buffer **************************************************************************************************/ uint16 Hal_UART_RxBufLen( uint8 port ) { #if (HAL_UART_DMA == 1) if (port == HAL_UART_PORT_0) return HalUARTRxAvailDMA(); #endif #if (HAL_UART_DMA == 2) if (port == HAL_UART_PORT_1) return HalUARTRxAvailDMA(); #endif #if (HAL_UART_ISR == 1) if (port == HAL_UART_PORT_0) return HalUARTRxAvailISR(); #endif #if (HAL_UART_ISR == 2) if (port == HAL_UART_PORT_1) return HalUARTRxAvailISR(); #endif #if (HAL_UART_SPI == 1) if (port == HAL_UART_PORT_0) return HalUARTRxAvailSPI(); #endif #if (HAL_UART_SPI == 2) if (port == HAL_UART_PORT_1) return HalUARTRxAvailSPI(); #endif #if HAL_UART_USB return HalUARTRxAvailUSB(); #else #if (HAL_UART_DMA == 0) && (HAL_UART_ISR == 0) && (HAL_UART_SPI == 0) // UART is not enabled. Do nothing. (void) port; // unused argument #endif return 0; #endif }
/************************************************************************************************* * @fn Hal_UART_RxBufLen() * * @brief Calculate Rx Buffer length of a port * * @param port - UART port (not used.) * * @return length of current Rx Buffer *************************************************************************************************/ uint16 Hal_UART_RxBufLen (uint8 port) { #if HAL_UART_USB return HalUARTRxAvailUSB(); #else return (Hal_UART_RxBufLenIsr(port)); #endif }
/************************************************************************************************** * @fn Hal_UART_RxBufLen() * * @brief Calculate Rx Buffer length - the number of bytes in the buffer. * * @param port - UART port * * @return length of current Rx Buffer **************************************************************************************************/ uint16 Hal_UART_RxBufLen( uint8 port ) { (void)port; #if (HAL_UART_DMA == 1) if (port == HAL_UART_PORT_0) return HalUARTRxAvailDMA(); #endif #if (HAL_UART_DMA == 2) if (port == HAL_UART_PORT_1) return HalUARTRxAvailDMA(); #endif #if (HAL_UART_ISR == 1) if (port == HAL_UART_PORT_0) return HalUARTRxAvailISR(); #endif #if (HAL_UART_ISR == 2) if (port == HAL_UART_PORT_1) return HalUARTRxAvailISR(); #endif #if HAL_UART_USB return HalUARTRxAvailUSB(); #else return 0; #endif }