Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions src/SCRIPTS/BF/MSP/ghst.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
-- GHST Frame Types
local GHST_FRAMETYPE_MSP_REQ = 0x21
local GHST_FRAMETYPE_MSP_WRITE = 0x22
local GHST_FRAMETYPE_MSP_RESP = 0x28

local ghstMspType = 0

protocol.mspSend = function(payload)
return protocol.push(ghstMspType, payload)
end

protocol.mspRead = function(cmd)
ghstMspType = GHST_FRAMETYPE_MSP_REQ
return mspSendRequest(cmd, {})
end

protocol.mspWrite = function(cmd, payload)
ghstMspType = GHST_FRAMETYPE_MSP_WRITE
return mspSendRequest(cmd, payload)
end

protocol.mspPoll = function()
local type, data = ghostTelemetryPop()
if type == GHST_FRAMETYPE_MSP_RESP then
return mspReceivedReply(data)
end
return nil
end
12 changes: 12 additions & 0 deletions src/SCRIPTS/BF/protocols.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,16 @@ local supportedProtocols =
saveMaxRetries = 2,
saveTimeout = 150,
cms = {},
},
ghst =
{
mspTransport = "MSP/ghst.lua",
push = ghostTelemetryPush,
maxTxBufferSize = 10, -- Tx -> Rx (Push)
maxRxBufferSize = 6, -- Rx -> Tx (Pop)
saveMaxRetries = 2,
saveTimeout = 250,
cms = {},
}
}

Expand All @@ -28,6 +38,8 @@ local function getProtocol()
return supportedProtocols.smartPort
elseif supportedProtocols.crsf.push() ~= nil then
return supportedProtocols.crsf
elseif supportedProtocols.ghst.push() ~= nil then
return supportedProtocols.ghst
end
end

Expand Down