arduino / arduino/Arduino

HardwareSerial and SoftwareSerial should have a common super class

Open
#4,185 2 comments 2 reactions 1 assignee Claimed by @cmaglie View on GitHub
Component: HardwareSerial feature request
Dominant language
Java
Stars
14.6k
Forks
7k
PR merge metrics
No merged PRs in 30d

Description

HardwareSerial and SoftwareSerial are supposed to be variations on a Serial connection, but they do not share a common superclass

Please add a superclass, 'Serial_", or some such, which contains the methods common to both HardwareSerial and SoftwareSerial.

At present libraries cannot accept HardwareSerial / SoftwareSerial objects interchangeably.

Particular use case is a library to determine the baud rate of an attached device.
Need to call multiple begin() methods with different baud rates, but have to have lots of extra code to workout if user is using HardwareSerial or SoftwareSerial for the connection.
On UNO, most likely has to use SoftwareSerial.
On Mega can/should use HardwareSerial

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.