Monitoring du Phytotron
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

t.c 1.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*
  2. * essais de gadgets UI
  3. */
  4. #include <stdio.h>
  5. #include <stdlib.h>
  6. #include <unistd.h>
  7. #include <ncurses.h>
  8. #include "../serial/serial.h"
  9. #include "terminal.h"
  10. int verbosity;
  11. /* ---------------------------------------------------------------- */
  12. void help(int k)
  13. {
  14. puts("options : ");
  15. puts("\t-d\tserial device to read.");
  16. puts("\t-K\tset the K parameter.");
  17. puts("\t-v\tincrease verbosity.");
  18. exit(0);
  19. }
  20. /* ---------------------------------------------------------------- */
  21. int main(int argc, char *argv[])
  22. {
  23. int opt, foo;
  24. int serial_in;
  25. char *device = "/dev/ttyS0";
  26. int K = 0;
  27. // char ligne[100];
  28. while ((opt = getopt(argc, argv, "d:hKv")) != -1) {
  29. switch (opt) {
  30. case 'd': device = optarg; break;
  31. case 'h': help(0); break;
  32. case 'K': K = atoi(optarg); break;
  33. case 'v': verbosity++; break;
  34. default: break;
  35. }
  36. }
  37. printf("\n*** compiled %s %s\n", __DATE__, __TIME__);
  38. printf("*** device: %s\n", device);
  39. serial_in = prepare_UART(device, 9600);
  40. if (serial_in < 0) {
  41. fprintf(stderr, "err open %s : %d\n", device, serial_in);
  42. exit(1);
  43. }
  44. sleep(1);
  45. foo = essai_terminal(serial_in, device, K);
  46. fprintf(stderr, "essai terminal -> %d\n", foo);
  47. return 0;
  48. }
  49. /* ---------------------------------------------------------------- */