pierremolinaro / acan2515

MCP2515 CAN Controller Driver for Arduino
MIT License
74 stars 29 forks source link

feature-request: sleepmode and changing filters #6

Open thezenox opened 5 years ago

thezenox commented 5 years ago

nice lib, but I am missing sleep mode and changing filters on the fly. Do you plan to add it?

Bits 5-7 of CANCTRL_REGISTER 000 = Set Normal Operation mode 001 = Set Sleep mode 010 = Set Loopback mode 011 = Set Listen-only mode 100 = Set Configuration mode

Would be nice with bit modifing and readback. Before setting filters, enter configuration mode and change back to normal mode afterwards.

qwec01 commented 5 years ago

HI thezenox To change filters, just change the filters[x].mMask, rxm0, rxm1, and recall "begin", this is what I did. rxm0 = standard2515Mask(***); rxm1 = standard2515Mask(***); filters[x].mMask = standard2515Filter (***); ... errorCode = PRI.begin (settings, [] { PRI.isr (); }, rxm0, rxm1, filters, 6);

pierremolinaro commented 5 years ago

Sorry for the delay for answering.

Changing the filters on the fly can be done only if the MCP2515 is in the configuration mode. It is not documented, but you can call can.begin several times, this function first puts the MCP2515 in the configuration mode, sets the filter, then puts the MCP2515 in normal mode. This is a way for changing filters on the fly.

I can add the following functions:

Do you agree ?

Pierre

Le 7 févr. 2019 à 12:52, Flo notifications@github.com a écrit :

nice lib, but I am missing sleep mode and changing filters on the fly. Do you plan to add it?

Bits 5-7 of CANCTRL_REGISTER 000 = Set Normal Operation mode 001 = Set Sleep mode 010 = Set Loopback mode 011 = Set Listen-only mode 100 = Set Configuration mode

Would be nice with bit modifing and readback. Before setting filters, enter configuration mode and change back to normal mode afterwards.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/pierremolinaro/acan2515/issues/6, or mute the thread https://github.com/notifications/unsubscribe-auth/ASys1MmL67Xth63vVD7v1y53zmgLMJjxks5vLBODgaJpZM4anImk.

ravelab commented 5 years ago

I would love to have those functions. @thezenox ?