Subversion Repositories HomeAutomation

Rev

Rev 73 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed

Rev 73 Rev 127
Line 17... Line 17...
17
typedef enum {
17
typedef enum {
18
    CAN_BITRATE_125K = 0,
18
    CAN_BITRATE_125K = 0,
19
    CAN_BITRATE_250K = 1,
19
    CAN_BITRATE_250K = 1,
20
    CAN_BITRATE_500K = 2,
20
    CAN_BITRATE_500K = 2,
21
    CAN_BITRATE_1M = 3
21
    CAN_BITRATE_1M = 3
22
} CanBitrate_t;
22
} Can_Bitrate_t;
23
 
23
 
24
/**
24
/**
25
 * CAN Return Type. Most CAN functions return one of these.
25
 * CAN Return Type. Most CAN functions return one of these.
26
 */
26
 */
27
typedef enum {
27
typedef enum {
Line 30... Line 30...
30
    CAN_FAILTX = 2,
30
    CAN_FAILTX = 2,
31
    CAN_MSGAVAIL = 3,
31
    CAN_MSGAVAIL = 3,
32
    CAN_NOMSG = 4,
32
    CAN_NOMSG = 4,
33
    CAN_CTRLERROR = 5,
33
    CAN_CTRLERROR = 5,
34
    CAN_FAIL = 0xFF
34
    CAN_FAIL = 0xFF
35
} CanReturn_t;
35
} Can_Return_t;
36
 
36
 
37
/**
37
/**
38
 * CAN Message Type. Stores a complete CAN frame.
38
 * CAN Message Type. Stores a complete CAN frame.
39
 */
39
 */
40
typedef struct {
40
typedef struct {
Line 69... Line 69...
69
        uint16_t words[4];
69
        uint16_t words[4];
70
       
70
       
71
        /* read as 32bit unsigned data */
71
        /* read as 32bit unsigned data */
72
        uint32_t dwords[2];
72
        uint32_t dwords[2];
73
    } Data;
73
    } Data;
74
} CanMessage_t;
74
} Can_Message_t;
75
 
75
 
76
 
76
 
77
/*-----------------------------------------------------------------------------
77
/*-----------------------------------------------------------------------------
78
 * Public Function Prototypes
78
 * Public Function Prototypes
79
 *---------------------------------------------------------------------------*/
79
 *---------------------------------------------------------------------------*/
80
 
80
 
81
CanReturn_t CanInit(CanBitrate_t bitrate);
81
Can_Return_t Can_Init(void);
82
void can_initMessageStruct(CanMessage_t* msg);
-
 
83
CanReturn_t CanSend(CanMessage_t* msg);
82
Can_Return_t Can_Send(Can_Message_t* msg);
84
CanReturn_t CanReceiveAvailable(void);
83
Can_Return_t Can_ReceiveAvailable(void);
85
CanReturn_t CanReceive(CanMessage_t *msg);
84
Can_Return_t Can_Receive(Can_Message_t *msg);
86
CanReturn_t CanCheckError(void);
85
Can_Return_t Can_CheckError(void);
87
 
86
 
88
#if (CANDEBUG)
87
#if (CANDEBUG)
89
void can_debug1(void);
88
void can_debug1(void);
90
void can_dumpMessage(CanMessage *msg);
89
void can_dumpMessage(CanMessage *msg);
91
uint8_t can_testTransmit(const uint8_t ext, const uint8_t data2);
90
uint8_t can_testTransmit(const uint8_t ext, const uint8_t data2);