CAN: Use uintptr_t for can_irq_ids
The HAL can_api stores an array of IDs in order to dispatch interrupts to the correct CAN object. The drivers level CAN Class casts a pointer to itself to an uint32_t, which is stored as the ID and then cast back to a CAN * in order to call the correct handler. This results in compilation failure when the size of an object pointer is greater than uint32_t, for example when building on a PC for unit testing. In order to allow Unit Testing of the CAN Class, we replace the use of uint32_t with uintptr_t (type capable of holding a pointer), which allows portability and expresses intentions more clearly. In aid of this latter goal, we also replace the use of the name "id" with "context", to improve clarity. These are addresses of the context related to that callback. |
---|
|
drivers/include/drivers/CAN.h |
---|
drivers/source/CAN.cpp |
---|
hal/include/hal/can_api.h |
---|
targets/TARGET_GigaDevice/TARGET_GD32F30X/can_api.c |
---|
targets/TARGET_GigaDevice/TARGET_GD32F4XX/can_api.c |
---|
targets/TARGET_NUVOTON/TARGET_M451/can_api.c |
---|
targets/TARGET_NUVOTON/TARGET_M480/can_api.c |
---|
targets/TARGET_NUVOTON/TARGET_NUC472/can_api.c |
---|
targets/TARGET_NXP/TARGET_LPC176X/can_api.c |
---|
targets/TARGET_RENESAS/TARGET_RZ_A1XX/can_api.c |
---|
targets/TARGET_RENESAS/TARGET_RZ_A2XX/can_api.c |
---|
targets/TARGET_STM/can_api.c |
---|
targets/TARGET_Silicon_Labs/TARGET_EFM32/can_api.c |
---|