Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * @brief Receive an amount of data in interrupt mode.
- * @param huart UART handle.
- * @param pData pointer to data buffer.
- * @param Size amount of data to be received.
- * @retval HAL status
- */
- HAL_StatusTypeDef HAL_UART_Receive_IT(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size)
- // Start
- HAL_UART_Receive_IT(&my_uart_handle, my_buf, 1);
- ...
- // Implement the Rx callback
- void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart) {
- // Add the new byte to a circular buffer to be processed by the protocol
- // Register another callback the next time we receive a byte
- HAL_UART_Receive_IT(&my_uart_handle, my_buf, 1);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement