Skip to content

Incorrect cast in Uart::begin #216

Closed
@keestux

Description

@keestux

See issue #83 where I left this note. I might as well create a new issue.
Issue #83 is not fixed properly. Argument config was changed to uint16_t as shown below

void Uart::begin(unsigned long baudrate, uint16_t config)

however the other Uart::begin calls it with a cast to uint8_t

void Uart::begin(unsigned long baudrate)
{
  begin(baudrate, (uint8_t)SERIAL_8N1);
}

So far, nobody noticed, probably because nobody uses other than 8 data bits. In that case you won't notice the bug.
Wouldn't it be better to drop this latter function and to add a default value for config in the other begin()?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions