#include #include #include #include #include "serial.c" //// // Constants //// #define SERIAL_DEVICE "/dev/ttyAMA0" //// // Global variables //// //// // Main function //// int main(void){ int c=0; int sd=serialOpen(SERIAL_DEVICE,SERIAL_BOTH); serialConfig(sd,B9600); if(write(sd,&c,sizeof(char))!=1){ perror("main.write"); exit(-1); } int i; for(i=0;i<8;i++){ if(read(sd,&c,sizeof(char))!=1){ perror("main.read"); exit(-1); } printf("%02x\n",c); } serialClose(sd); exit(0); }