Hello All,
In this instance related to CANbus messages, but fundamentally a general C question:
I have only few discrete CAN messages to send/receive, so would like to preset the messageID during init, and send/receive messages based on calling the MBOX number (0..31). How to construct this in a proper-coding way?
I prefer to use 'send message(CAN_ID 0x321)' and not 'send message(MBOX 2)' (and need to check a separate list that links the CANSID to MBOXnumber, with possibility of error).
This has a bit of a table-lookup feel to it, but I don't want to waste cycles and/or memory. So I am trying to find a compile time method. Enum list is a quick option to typecast messageID to the actual MBOX number. But how to use this same list to init the actual enum-listed value into the MSGID register?
Thanks for any ideas!