-
Notifications
You must be signed in to change notification settings - Fork 460
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Data, parity, stop bit settings and config parsing and formatting #38
Conversation
Based on the work of Calvi Paolo <calvip@it.mobile.marconi.com>
Commits 1-3 look good to me. Can you explain the use case for commit 4 a little bit? Is that string format standard in any way? Why would someone want to input or output that? |
I just wanted a way to specify data, parity and stop bits setting, so a GUI or command line app can easily parse them without knowing much about serial ports. That's the purpose of ParseSettings/FormatSettings. After that I added ParseConfig/Config.String() to the mix because it looked like the next logical thing to do. I saw this format for the (data, parity, stop) settings on wikipedia but must admit I haven't checked any references on the topic. The format for ParseConfig() and Config.String() is my own invention, I'm afraid. Feel free to merge the commit tajtiattila@48c5ab6 instead of the whole PR if you think it suits the project better. |
Hi, any update on this PR ? |
I believe the problem is that we couldn't came to a conclusion about the best representation for stop bits. I think using a float for stop bits would be a bad idea. @tarm did you look at my reply where I looked at serial libraries in other languages? How about this: remove the |
I merged the first 3 commits. Thanks Attila! |
thank you @tarm and @tajtiattila 👍 |
This is discussed in these PRs: tarm/serial#34 tarm/serial#38
The first commit is the PR #34 from @paocalvi squashed and cleaned up to use the go naming convention. It return errors for unsupported configuration instead of using defaults.
The second commit replaces naked returns to use arguments in some function(s). Naked returns should be used only in short functions.
The third commit just adds a build tag so that I could test format.go on windows.
The fourth commit adds code to format and parse serial configurations, useful for command line argument handling.