Subversion Repositories HomeAutomation

Rev

Rev 172 | Rev 174 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | SVN | RSS feed

  1. #ifndef COM_H_
  2. #define COM_H_
  3.  
  4.  
  5. /*-----------------------------------------------------------------------------
  6.  * Includes
  7.  *---------------------------------------------------------------------------*/
  8. #include <inttypes.h>
  9. #include <can.h>
  10.  
  11.  
  12. /*-----------------------------------------------------------------------------
  13.  * Type Definitions
  14.  *---------------------------------------------------------------------------*/
  15. /**
  16.  * Communication Message Type.
  17.  *
  18.  * IDENT:<FUNCT><FUNCC><NID><SID> DATA:<data7>...<data0>
  19.  *
  20.  */
  21. typedef struct {
  22.  
  23.     /*
  24.      * <FUNCT>, 4 bits = Function Type.
  25.      */
  26.     uint8_t Funct   :4;
  27.  
  28.     /*
  29.      * <FUNCC>, 10 bits = Function Code.
  30.      */
  31.     uint16_t Funcc  :10;
  32.  
  33.     /*
  34.      * <NID>, 6 bits = Network ID.
  35.      */
  36.     uint8_t Nid     :6;
  37.  
  38.     /*
  39.      * <SID>, 9 bits = Sender ID.
  40.      */
  41.     uint16_t Sid    :9;
  42.  
  43. } Com_Message_t;
  44.  
  45.  
  46. /*-----------------------------------------------------------------------------
  47.  * Public Function Prototypes
  48.  *---------------------------------------------------------------------------*/
  49. void Com_Init(void);
  50. void Com_Service(void);
  51. void ProtocolParseCanMessage(Can_Message_t *cmsg);
  52.  
  53.  
  54. #endif /*COM_H_*/
  55.