[En-Nut-Discussion] En-Nut-Discussion Digest, Vol 106, Issue 11

Uwe Bonnes bon at elektron.ikp.physik.tu-darmstadt.de
Sat Aug 18 21:01:11 CEST 2012


>>>>> "William" == William Basser <wbasser at gmail.com> writes:

    William> For byte manipulation you could uses a union as follows:
    William> typedef union { u8_t value_u8[4]; u16_t value_u16[2]; u32_t
    William> value_u32; } U32UN;
So you vote for
typedef union {
    uint8_t byte[8];
    uint16_t word[4];
    uint32_t data[2];
    uint64_t long;
} can_payload;

struct _CANFRAME {              // todo: Implement flags
    uint32_t id;                  // Identifier
    can_payload payload;
    uint8_t len;                 // Length of frame, max = 8
    uint8_t ext;                 // Boolean, extendet frame
    uint8_t rtr;                 // Boolean, remote transmition bit
};

instead of

struct _CANFRAME {              // todo: Implement flags
    uint32_t id;                  // Identifier
    uint8_t byte[8];
    uint8_t len;                 // Length of frame, max = 8
    uint8_t ext;                 // Boolean, extendet frame
    uint8_t rtr;                 // Boolean, remote transmition bit
};
?

I also consider this change. Other options? Proposals for better naming?

Bye

-- 
Uwe Bonnes                bon at elektron.ikp.physik.tu-darmstadt.de

Institut fuer Kernphysik  Schlossgartenstrasse 9  64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------


More information about the En-Nut-Discussion mailing list