Pages: [1]   Go Down
Author Topic: No begin in Stream, how to handle soft and hard serials as one general class?  (Read 685 times)
0 Members and 1 Guest are viewing this topic.
Central MN, USA
Offline Offline
Tesla Member
***
Karma: 64
Posts: 6893
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I am trying to write code that can take either software or hardware serial object (arduino 1.0) and use it for communication. I'm aware that both inherit from Stream but after checking out the Stream code, I didn't find begin. Read, available are both there. I suppose the print and write are inherited from Print.

So my options are:
* Split into one function that does soft serial with a begin and another function that does hard serial with a begin.
* Demand the port to be initialized with a begin before the code can accept the pointer to the port and have one function to handle both initialized (begun) soft and hard serial ports.
* Any more elegant ways? Thank you!!!
Logged


Pages: [1]   Go Up
Jump to: