Skip to content
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

No way to control data bits on serial interface #787

Closed
ElZeeBee opened this issue May 7, 2018 · 6 comments · Fixed by #795
Closed

No way to control data bits on serial interface #787

ElZeeBee opened this issue May 7, 2018 · 6 comments · Fixed by #795
Labels
Milestone

Comments

@ElZeeBee
Copy link

ElZeeBee commented May 7, 2018

There doesn't seem to be a way to control the data bits sent on a serial interface. There's not even a field for it. In other words, in the classic "8-N-1" serial example, there's no way to control the "8" part.

@ghost ghost added the question label May 9, 2018
@ghost
Copy link

ghost commented May 9, 2018

You're correct. We only allow the following parameters: http://cosmosrb.com/docs/interfaces/#serial-interface

@ghost ghost closed this as completed May 9, 2018
@ghost ghost reopened this May 9, 2018
@ghost
Copy link

ghost commented May 9, 2018

@ryanatball it seems like we could pass data_bits down (5, 6, 7, or 8) to the underlying driver but this new field would break existing serial driver definitions. We could put data_bits at the end but it doesn't really belong there. Here's the current list:

    # @param write_port_name [String] The name of the serial port to write
    # @param read_port_name [String] The name of the serial port to read
    # @param baud_rate [Integer] The serial port baud rate
    # @param parity [Symbol] The parity which is normally :NONE.
    #   Must be one of :NONE, :EVEN, or :ODD.
    # @param stop_bits [Integer] The number of stop bits which is normally 1.
    # @param write_timeout [Integer] The number of seconds to attempt the write
    #   before aborting
    # @param read_timeout [Integer] The number of seconds to attempt to read
    #   data from the serial port before aborting
    # @param protocol_type [String] Combined with 'Protocol' to resolve
    #   to a COSMOS protocol class
    # @param protocol_args [Array] Arguments to pass to the protocol constructor

I feel like it belongs after baud_rate and before parity. Thoughts?

@ghost
Copy link

ghost commented May 9, 2018

Non-standard data sizes could potentially be supported using OPTION.

http://cosmosrb.com/docs/system/#option

@ElZeeBee
Copy link
Author

ElZeeBee commented May 9, 2018

So without a parameter to change the data bits, how does the command actually get sent? Is it fixed at 8 bits internally?

@ghost
Copy link

ghost commented May 9, 2018

The serial framing is fixed at 8 data bits. Parity and stop bits are configurable. I have never seen anything modern that didn't use 8 data bits.

@ElZeeBee
Copy link
Author

A device I'm interfacing with is 7-N-2 by default. I can change it, but I hope you can make this fix in a future release. One never knows what devices one will encounter.

@ghost ghost closed this as completed in #795 May 15, 2018
@ghost ghost added feature and removed question labels May 16, 2018
@ghost ghost added this to the v4.2.4 milestone May 16, 2018
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant