Skip to content

Add bit definitions to Fw #5421

Description

@timcanham
F´ Version 4.x
Affected Component n/a

Feature Description

Define bitfields in Fw/Types

namespace Fw {

static constexpr U32 BIT00 = (1 << 0);
static constexpr U32 BIT01 = (1 << 1);
static constexpr U32 BIT02 = (1 << 2);
static constexpr U32 BIT03 = (1 << 3);
static constexpr U32 BIT04 = (1 << 4);
static constexpr U32 BIT05 = (1 << 5);
static constexpr U32 BIT06 = (1 << 6);
static constexpr U32 BIT07 = (1 << 7);
static constexpr U32 BIT08 = (1 << 8);
static constexpr U32 BIT09 = (1 << 9);
static constexpr U32 BIT10 = (1 << 10);
static constexpr U32 BIT11 = (1 << 11);
static constexpr U32 BIT12 = (1 << 12);
static constexpr U32 BIT13 = (1 << 13);
static constexpr U32 BIT14 = (1 << 14);
static constexpr U32 BIT15 = (1 << 15);
static constexpr U32 BIT16 = (1 << 16);
static constexpr U32 BIT17 = (1 << 17);
static constexpr U32 BIT18 = (1 << 18);
static constexpr U32 BIT19 = (1 << 19);
static constexpr U32 BIT20 = (1 << 20);
static constexpr U32 BIT21 = (1 << 21);
static constexpr U32 BIT22 = (1 << 22);
static constexpr U32 BIT23 = (1 << 23);
static constexpr U32 BIT24 = (1 << 24);
static constexpr U32 BIT25 = (1 << 25);
static constexpr U32 BIT26 = (1 << 26);
static constexpr U32 BIT27 = (1 << 27);
static constexpr U32 BIT28 = (1 << 28);
static constexpr U32 BIT29 = (1 << 29);
static constexpr U32 BIT30 = (1 << 30);
static constexpr U32 BIT31 = (1 << 31);

}

(Add U64 version too)

Rationale

This is useful for developers writing drivers. Many end up writing their own, duplicating a common pattern.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Fields

    No fields configured for Feature.

    Projects

    Status
    CCB

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions