Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 8 of 8

Thread: Flexcan - what does this line do?

  1. #1
    Member
    Join Date
    Sep 2019
    Location
    UK
    Posts
    22

    Flexcan - what does this line do?

    I'm trying to learn some of the Flexcan features and would like to understand what this line in the global section actually does in laymans terms.

    Code:
    static CAN_message_t msg;
    It is sometimes as above and sometimes ends msg, rxmsg;. What does the extra rxmsg do?

  2. #2
    Senior Member
    Join Date
    Dec 2016
    Location
    Montreal, Canada
    Posts
    3,117
    Receive message, its just a struct with the id, data, etc

  3. #3
    Member
    Join Date
    Sep 2019
    Location
    UK
    Posts
    22
    Thanks, but it's still a little over my head. Can you explain 'struct' to me?

  4. #4
    Senior Member
    Join Date
    Dec 2016
    Location
    Montreal, Canada
    Posts
    3,117
    Its basically like a container that has multiple variables.

    As an example above, these work:

    msg.id;
    msg.buf[0];
    msg.flags.extended,

  5. #5
    Member
    Join Date
    Sep 2019
    Location
    UK
    Posts
    22
    Ok thanks, so presumably if you had inMsg in you struct you'd use inMsg.id; etc.
    Why might you need two containers such as msg, rxmsg then

  6. #6
    Quote Originally Posted by keith-i View Post
    Ok thanks, so presumably if you had inMsg in you struct you'd use inMsg.id; etc.
    Why might you need two containers such as msg, rxmsg then
    msg use in transmit function.

    rxmsg use in receive function.

  7. #7
    Member
    Join Date
    Sep 2019
    Location
    UK
    Posts
    22
    So does it matter what name you use or is it just rxmsg to help recognise it as a receive function. Could you say use txmsg instead of msg?

  8. #8
    Senior Member
    Join Date
    Dec 2016
    Location
    Montreal, Canada
    Posts
    3,117
    Name can be anything you want it to be, like a variable, yeah

    Txmsg is an example to let you know its a transmit message

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •