Created
May 3, 2018 09:11
-
-
Save ctmakro/987671dcece6edbee97ecf2af0bb84aa to your computer and use it in GitHub Desktop.
_kbhit() equivalent (peek UART buffer before getchar() or scanf()) on Xilinx Zynq Baremetal.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// return true if there is character in uart recv buffer, false otherwise. | |
int peek(){ | |
#include <xuartps_hw.h> | |
#include <xparameters.h> | |
return XUartPs_IsReceiveData(XPAR_PS7_UART_0_BASEADDR); | |
} | |
// it is recommended to use inbyte() to read a byte after peek() returned true. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment