Skip to content

Commit

Permalink
fix: set baudrate bits as initial cflag
Browse files Browse the repository at this point in the history
  • Loading branch information
mochalins committed Sep 20, 2024
1 parent 37aa6d7 commit 9339853
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/backend/linux.zig
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pub fn configure(port: *const PortImpl, config: serialport.Config) !void {
settings.iflag.IXON = config.handshake == .software;
settings.iflag.IXOFF = config.handshake == .software;

settings.cflag = .{};
settings.cflag = @bitCast(@intFromEnum(config.baud_rate));
settings.cflag.CREAD = true;
settings.cflag.CLOCAL = config.handshake == .none;
settings.cflag.CSTOPB = config.stop_bits == .two;
Expand Down
2 changes: 1 addition & 1 deletion src/backend/macos.zig
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pub fn configure(port: *const PortImpl, config: serialport.Config) !void {
settings.iflag.IXON = config.handshake == .software;
settings.iflag.IXOFF = config.handshake == .software;

settings.cflag = .{};
settings.cflag = @bitCast(@intFromEnum(config.baud_rate));
settings.cflag.CREAD = true;
settings.cflag.CSTOPB = config.stop_bits == .two;
settings.cflag.CSIZE = @enumFromInt(@intFromEnum(config.word_size));
Expand Down

0 comments on commit 9339853

Please sign in to comment.