Subversion Repositories HomeAutomation

Rev

Blame | Last modification | View Log | SVN | RSS feed

  1. /**
  2.  * @defgroup avrinternal avr internal Library
  3.  * @code #include <drivers/can/avr_internal/avr_internal.h> @endcode
  4.  *
  5.  * @brief Functions for can controller communication.
  6.  * Exposes functions for initialization of controller and sending a message.
  7.  * For receiving messages, an interrupt callback must be set up at the user of
  8.  * this driver.
  9.  *
  10.  *
  11.  * @author  Jimmy Myhrman, Andreas Fritiofson, Anders Sandblad
  12.  * @date    2005-01-01
  13.  */
  14.  
  15. /**@{*/
  16.  
  17. #ifndef AVRINTERNAL_H_
  18. #define AVRINTERNAL_H_
  19.  
  20. #include <drivers/can/can.h>
  21.  
  22. /**
  23.  * @brief Initialize CAN.
  24.  * Initializes CAN interface and the mcp2515 can controller
  25.  *
  26.  * @return
  27.  *      CAN_OK if initialization was successful.
  28.  *      CAN_INIT_FAIL in case of general error.
  29.  */
  30. Can_Return_t Can_Init(void);
  31.  
  32. /**
  33.  * @brief Send a CAN message.
  34.  * Sends a CAN message immediately with the controller hardware. If the CAN
  35.  * controller is busy, the function will return CAN_FAIL.
  36.  *
  37.  * @param msg
  38.  *      Pointer to the CAN message storage buffer.
  39.  *
  40.  * @return
  41.  *      CAN_OK if the message was successfully sent to the controller.
  42.  *      CAN_FAIL if the controller is busy.
  43.  */
  44. Can_Return_t Can_Send(Can_Message_t* msg);
  45.  
  46. /**
  47.  * @brief Callback from driver interrupt service routine.
  48.  * Users of mcp2515 drivers must implement this function to receive
  49.  * CAN messages.
  50.  *
  51.  * @param msg
  52.  *      Pointer to the CAN message storage buffer.
  53.  */
  54. #if MCP_CAN_PROCESS_RENAMED == 1
  55. void Can_Process_USART(Can_Message_t* msg);
  56. #else
  57. void Can_Process(Can_Message_t* msg);
  58. #endif
  59.  
  60. /**@}*/
  61. #endif
  62.