Add CAN_ENFORCE_USE_CALLBACKS in halconf.h Topic is solved

Use this forum for requesting small changes in ChibiOS. Large changes should be discussed in the development forum. This forum is NOT for support.
Post Reply
faisal
Posts: 382
Joined: Wed Jul 19, 2017 12:44 am
Has thanked: 45 times
Been thanked: 62 times

Add CAN_ENFORCE_USE_CALLBACKS in halconf.h

Post by faisal »

Can we get CAN_ENFORCE_USE_CALLBACKS added to halconf.h templates, and have a default configuration option in hal_can.h
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: Add CAN_ENFORCE_USE_CALLBACKS in halconf.h

Post by Giovanni »

Hi,

I modified the option in a proper switch and regenerated all halconf.h files.

Giovanni
faisal
Posts: 382
Joined: Wed Jul 19, 2017 12:44 am
Has thanked: 45 times
Been thanked: 62 times

Re: Add CAN_ENFORCE_USE_CALLBACKS in halconf.h

Post by faisal »

In hal_can_lld.h, it doesn't check the TRUE/FALSE value of the switch. It just checks if it is defined. It should check the value, similar to how CAN_USE_SLEEP_MODE is checked (I'm looking at STM32/LLD/CANv1/hal_can_lld.h).

Also, in hal_can_lld.h it checks sleep mode like this:
#if (CAN_USE_SLEEP_MODE == TRUE) || defined (__DOXYGEN__)

.. and just above that, it checks it like this:
#if CAN_USE_SLEEP_MODE || defined (__DOXYGEN__)

If believe the latter way is more consistent with the rest of the file(s).
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: Add CAN_ENFORCE_USE_CALLBACKS in halconf.h

Post by Giovanni »

Hi,

Fixed, the comparison with the constant is required by the MISRA checker, I am switching to that style gradually in LLDs. High level parts consistently use that already.

Giovanni
Post Reply