acan2515
acan2515 copied to clipboard
feature-request: sleepmode and changing filters
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.
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);
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: - a can.end that puts the MCP2515 in configuration mode, and frees the driver transmit and receive buffers; - a can.setMode that puts the MCP2515 in Sleep mode, or Listen-only mode, or Normal Operation mode; - a can.setFilters function first gets the current mode, puts the MCP2515 in the configuration mode, sets the filter, then restores the MCP2515 current mode.
Do you agree ?
Pierre
Le 7 févr. 2019 à 12:52, Flo [email protected] 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.
I would love to have those functions. @thezenox ?