forked from eziya/STM32_SPI_MCP2515
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CANSPI.h
35 lines (30 loc) · 743 Bytes
/
CANSPI.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#ifndef __CAN_SPI_H
#define __CAN_SPI_H
#include "stm32f1xx_hal.h"
typedef union {
struct {
uint8_t idType;
uint32_t id;
uint8_t dlc;
uint8_t data0;
uint8_t data1;
uint8_t data2;
uint8_t data3;
uint8_t data4;
uint8_t data5;
uint8_t data6;
uint8_t data7;
} frame;
uint8_t array[14];
} uCAN_MSG;
#define dSTANDARD_CAN_MSG_ID_2_0B 1
#define dEXTENDED_CAN_MSG_ID_2_0B 2
bool CANSPI_Initialize(void);
void CANSPI_Sleep(void);
uint8_t CANSPI_Transmit(uCAN_MSG *tempCanMsg);
uint8_t CANSPI_Receive(uCAN_MSG *tempCanMsg);
uint8_t CANSPI_messagesInBuffer(void);
uint8_t CANSPI_isBussOff(void);
uint8_t CANSPI_isRxErrorPassive(void);
uint8_t CANSPI_isTxErrorPassive(void);
#endif /* __CAN_SPI_H */