freertos入门之StreamBuffer

2023-05-16

#include <inttypes.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "freertos/queue.h"
#include "freertos/timers.h"
#include "freertos/semphr.h"
#include "freertos/semphr.h"
#include "freertos/message_buffer.h"
#include "freertos/event_groups.h"
#include "string.h"

StreamBufferHandle_t  myStreamBuffer;
char *tx="123";
char *tx2="abc";
char  rx[10]={0};

/**
https://www.freertos.org/xStreamBufferSend.html
*/
void send(void *p) {
	size_t  s =	xStreamBufferSend(myStreamBuffer,tx,strlen(tx),pdMS_TO_TICKS(100));
	printf("send: %d\n",s);
	s = 	xStreamBufferSend(myStreamBuffer,tx2,strlen(tx2),pdMS_TO_TICKS(999999999));
	printf("send: %d\n",s);
	while (1) {
		vTaskDelay(pdMS_TO_TICKS(1000));
	}
}

/**
https://www.freertos.org/xStreamBufferSend.html
*/
void receive(void *p){
	while (1) {
		vTaskDelay(pdMS_TO_TICKS(3000));
		size_t xReceivedBytes = xStreamBufferReceive(myStreamBuffer,rx,10,pdMS_TO_TICKS(999999999));
		printf("ReceivedBytes: %d \n",xReceivedBytes);
		printf("Received: %s\n",rx);
	}
}

void app_main(void) {
	myStreamBuffer = xStreamBufferCreate(4,1);
	xTaskCreate(&send, "xEventGroupSetBits", 2048, NULL, configMAX_PRIORITIES-1, NULL);
	xTaskCreate(&receive, "xEventGroupSetBits", 2048, NULL, configMAX_PRIORITIES-1, NULL);
	return;
}

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

freertos入门之StreamBuffer 的相关文章

  • TI毫米波雷达 MIMO (2TX4RX)设置

    我们知道xWR1243和xWR1443 EVM是3TX4RX雷达 xff0c xWR1642 EVM是2TX4RX雷达 xff0c 我们不仅要掌握1TX4RX模式的使用还要学会使用MIMO雷达模式 本文主要介绍如何在mmWave Studi
  • 以Apollo为例学习/分析自动驾驶运动规划算法

    这篇文章写得很粗糙 xff0c 作为我入门学习的笔记 xff0c 其中的思路 分析很可能不正确 xff0c 也希望有在工业界工作的朋友能给我提出一些意见建议 这将是一篇大杂烩 xff0c 也是我一直在学习的主线 想要一下子整理清楚还是很困难
  • 二次规划(QP)与OSQP求解器

    目录 二次规划 xff08 QP xff09 OSQP 求解器 OSQP eigen接口 二次规划 xff08 QP xff09 优化在很多领域都发挥着重要应用 xff0c 其中自动驾驶的运动规划可以看做一个优化问题 xff0c 根据实际情
  • Jetson TX2 入门 ——介绍

    暑假留校 xff0c 老师给我们拿了两块开发板 xff0c 一个是英伟达的Jetson TX2 xff0c 一个是up squared xff0c 让我们先熟悉开发板 xff0c 为明年的比赛做准备 这两个板子是前几届学长做比赛用过的 自己
  • 2.1.2 激光雷达

    更多内容 xff0c 请关注 xff1a github xff1a Autopilot Updating Notes gitee Autopilot Updating Notes 激光雷达是自动驾驶领域非常依赖的传感器 xff0c 越来越多
  • 2.1.5 GPS定位导航

    更多内容 xff0c 请关注 xff1a github xff1a Autopilot Updating Notes gitee Autopilot Updating Notes GPS是Global Positioning System
  • ROS2 + Qt5 cmake的CMakeLists.txt文件配置

    ROS2 QT实现学习笔记 1 1 功能包的创建和编译 ROS2 Foxy 43 Qt5 on Linux Platform 按上面两个文章配置后的目录结构 build CMakeLists txt include mainwindow h
  • 计算思维:二进制串的校验

    题目 xff1a 待传输的二进制串为 1001111 xff0c 若采用偶校验 xff0c 需增加几位校验位才能判断出哪一位传输错误 xff0c 若传输过去变为 1011111 xff0c 则如何判断出是哪一位出错 xff1f 请描述判断过
  • RK1126实现画中画功能 picture in picture for RK 1126

    项目中需要将两个摄像头的流 合并成一个流 主摄像头显示大画面 副摄像头 显示在右上角 实现类似画中画的功能 摸索了下 需要将 从摄像头中取到的 yuv数据进行处理即可 rga模块提供了关于图像处理的一些接口 使用improcess实现图像的
  • QT之基于图形框架QGraphicsView实现链路图

    1 前言 最近因项目需求 xff0c 需要制作一个可以绘制树结构的 事件链 插件 xff0c 于是呼找到了QT自带的一个画流程图的例子 diagramscene xff0c 还在网上找到了另外一个例子 然后我结合了两个demo实现了我的 事
  • 毕业生如何写简历的内容

    毕业生如何写简历的内容 2003年10月14日 14 47 一份能吸引读者注意力的简历 xff0c 能创造面试的机会及增加录取的机率 xff0c 所以必须使它兼备简洁 有序 有个性且不失重点等特色 xff0c 万万不可繁琐冗杂 简历并没有固
  • Template Specialization

    See This in MSDN Library Page Options Conformance to ISO Standards for C 43 43 Kate Gregory Gregory Consulting April 200
  • 模糊控制

    模糊控制是以模糊集合理论为基础的一种新兴的控制手段 xff0c 它是模糊系统理 论和模糊技术与自动控制技术相结合的产物 自从这门科学诞生以来 xff0c 它产生了 许多探索性甚至是突破性的研究与应用成果 xff0c 同时 xff0c 这一方
  • 鲁棒控制——以静制动

    当今的自动控制技术都是基于反馈的概念 反馈理论的要素包括三个部分 xff1a 测量 比较和执行 测量关心的变量 xff0c 与期望值相比较 xff0c 用这个误差纠正调节控 制系统的响应 这个理论和应用自动控制的关键是 xff0c 做出正确
  • 自学电子技术的几个“要”

    学习电子技术 xff0c 基础构筑一定要牢靠 就说读图 xff0c 不能出错 xff0c 还要速度快 xff0c 要习惯成自然 检测元器件 xff0c 要坚持理论指导实践 xff0c 如测三极管 xff0c 理解了输入特性曲线及不同工作点在
  • 巧妙理解电气基础理论

    一 电与水相联系 电是看不见 摸不着 低压 的 xff0c 要想掌握它的特性 xff0c 全靠资料上的介绍和自己的想象 xff0c 确实难于理解 水是我们非常熟悉的 xff0c 它既看得见 xff0c 也模得着 xff0c 人们每天都离不开
  • 我们身边的人工智能应用

    人工智能是在计算机科学 控制论 信息论 心理学 语言学等多种学科相互渗透的基础发展起来的一门新兴边缘学科 xff0c 主要研究用用机器 xff08 主要是计算机 xff09 来模仿和实现人类的智能行为 xff0c 经过几十年的发展 xff0
  • C++资源之不完全导引

    C 43 43 资源之不完全导引作者 xff1a 曾毅 陶文 文章来源 xff1a csdn 点击数 xff1a lt script language 61 34 javascript 34 src 61 34 Article GetHit
  • 揭开C/C++中数组形参的迷雾

    揭开C C 43 43 中数组形参的迷雾作者 xff1a 乾坤一笑 文章来源 xff1a 本站原创 点击数 xff1a lt script language 61 34 javascript 34 src 61 34 Article Get
  • 瑞芯微rk1126 编译mp4v2记录 rk1126移植 ffmpeg X264

    项目需求需要录像存储为mp4文件 并且要支持H264 H265 我们之前在海思平台上用的是mp4v2 想着直接拿过来用 从github上 下载完mp4v2之后 新建一个build文件夹 然后cd到build文件夹新建一个build sh内容

随机推荐

  • 郁闷

    01 面对忧郁要处之泰然 xff0c 因为悲伤是必经的常态 02 找些事情做 xff0c 转移注意力 xff0c 例如散步 下棋 骑脚踏车 阅读等 03 从记忆中寻找快乐 04 找朋友顷诉 xff0c 加以发泄 05 大哭一场 xff0c
  • 2.14 STM32 串口传输最佳处理方式 FreeRTOS+队列+DMA+IDLE (二)

    紧接着上一篇文章 如何合理处理多个串口接收大量数据 此种方法 很厉害 很NB 首先 利用DMA 可节省大量CUP资源 其次 利用IDLE空闲中断来接收位置个数的数据 最后利用串口DMA环形数据的偏移量 长度 入队 出队处理数据 保证了任务的
  • 无人机/无人车仿真软件学习与实践---序言

    之前读博的时候一直使用团队自主设计的无人车在路上做实验 xff0c 验证感知代码时则使用公开数据集和车上实时录制的bag包进行 xff0c 对仿真器的掌握程度一直存在于听说有这么一个东西的程度 毕业之后 xff0c 新加入的团队主要搞的是无
  • stm32 nucleo f746zg串口中断接受数据入门

    使用串口1 将rx和tx对接 使用串口3 通过pc 来打印信息 main中的函数为 xff1a span class token function HAL UART Receive IT span span class token punc
  • stm32 hal iwip EchoClient demo 使用

    tcp echoclient c span class token comment 64 file LwIP LwIP TCP Echo Client Src tcp echoclient c 64 author MCD Applicati
  • esp32点灯程序

    使用的pin为D23 span class token macro property span class token directive hash span span class token directive keyword inclu
  • esp32串口发送

    串口2 xff0c rx 16 和 tx 17 span class token macro property span class token directive hash span span class token directive
  • esp32串口收发echo

    span class token comment SPDX FileCopyrightText 2010 2022 Espressif Systems Shanghai CO LTD SPDX License Identifier CC0
  • esp32定时器timer 代码

    span class token macro property span class token directive hash span span class token directive keyword include span spa
  • 瑞芯微RK1126平台 用FFmpeg 将H264 H265视频流保存为MP4文件

    之前尝试ffmpeg保存MP4文件没有成功 今天周末没事 尝试了下 解决这个问题了 主要是打开文件设置encoder和 发送数据时候 pts的设置 nbsp 打开文件的地方 pHandle gt is record ready store
  • esp32 连接wifi ap热点代码

    span class token macro property span class token directive hash span span class token directive keyword include span spa
  • esp32 tcp socket客户端收发代码

    span class token macro property span class token directive hash span span class token directive keyword include span spa
  • esp32 event loop handle 代码

    span class token macro property span class token directive hash span span class token directive keyword include span spa
  • esp32 ble gatt server创建多个Characteristic

    span class token macro property span class token directive hash span span class token directive keyword include span spa
  • freertos入门之创建Task

    基于esp32平台 span class token macro property span class token directive hash span span class token directive keyword includ
  • freertos入门之queue

    基于esp32 平台 参考 xff1a https www freertos org fr content src uploads 2018 07 161204 Mastering the FreeRTOS Real Time Kernel
  • freertos入门之binary semaphore

    基于esp32 平台 参考 xff1a https www freertos org fr content src uploads 2018 07 161204 Mastering the FreeRTOS Real Time Kernel
  • freertos入门之EventGroup

    span class token macro property span class token directive hash span span class token directive keyword include span spa
  • freertos入门之Timer

    span class token macro property span class token directive hash span span class token directive keyword include span spa
  • freertos入门之StreamBuffer

    span class token macro property span class token directive hash span span class token directive keyword include span spa