⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 readprotocols.m

📁 基于串行接口的GPS驱动程序
💻 M
字号:
function protocols = ReadProtocols(gps)
% READPROTOCOLS Read the Protocol Capability Protocol data from the GPS
% Return a structure with two fields:
%   tag: Character tag identifying protocol family
%   id: Numeric protocol identifier (within family)

global pid_protocol_array pid_ack_byte;
protocols = [];
    
if (get(gps, 'BytesAvailable') > 0)
    
    [id, sz] = ReadPacketHeader(gps);
    
    if (id == pid_protocol_array)
        for i=1:sz
            protocols(i).tag = fread(gps, 1);
            protocols(i).id = fread(gps, 1, 'int16');
        end
    end
    
    cksum = ReadPacketTerminator(gps);
    csum = ComputeChecksum(id, [protocols.tag protocols.id]);
    
    WritePacket(gps, pid_ack_byte, 0);
end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -