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

Comments

Projects
None yet
3 participants
@ElZeeBee

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.

@jasonatball jasonatball added the question label May 9, 2018

@jasonatball

This comment has been minimized.

Collaborator

jasonatball commented May 9, 2018

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

@jasonatball jasonatball closed this May 9, 2018

@jasonatball jasonatball reopened this May 9, 2018

@jasonatball

This comment has been minimized.

Collaborator

jasonatball 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?

@ryanatball

This comment has been minimized.

Member

ryanatball commented May 9, 2018

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

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

@ElZeeBee

This comment has been minimized.

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?

@ryanatball

This comment has been minimized.

Member

ryanatball 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

This comment has been minimized.

ElZeeBee commented May 10, 2018

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment