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

查看:23
本文介绍了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天全站免登陆