Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
fterretf committed Jun 7, 2023
1 parent 4f50e9e commit c43df38
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 18 deletions.
4 changes: 2 additions & 2 deletions src/ACAN2517FD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ static uint16_t u16FromBufferAtIndex (uint8_t ioBuffer [], const uint8_t inIndex

//----------------------------------------------------------------------------------------------------------------------

ACAN2517FD::ACAN2517FD (const CanCmn::eCanBusId busId,
ACAN2517FD::ACAN2517FD (const CanCmn::eCanBusFdId busId,
const uint8_t inCS, // CS input of MCP2517FD
SPIClass & inSPI, // Hardware SPI object
const uint8_t inINT) : // INT output of MCP2517FD
Expand Down Expand Up @@ -351,7 +351,7 @@ uint32_t ACAN2517FD::begin (const ACAN2517FDSettings & inSettings,
}
}
//----------------------------------- Set full speed clock
mSPISettings = SPISettings (inSettings.sysClock () / 2, MSBFIRST, SPI_MODE0) ;
mSPISettings = SPISettings (8000UL*1000, MSBFIRST, SPI_MODE0) ;
//----------------------------------- Checking SPI connection is on (with a full speed clock)
// We write and read back 2517 RAM at address 0x400
for (uint32_t i=1 ; (i != 0) && (errorCode == 0) ; i <<= 1) {
Expand Down
20 changes: 4 additions & 16 deletions src/ACAN2517FD.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class ACAN2517FD {
// CONSTRUCTOR
//······················································································································

public: ACAN2517FD (const CanCmn::eCanBusId busId,
public: ACAN2517FD (const CanCmn::eCanBusFdId busId,
const uint8_t inCS, // CS input of MCP2517FD
SPIClass & inSPI, // Hardware SPI object
const uint8_t inINT) ; // INT output of MCP2517FD
Expand Down Expand Up @@ -137,7 +137,7 @@ class ACAN2517FD {
#endif
private: SPISettings mSPISettings ;
private: SPIClass & mSPI ;
private: CanCmn::eCanBusId mBusId;
private: CanCmn::eCanBusFdId mBusId;
private: const uint8_t mCS ;
private: const uint8_t mINT ;
private: bool mUsesTXQ ;
Expand Down Expand Up @@ -308,13 +308,7 @@ class ACAN2517FD {
}
private: inline void assertCS() {
switch (mBusId) {
case CanCmn::eCanBusId::eCan0:
digitalWrite(mCS, LOW);
break;
case CanCmn::eCanBusId::eCan1:
_Mux.can1Cs();
break;
case CanCmn::eCanBusId::eCan2:
case CanCmn::eCanBusFdId::eCanFd2:
_Mux.can2Cs();
break;

Expand All @@ -324,13 +318,7 @@ class ACAN2517FD {
}
private: inline void deassertCS() {
switch (mBusId) {
case CanCmn::eCanBusId::eCan0:
digitalWrite(mCS, HIGH);
break;
case CanCmn::eCanBusId::eCan1:
_Mux.can1UnCs();
break;
case CanCmn::eCanBusId::eCan2:
case CanCmn::eCanBusFdId::eCanFd2:
_Mux.can2UnCs();
break;
default:
Expand Down

0 comments on commit c43df38

Please sign in to comment.