can_filter_reset()
Description
Removes all previously configured receive filters (masks and IDs) from the given CAN interface. Recommended before installing a new filter set with can_filter_mask_insert, so that filters left over from a previous configuration are not combined with the new ones.
Syntax
can_filter_reset(can_interface);
Parameters
Parameter | Description |
| CAN interface to reset filters on – CAN1 or CAN2. |
Returns
Return value | Return explanation |
SCRIPT_OPERATION_SUCCESS | The operation completed successfully. |
SCRIPT_OPERATION_FAILED | The operation could not be completed (invalid state, hardware error, etc.). |
SCRIPT_NO_ACCESS | The CAN interface has not been initialized (call can_fd_init first). |
SCRIPT_PARAM_INVALID | One or more passed parameters are invalid. |
Function call example
#include <io>
#include <read>
#include <float>
#include <string>
#include <core>
#include <write>
#include <define>
#include <socket>
#include <can>
#define CAN_BUS CAN1
new can_rx_buffer{4096};
main()
{
can_fd_init(CAN_BUS, CAN_CTRL_MODE_NORMAL | CAN_CTRL_MODE_ONE_SHOT | CAN_CTRL_MODE_FD_BRS, 2000, 500000, can_rx_buffer);
can_filter_reset(CAN_BUS);
for(;;)
{
Delay(1000);
}
}