/librs232

multiplatform library for serial communications over RS-232 (serial port)

Primary LanguageCMIT LicenseMIT

librs232

Multiplatform library for serial communications over RS-232 (serial port)

Build Status Build status

Changes from the original version

  • Windows. Use overlapped IO model.
  • Windows. Support detect break/parity error.
  • Windows. Implement rs232_in_queue_clear.
  • Windows. Fix using static variables to support multithreading.
  • Windows. rs232_read wait at least one byte (like in POSIX version).
  • Basic tests on Travis/Appveyor.
  • Lua. Export rs232_in_queue_clear / rs232_in_queue functions.
  • Lua. Add more Lua way module.

Lua binding

local rs232 = require "rs232"

local p, e = rs232.port('COM1',{
  baud         = '_9600';
  data_bits    = '_8';
  parity       = 'NONE';
  stop_bits    = '_1';
  flow_control = 'OFF';
  rts          = 'ON';
})

p:open()
print(p:write('AT\r\n'))
print(p:read(64, 5000))
p:close()