File tree Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -12,11 +12,12 @@ const struct MCP2515::RXBn_REGS MCP2515::RXB[N_RXBUFFERS] = {
1212 {MCP_RXB1CTRL, MCP_RXB1SIDH, MCP_RXB1DATA, CANINTF_RX1IF}
1313};
1414
15- MCP2515::MCP2515 (const uint8_t _CS)
15+ MCP2515::MCP2515 (const uint8_t _CS, const uint32_t _SPI_CLOCK )
1616{
1717 SPI.begin ();
1818
1919 SPICS = _CS;
20+ SPI_CLOCK = _SPI_CLOCK;
2021 pinMode (SPICS, OUTPUT);
2122 endSPI ();
2223}
Original file line number Diff line number Diff line change @@ -424,7 +424,7 @@ class MCP2515
424424 MCP_RXB1DATA = 0x76
425425 };
426426
427- static const uint32_t SPI_CLOCK = 10000000 ; // 10MHz
427+ static const uint32_t DEFAULT_SPI_CLOCK = 10000000 ; // 10MHz
428428
429429 static const int N_TXBUFFERS = 3 ;
430430 static const int N_RXBUFFERS = 2 ;
@@ -443,6 +443,7 @@ class MCP2515
443443 } RXB[N_RXBUFFERS];
444444
445445 uint8_t SPICS;
446+ uint32_t SPI_CLOCK;
446447
447448 private:
448449
@@ -460,7 +461,7 @@ class MCP2515
460461 void prepareId (uint8_t *buffer, const bool ext, const uint32_t id);
461462
462463 public:
463- MCP2515 (const uint8_t _CS);
464+ MCP2515 (const uint8_t _CS, const uint32_t _SPI_CLOCK = DEFAULT_SPI_CLOCK );
464465 ERROR reset (void );
465466 ERROR setConfigMode ();
466467 ERROR setListenOnlyMode ();
You can’t perform that action at this time.
0 commit comments