Created
October 4, 2013 18:38
-
-
Save dagon666/6830590 to your computer and use it in GitHub Desktop.
libpca echo program
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
| #include "pca.h" | |
| int main(int argc, char const *argv[]) | |
| { | |
| uint8_t c = 0x00; | |
| serial_init(E_BAUD_57600); | |
| serial_install_interrupts(E_FLAGS_SERIAL_RX_INTERRUPT); | |
| serial_flush(); | |
| while (1) { | |
| // this call is not blocking it will exit immediately if there is no character available | |
| if (!serial_getc(&c)) | |
| continue; | |
| /* char received */ | |
| // send the character back. This call is blocking - it will block until the UART is ready to send | |
| serial_poll_sendc(c); | |
| } | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment