Skip to content

Wrong type '*mut u8' for bitfields instead of u8 #22

@Pr0gm4n

Description

@Pr0gm4n

The current type of the defined bitfields is *mut u8, a pointer type. It is not clear to me how they are supposed to be used like that. I would expect the bitmasks to be used, e.g., as:

unsafe {
    *UCSRB = TXEN | RXEN | RXCIE;
}

That doesn't work with pointers, though. I've found a workaround using core::intrinsics::transmute, casting it to an usize and subsequently cropping the value to an u8. But I really think that it is a bug in this library.

Do you agree? If so, I might take the time to create a PR to fix the issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions