38 lines
498 B
C
38 lines
498 B
C
|
|
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <time.h>
|
|
|
|
#include "serial.h"
|
|
|
|
int verbosity;
|
|
|
|
int main (int argc, char *argv[])
|
|
{
|
|
int serial_in;
|
|
int byte;
|
|
|
|
serial_in = prepare_UART("/dev/ttyACM0", 9600);
|
|
fprintf(stderr, "prepare uart -> %d\n", serial_in);
|
|
|
|
if (serial_in < 0) {
|
|
exit(1);
|
|
}
|
|
|
|
for (;;) {
|
|
|
|
byte = getbyte(serial_in);
|
|
|
|
if (byte < 0) {
|
|
fprintf(stderr, "get byte : err is %d\n", byte);
|
|
}
|
|
else {
|
|
printf("%9ld %02x/%d\n",
|
|
time(NULL), byte, byte);
|
|
}
|
|
}
|
|
|
|
return 0;
|
|
}
|