i32 result;
result = getCanMask(&a_mask); // The setting of the mask is put at
// a_mask.mask
if( result != 0)
printf(“Fail to get mask!\n”);
7. Syntax:
i32 setCanMask(struct CanMask mask)
Description: This function sets the bit patterns to the indicated mask. The target mask is indicated
by the ‘maskId’ field in a CanMask variable.
Parameters: This functions takes a variable of type ‘CanMask’. User set the bit patterns they want
to the ‘mask’ field in a ‘CanMask’ variable.
struct CanMask {
u8 maskId; // 0 or 1
u32 mask;
}
For example:
struct CanMask varMask;
i32 result;
varMask.maskId = 1;
varMask.mask = 0x12345678;
result = setCanMask(varMask);
Return Value: If this function sets the mask setting successfully, it returns 0, any other returned
value stands for error.
8. Syntax:
i32 getCanFilter(struct CanFilter *varFilter)
Description: This function gets the current setting of the acceptance filter. Use the ‘filterId’ field in a
‘CanFilter’ variable to indicate the filter you want and the API puts the setting of the indicated filter
in the ‘filter’ field in the CanFilter variable ‘varFilter’.
Parameters: This function takes a pointer to a ‘CanFilter’ type variable.
50