当前位置:网站首页>esp32 hosted
esp32 hosted
2022-06-12 06:42:00 【wwwlyj123321】
Handshake pin
ESP 的输出引脚。高电平表示正在进行ESP32正在通过spi接口和主机进行交互。因此,当该引脚是高电平的时候,主机不应该启动spi数据传输。通俗一点的解释就是:host想给ESP32发送数据,先看一下esp32是否准备好接收数据了。
Data ready pin
ESP 的输出引脚。因为ESP是spi的从设备,不能主动发起传输。因此,该引脚用于弥补SPI协议的不足,告诉SPI主机,esp32想要向主机发送数据了。该引脚保持高电平,直到主机读取该数据包。
Reset/EN pin
ESP 外设的输入引脚。 用于复位 ESP 设备。
esp32代码内部维护了一个spi的rx_buffer和tx_buffer。每个buffer的最大是1600 字节,即主机一次最多可以发送和接收 1600 字节的数据。
在esp32和host交换数据的时候,使用protobuf对数据进行序列化和反序列化。
如果要增加一个新的命令交互:
1、在.proto文件中新增自定义命令,然后生成.c和.h文件:
cd <path/to/esp_hosted>/common/proto
protoc-c esp_hosted_config.proto --c_out=.
mv esp_hosted_config.pb-c.c ../
mv esp_hosted_config.pb-c.h ../include/2、在 host/host_common/commands.c 中添加 C 函数
3、 在ESP 端,在esp/esp_driver/network_adapter/main/slave_commands.c 中添加相应的 C 函数来处理添加的消息字段。
当host给esp32发送命令的时候,先使用protobuf对命令进行序列化,然后调用transport_pserial_data_handler接口将数据组装成TLV格式(Type - Length - Value),

| 字段 | 说明 | bytes used |
Endpoint Type | 1:表示接下来传输的是endpoint name | 1 byte |
Endpoint Length | 表示接下来传输的Endpoint Value的大小 | 2 byte |
Endpoint Value | 目前只有一个value,固定是:"control" | 7 byte |
Data Type | 2:表示接下来传输的是数据内容 | 1 byte |
Data Length | 表示接下来传输的Data Value的大小 | 2 byte |
Data Value | payload | N bytes |
边栏推荐
- 六月集训 第八日——前缀和
- The fifth day of June training - double pointer
- 使用 ms17-010 永恒之蓝漏洞对 win7 进行渗透及建立永久后门
- leetcode 35. Search insert location
- 张驰课堂:2022年CAQ中质协六西格玛考试时间通知
- torch在高版本训练的模型在低版本中使用报错
- Codeforces Round #793 (Div. 2) A B C
- 2021 robocom world robot developer competition - undergraduate group (Preliminary)
- Zhang Chi: is process a panacea?
- Computer composition and design work06 - based on MIPS
猜你喜欢

sql server 2019安装出现错误,如何解决

Multithreading (V) -- Concurrent tools (II) -- j.u.c concurrent contracting (I) -- AQS and reentrantlock principles

leetcode:剑指 Offer 67. 把字符串转换成整数【模拟 + 分割 +讨论】

Qt-- realize TCP communication

8. 表单标签

An error occurred while downloading the remote file The errormessage

Vscode Common plug - in

ConVIRT论文详解(医疗图片)

基于报错的 SQL 注入
![Leetcode: offer 60 Points of N dice [math + level DP + cumulative contribution]](/img/2b/41bd6a213892062f4c12721b5d4e8d.png)
Leetcode: offer 60 Points of N dice [math + level DP + cumulative contribution]
随机推荐
The second day of June training - string
Delete the duplicate items in the ordered array -- force deduction question 26 (simple)
【数据聚类】本专栏中涉及数据集、可视化及注意事项
Matlab 6-DOF manipulator forward and inverse motion
LeetCode-1405. Longest happy string
Leetcode: Sword finger offer 63 Maximum profit of stock [record prefix minimum and or no brain segment tree]
It only takes 10 minutes to understand the underlying principle of NiO
CL210OpenStack操作的故障排除--章節實驗
Leetcode: offer 60 Points of N dice [math + level DP + cumulative contribution]
The difference between get and post and the code implementation of message board
LeetCode-1741. Find total time spent per employee
Tomato learning notes dvector and other basics
XML special character escape
LeetCode-1303. Team size
如何更新 Kubernetes 证书
Are you still using like+% for MySQL fuzzy query?
Multithreading (4) -- no lock (2) -- Atomic related atomic classes
LeetCode-1445. Apples and oranges
六月集训 第五天——双指针
LeetCode-419. Battleship on deck