-
Notifications
You must be signed in to change notification settings - Fork 15
/
mcp_can_fd.cpp
31 lines (28 loc) · 992 Bytes
/
mcp_can_fd.cpp
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
#include "mcp_can_fd.h"
/*********************************************************************************************************
** Function name: MCP_CAN_1
** Descriptions: Constructor
*********************************************************************************************************/
MCP_CAN_1::MCP_CAN_1(byte _CS)
{
pSPI = &SPI;
init_CS(_CS);
}
/*********************************************************************************************************
** Function name: init_CS
** Descriptions: init CS pin and set UNSELECTED
*********************************************************************************************************/
void MCP_CAN_1::init_CS(byte _CS)
{
if (_CS == 0)
{
return;
}
SPICS = _CS;
pinMode(SPICS, OUTPUT);
digitalWrite(SPICS, HIGH);
}
void MCP_CAN_1::setSPI(SPIClass *_pSPI)
{
pSPI = _pSPI; // define SPI port to use before begin()
}