File tree Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -54,8 +54,12 @@ Stream *CanHacker::getInterfaceStream() {
5454 return _stream;
5555}
5656
57+ void CanHacker::setClock (uint8_t clock){
58+ canClock = clock;
59+ }
60+
5761CanHacker::ERROR CanHacker::connectCan () {
58- MCP2515::ERROR error = mcp2515->setBitrate (bitrate);
62+ MCP2515::ERROR error = mcp2515->setBitrate (bitrate, canClock );
5963 if (error != MCP2515::ERROR_OK) {
6064 writeDebugStream (F (" setBitrate error:\n " ));
6165 writeDebugStream ((int )error);
Original file line number Diff line number Diff line change @@ -47,6 +47,7 @@ class CanHacker {
4747
4848 CanHacker (Stream *stream, Stream *debugStream, uint8_t cs);
4949 ~CanHacker ();
50+ void setClock (const uint8_t clock);
5051 ERROR receiveCommand (const char *buffer, const int length);
5152 ERROR receiveCanFrame (const struct can_frame *frame);
5253 ERROR sendFrame (const struct can_frame *);
@@ -64,6 +65,7 @@ class CanHacker {
6465 static const char BEL = 7 ;
6566 static const uint16_t TIMESTAMP_LIMIT = 0xEA60 ;
6667
68+ uint8_t canClock = MCP_16MHZ;
6769 bool _timestampEnabled = false ;
6870 bool _listenOnly = false ;
6971 bool _loopback = false ;
You can’t perform that action at this time.
0 commit comments