arduino-求解释代码BridgeClass(Stream &_stream);

问题描述

求解释代码BridgeClass(Stream &_stream);

/*
Copyright (c) 2013 Arduino LLC. All right reserved.

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/

#ifndef BRIDGE_H_
#define BRIDGE_H_

#ifndef BRIDGE_BAUDRATE
#define BRIDGE_BAUDRATE 250000
#endif

#include
#include

class BridgeClass {
public:
BridgeClass(Stream &_stream);//求解?
void begin();

// Methods to handle key/value datastore
void put(const char *key, const char *value);
void put(const String &key, const String &value)
{
  put(key.c_str(), value.c_str());
}
unsigned int get(const char *key, uint8_t *buff, unsigned int size);
unsigned int get(const char *key, char *value, unsigned int maxlen)
{
  return get(key, reinterpret_cast<uint8_t *>(value), maxlen);
}

// Trasnfer a frame (with error correction and response)
uint16_t transfer(const uint8_t *buff1, uint16_t len1,
                  const uint8_t *buff2, uint16_t len2,
                  const uint8_t *buff3, uint16_t len3,
                  uint8_t *rxbuff, uint16_t rxlen);
// multiple inline versions of the same function to allow efficient frame concatenation
uint16_t transfer(const uint8_t *buff1, uint16_t len1)
{
  return transfer(buff1, len1, NULL, 0);
}
uint16_t transfer(const uint8_t *buff1, uint16_t len1,
                  uint8_t *rxbuff, uint16_t rxlen)
{
  return transfer(buff1, len1, NULL, 0, rxbuff, rxlen);
}
uint16_t transfer(const uint8_t *buff1, uint16_t len1,
                  const uint8_t *buff2, uint16_t len2,
                  uint8_t *rxbuff, uint16_t rxlen)
{
  return transfer(buff1, len1, buff2, len2, NULL, 0, rxbuff, rxlen);
}

uint16_t getBridgeVersion()
{
  return bridgeVersion;
}

static const int TRANSFER_TIMEOUT = 0xFFFF;

private:
uint8_t index;
int timedRead(unsigned int timeout);
void dropAll();
uint16_t bridgeVersion;

private:
void crcUpdate(uint8_t c);
void crcReset();
void crcWrite();
bool crcCheck(uint16_t _CRC);
uint16_t CRC;

private:
static const char CTRL_C = 3;
Stream &stream;
bool started;
uint8_t max_retries;
};

// This subclass uses a serial port Stream
class SerialBridgeClass : public BridgeClass {
public:
SerialBridgeClass(HardwareSerial &_serial)
: BridgeClass(_serial), serial(_serial) {
// Empty
}

void begin(unsigned long baudrate = BRIDGE_BAUDRATE) {
  serial.begin(baudrate);
  BridgeClass::begin();
}

private:
HardwareSerial &serial;
};

extern SerialBridgeClass Bridge;

#endif /* BRIDGE_H_ */

#include
#include

解决方案

BridgeClass(Stream &_stream);
用stream创建一个BridgeClass对象,这是一个编码类

时间: 2024-08-17 14:18:57

arduino-求解释代码BridgeClass(Stream &amp;amp;_stream);的相关文章

算法 递归 数据结构-求解释代码,添加注释或者画图解释(在网上看到的求组合的递归算法,绕晕头了看不懂,求解释)

问题描述 求解释代码,添加注释或者画图解释(在网上看到的求组合的递归算法,绕晕头了看不懂,求解释) public class Test1 { public static void main(String[] args) { select(2); } private static void select(int k) { char[] result = new char[k]; subselect(0 1 result k); } private static void subselect(int

新手求解答一下-新手求解释代码!!!

问题描述 新手求解释代码!!! 新手求解释代码!!!新手求解释代码!!!新手求解释代码!!! 解决方案 你先解释下为什么有注释还看不懂,以及为什么拍个照片只有代码的左半边.还有,请解释你希望怎么解释. 解决方案二: 这个代码,你好好的拍一下,看不清右边的,,你希望怎么解释,你哪一句不知道? 解决方案三: findStuByNum顾名思义,是根据学号去查询学生,第一步先创建学生对象stu.第二步把根据学号查询到的学生赋给stu.最后一步应该就是调用DataBase中的方法去删除学生,删除成功返回t

c++-找到一段代码不知道什么意思,求解释代码

问题描述 找到一段代码不知道什么意思,求解释代码 #include #define DIST(X,Y,A,B) DA=(X)-(A);DB=(Y)-(B);D=std::sqrt(DA*DA+DB*DB);C=std::max(1.0-(D/H)*(D/H)*(D/H),0.0)*100.0f; double X=25.0f,Y=25.0f,R=0.1f,H=0.5f,RADC=0.45f,D=0.99f,G=-9.81f; int NRX=ceil(X/H),NRY=ceil(Y/H); st

新手求解答一下-新手求解释代码,新手求解释代码,

问题描述 新手求解释代码,新手求解释代码, 新手求解释代码,新手求解释代码,新手求解释代码,新手求解释代码, 解决方案 这段代码是使用冒泡法对数据排序compareTo那行是根据学号(getNum)比较两个元素,if条件内的三行是交换两个元素. 解决方案二: 另外如果回答满意,请lz及时采纳,已经回答很多次,lz拿了问题就跑了. 解决方案三: 解决方案四: 你敲下代码运行下就知道代码的功能了,先尝试弄懂,知道Java语法吧,逐句自己分析试试,不懂的再提.

求解释代码意思

问题描述 <div style="TEXT-ALIGN: center"><embed id="flash3" height="650" width="650" src="http://data1.flash.qq.com/0/0/79/40-1176712052.swf" menu="false" invokeurls="false" allown

堆栈-一段奇怪的代码,求解释

问题描述 一段奇怪的代码,求解释 代码的意思是说,在声明的时候,因为栈的分配原因(先入后出),k[10]就是i的地址.然后i就会被修改成0,循环再次开始,就这样出现了一个死循环.为什么k[10]就是i的地址呢? int m=1; int i =0; int k[10] = {0}; printf(""&m=%dn""&m); printf(""&i=%dn""&i); printf("

biginteger-Java中n!的代码看不懂啊,求解释

问题描述 Java中n!的代码看不懂啊,求解释 import java.math.BigInteger; import java.util.*; public class Main{ protected static ArrayList table = new ArrayList(); static { table.add(BigInteger.valueOf(1)); } public static synchronized BigInteger factorial(int x) { for

孙鑫-Visual C++的一段代码搞不懂求解释

问题描述 Visual C++的一段代码搞不懂求解释 说一下自己的理解.题目是孙鑫老是的文本输出的例子. 1:GetBkColor得到背景白色,然后SetTextColor(白色)把背景白色设置为文字颜色.跟着clr应该是赋值得到白色了吧,但是F5看的时候是黑色,就要原文字颜色.我这么理解应该错了 1 COLORREF clr=dc.SetTextColor(dc.GetBkColor()); //GetBkColor属于dc对象,改变dc中的背景值(白色).然后SetTextColor用白色值

ancy orm-用FancyForm添加用户角色,求解释这段代码,

问题描述 用FancyForm添加用户角色,求解释这段代码, var form = $('#form').FancyForm({ title: '添加角色' width: 345 height: 325 inputWidth: 190 labelWidth: 60 url: '<%=path %>/sysRoleController/addRole.do' params: { param1: 1 param2:'string' } defaults: { type: 'string' } it