Skip to content

Instantly share code, notes, and snippets.

@dagon666
Created October 4, 2013 18:38
Show Gist options
  • Save dagon666/6830590 to your computer and use it in GitHub Desktop.
Save dagon666/6830590 to your computer and use it in GitHub Desktop.
libpca echo program
#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