Advertisement
Guest User

Untitled

a guest
Mar 19th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. /**
  2. * @brief Receive an amount of data in interrupt mode.
  3. * @param huart UART handle.
  4. * @param pData pointer to data buffer.
  5. * @param Size amount of data to be received.
  6. * @retval HAL status
  7. */
  8. HAL_StatusTypeDef HAL_UART_Receive_IT(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size)
  9.  
  10. // Start
  11. HAL_UART_Receive_IT(&my_uart_handle, my_buf, 1);
  12.  
  13. ...
  14.  
  15. // Implement the Rx callback
  16. void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart) {
  17. // Add the new byte to a circular buffer to be processed by the protocol
  18.  
  19. // Register another callback the next time we receive a byte
  20. HAL_UART_Receive_IT(&my_uart_handle, my_buf, 1);
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement