global.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /**********************************************************************
  2. Universitaet Ulm
  3. Abteilung Organisation und Management von Informationssystemen
  4. Author: Philipp Hinz
  5. **********************************************************************/
  6. #ifndef _GLOBAL_H_
  7. #define _GLOBAL_H_
  8. #include <pthread.h>
  9. #define SPI_CHANNEL 1 // 0 or 1 on Raspberry Pi
  10. #define SPI_SPEED 200000 // SPI clock speed in Hz
  11. #define LED_RED_PIN 7
  12. #define LED_YELLOW_PIN 3
  13. #define LED_GREEN_PIN 2
  14. #define TIMER_DELAY_US 50000 // Basic timer delay in us
  15. // SQL config
  16. #define SQL_DATABASE "nodes.sqlite"
  17. // Global variables
  18. extern int verbose, optPoll;
  19. extern bool optEcho, optInc, optLom, optTerm, optAdd, optDate, optSuppress;
  20. extern pthread_mutex_t mutex;
  21. // CAN Filter - Should Incoming messages be filtered in Hardware?
  22. // #defining FILTER_USAGE means yes, otherwise no filtering applies
  23. //#define FILTER_USAGE
  24. // If incoming messages are filtered, you have to define the filter properties.
  25. // If a bit n of MASK is set, the respective Message-Identifier-Bit must
  26. // be (equal to Bit n of MATCH0) OR (equal to Bit n of MATCH1).
  27. // Otherwise the message will be discarded.
  28. // Mask & Matches are in the range from 0x000 to 0x7FF.
  29. #define FILTER_MASK 0x0ff
  30. #define FILTER_MATCH0 0x084
  31. #define FILTER_MATCH1 0x094
  32. // Thread IDs
  33. #define THREAD_MAIN 0
  34. #define THREAD_TEST 1
  35. #define THREAD_CAN 2
  36. void killThread(int threadid, int sig);
  37. #endif