Arduino等效的流函数在免费RTOS ESP-IDF中

发布于 2025-01-29 00:09:19 字数 692 浏览 4 评论 0原文

我试图在ESP-IDF上找到一个等效函数,就像Arduino的流()一样 我要做的是使MSP函数与ESPS UART与MSP协议进行通信,我在Ubuntu环境中使用ESP-IDF和Free-RTOS,然后CMAKE构建

https://www.arduino.cc/reference/reference/en/language/language/language/functions/communication/communication/communication/communication/communication /stream/ https://github.com/yaojo10/msp-arduino/msp-arduino/blob/ master/msp.cpp

我尝试使用std :: ostringstream*,但显然没有做相同的工作

i am trying to find an equivalent function on ESP-IDF that will be like Stream() of arduino ,
what i am trying to do is to make an MSP function to communicate with the MSP protocol with the ESPs UART, i am using ESP-IDF and Free-Rtos in an Ubuntu environment and cmake to built

https://www.arduino.cc/reference/en/language/functions/communication/stream/
https://github.com/yajo10/MSP-Arduino/blob/master/MSP.cpp

i tryied to use std::ostringstream* but obviously doesnt make the same job

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

臻嫒无言 2025-02-05 00:09:19

OSTRINGSTREAM是A 专业 ostream其中“设备”是存储器缓冲区。 是许多设备子类的 基类,它是双向的。标准库在给定合适的流I/O驱动程序的标准库将是std :: istreamstd :: Ostream用于输入和输出,每个都在特定设备上打开。在大多数情况下,您将使用派生的std :: ifstreamstd :: ofStream类S类,并以“文件流”打开设备。

如果您需要一个相同的接口才能使用未修改的代码,则可以实现stream作为围绕iostream的包装器,这是可行的。

ostringstream is a specialised ostream where the "device" is a memory buffer. Stream is an unspecialised base class for a number of device sub-classes, and it is bi-directional. The standard library equivalent given a suitable stream I/O driver would be std::istream and std::ostream for input and output respectively, each opened on the specific device. In most cases you would use the derived std::ifstream and std::ofstream class s and open the device as a "file stream".

If you require an identical interface in order to use the code unmodified, then implementing Stream as a wrapper around iostream is feasible.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文