C:跨平台的RS-232串行库? [英] C: cross-platform RS-232 serial library?

查看:141
本文介绍了C:跨平台的RS-232串行库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一个开放源代码的跨平台库,用于在C语言中使用串行端口,这类似于令人敬畏的 PySerial 库(不幸的是,我必须为此应用使用C).

I am looking for an open source cross-platform library for working with the serial port in C, something along the lines of the awesome PySerial library (unfortunately I have to use C for this application).

我只找到了一个: http://www.teuniz.net/RS-232/,并且似乎没有提及OS  X的兼容性.

I have only found this one: http://www.teuniz.net/RS-232/, and that doesn't seem to have mention OS X compatibility.

推荐答案

您会认为用于串行端口的跨平台C库已经存在20年了,但是截至2013年,该库仍不存在一个,所以我创建了 libserialport .

You would think that a cross-platform C library for serial ports is something that would have existed for 20 years already, but as of 2013 there still wasn't one, so I created libserialport.

它已经在Windows,Mac OS X,Linux(包括Android),BSD上进行了测试,并且可能还会在其他Unix系统上构建.它支持:

It is tested on Windows, Mac OS X, Linux (including Android), BSD and will probably build on other Unix systems also. It supports:

  • 端口枚举(获取系统上的串行端口列表)
  • 打开,关闭和查询端口
  • 设置端口参数(波特率,奇偶校验等)
  • 端口信令操作(调制解调器控制线,中断等)
  • 读取,写入和刷新数据
  • 等待事件
  • 获取错误信息

Sigrok 项目正在积极使用最初的0.1.0版本,用于支持串行硬件,并打包在多个版本中. Linux版本已经发行. git版本还包括新的API调用,用于获取有关USB串行适配器(VID/PID等)的信息.

The initial 0.1.0 release is in active use by the Sigrok project for supporting serial hardware and is packaged in several Linux distributions already. The git version also includes new API calls for getting information about USB serial adapters (VID/PID etc).

这篇关于C:跨平台的RS-232串行库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆