can_config.h 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. #ifndef CAN_CONFIG_H
  2. #define CAN_CONFIG_H
  3. // -----------------------------------------------------------------------------
  4. /* Global settings for building the can-lib and application program.
  5. *
  6. * The following two #defines must be set identically for the can-lib and
  7. * your application program. They control the underlying CAN struct. If the
  8. * settings disagree, the underlying CAN struct will be broken, with
  9. * unpredictable results.
  10. * If can.h detects that any of the #defines is not defined, it will set them
  11. * to the default values shown here, so it is in your own interest to have a
  12. * consistent setting. Ommiting the #defines in both can-lib and application
  13. * program will apply the defaults in a consistent way too.
  14. *
  15. * Select if you want to use 29 bit identifiers.
  16. */
  17. #define SUPPORT_EXTENDED_CANID 1
  18. /* Select if you want to use timestamps.
  19. * Timestamps are sourced from a register internal to the AT90CAN.
  20. * Selecting them on any other controller will have no effect, they will
  21. * be 0 all the time.
  22. */
  23. #define SUPPORT_TIMESTAMPS 0
  24. // -----------------------------------------------------------------------------
  25. /* Global settings for building the can-lib.
  26. *
  27. * Select ONE CAN controller for which you are building the can-lib.
  28. */
  29. #define SUPPORT_MCP2515 0
  30. #define SUPPORT_AT90CAN 1
  31. #define SUPPORT_SJA1000 0
  32. // -----------------------------------------------------------------------------
  33. /* Setting for MCP2515
  34. *
  35. * Declare which pins you are using for communication.
  36. * Remember NOT to use them in your application!
  37. * It is a good idea to use bits from the port that carries MOSI, MISO, SCK.
  38. */
  39. #define MCP2515_CS B, 4
  40. #define MCP2515_INT B, 2
  41. // -----------------------------------------------------------------------------
  42. // Setting for SJA1000
  43. #define SJA1000_INT E, 0
  44. #define SJA1000_MEMORY_MAPPED 1
  45. // memory-mapped interface
  46. #define SJA1000_BASE_ADDR 0x8000 // for ATMega162
  47. /*
  48. // port-interface
  49. #define SJA1000_WR D,6
  50. #define SJA1000_RD D,7
  51. #define SJA1000_ALE E,1
  52. #define SJA1000_CS C,0
  53. #define SJA1000_DATA A
  54. */
  55. // -----------------------------------------------------------------------------
  56. // Setting for AT90CAN
  57. // Number of CAN messages which are buffered in RAM additinally to the MObs
  58. #define CAN_RX_BUFFER_SIZE 16
  59. #define CAN_TX_BUFFER_SIZE 8
  60. // only available if CAN_TX_BUFFER_SIZE > 0
  61. #define CAN_FORCE_TX_ORDER 1
  62. #endif // CAN_CONFIG_H