Kleidos API Search

In development. It changes without notice.

Topic

GPS Receiver Drivers

The GPS receivers the LILYGO T-Deck can carry, the probe that finds which one is fitted, and the park that keeps it asleep.

A u-blox M10 and a CASIC L76K. A time is accepted only from a valid fix. A receiver runs only when the owner asks for a sync (GPS Time Sync); otherwise it is parked, and a park counts only once the receiver is heard to fall silent.

See also
GPS Time Sync, Clock & Time Zone

Files

file src/drivers/gps/casic_l76k.h
CASIC L76K concrete kleidos::drivers::gps::IGps driver (core only).
file src/drivers/gps/gps_config_map.h
Datasheet-comprehensive u-blox M10 UBX-CFG configuration key map.
file src/drivers/gps/gps_factory.h
NVS-cached auto-probe factory for the GPS receiver driver.
file src/drivers/gps/gps_park_logic.h
Pure, verified GPS park: listen, send only to a module that is talking, and call it parked only once it has gone silent.
file src/drivers/gps/gps_probe.h
Pure UBX-vs-NMEA stream-identity decision for GPS receiver auto-probe.
file src/drivers/gps/gps_types.h
Shared plain-old-data types for the GPS driver layer.
file src/drivers/gps/i_gps.h
Abstract GPS receiver driver contract.
file src/drivers/gps/nmea_time.h
In-house NMEA 0183 time parser for one-shot GPS clock sync.
file src/drivers/gps/ublox_m10.h
u-blox M10 concrete kleidos::drivers::gps::IGps driver.
file src/drivers/gps/ubx_protocol.h
In-house u-blox UBX binary protocol codec (frames, checksum, CFG).

Classes

class kleidos::drivers::gps::CasicL76k
CASIC L76K GPS receiver driver (NMEA over UART, core only). More about kleidos::drivers::gps::CasicL76k
struct kleidos::drivers::gps::cfgmap::UbxCfgKey
One typed, documented UBX-CFG configuration key. More about kleidos::drivers::gps::cfgmap::UbxCfgKey
struct kleidos::drivers::gps::cfgmap::NavPvtLayout
UBX-NAV-PVT (0x01 0x07) payload field offsets (92-byte message). More about kleidos::drivers::gps::cfgmap::NavPvtLayout
struct kleidos::drivers::gps::cfgmap::NavSatLayout
UBX-NAV-SAT (0x01 0x35) payload field offsets (variable length). More about kleidos::drivers::gps::cfgmap::NavSatLayout
struct kleidos::drivers::gps::cfgmap::MonHwLayout
UBX-MON-HW (0x0A 0x09) payload field offsets (60-byte message). More about kleidos::drivers::gps::cfgmap::MonHwLayout
class kleidos::drivers::gps::parklogic::Machine
The verified park, one step per call. More about kleidos::drivers::gps::parklogic::Machine
struct kleidos::drivers::gps::probe::StreamEvidence
Cross-chunk accumulator of what an unidentified receiver "speaks". More about kleidos::drivers::gps::probe::StreamEvidence
struct kleidos::drivers::gps::GpsCfgValue
A typed UBX-CFG value. raw holds the little-endian bit pattern; signed types are sign-extended, L/E1/X* are zero-extended. More about kleidos::drivers::gps::GpsCfgValue
struct kleidos::drivers::gps::GpsSatInfo
One tracked satellite (from NAV-SAT). More about kleidos::drivers::gps::GpsSatInfo
struct kleidos::drivers::gps::GpsStatus
Parsed receiver status snapshot (NAV-PVT + NAV-SAT + MON-HW summary). More about kleidos::drivers::gps::GpsStatus
class kleidos::drivers::gps::IGps
Abstract GPS receiver driver. Mirrors IPmic / IRtc: a small pure core every model implements, plus a bank of return false optional-capability virtuals a minimal driver leaves unimplemented. The driver owns its UART transport; NMEA time parsing stays shared (see kleidos::hal::gps::SyncLogic). More about kleidos::drivers::gps::IGps
struct kleidos::drivers::gps::nmea::UtcFix
A UTC calendar instant decoded from an NMEA sentence. More about kleidos::drivers::gps::nmea::UtcFix
class kleidos::drivers::gps::nmea::TimeParser
Incremental byte-stream assembler over parseSentence. More about kleidos::drivers::gps::nmea::TimeParser
class kleidos::drivers::gps::UbloxM10
u-blox M10 GPS receiver driver (UBX over UART). More about kleidos::drivers::gps::UbloxM10

Enumerations

enum class kleidos::drivers::gps::parklogic::Action : uint8_t { kleidos::drivers::gps::parklogic::Action::None, kleidos::drivers::gps::parklogic::Action::Open, kleidos::drivers::gps::parklogic::Action::SendProbe, kleidos::drivers::gps::parklogic::Action::SendStandby, kleidos::drivers::gps::parklogic::Action::FlushInput, kleidos::drivers::gps::parklogic::Action::Close }
The one thing the caller does for a Machine::step. More about kleidos::drivers::gps::parklogic::Action
enum class kleidos::drivers::gps::parklogic::Verdict : uint8_t { kleidos::drivers::gps::parklogic::Verdict::Idle, kleidos::drivers::gps::parklogic::Verdict::Pending, kleidos::drivers::gps::parklogic::Verdict::Silent, kleidos::drivers::gps::parklogic::Verdict::Parked, kleidos::drivers::gps::parklogic::Verdict::Failed }
Where a park stands. More about kleidos::drivers::gps::parklogic::Verdict
enum class kleidos::drivers::gps::GpsModel : uint8_t
Identified GPS receiver family.
enum class kleidos::drivers::gps::UbxType : uint8_t
u-blox UBX-CFG value storage type (interface manual "Configuration" section).

Functions

const UbxCfgKey *kleidos::drivers::gps::cfgmap::table ()
The datasheet-comprehensive u-blox M10 UBX-CFG key table.
size_tkleidos::drivers::gps::cfgmap::count ()
Number of configuration keys in table().
const UbxCfgKey *kleidos::drivers::gps::cfgmap::find (uint32_t key)
Find a key descriptor by its 32-bit key id (linear scan).
const UbxCfgKey *kleidos::drivers::gps::cfgmap::findByName (const char *name)
Find a key descriptor by its canonical name (linear scan).
IGps *kleidos::drivers::gps::createGps ()
Resolve and return the fitted GPS receiver driver.
IGps *kleidos::drivers::gps::driverForModel (GpsModel model)
The singleton driver for one receiver family, not opened.
boolkleidos::drivers::gps::persistedGpsIdentity (GpsModel &model, uint32_t &baud)
Read the persisted {model,baud} identity without verifying it.
voidkleidos::drivers::gps::storeGpsIdentity (GpsModel model, uint32_t baud)
Store an identity learned somewhere other than the factory's sweep.
voidkleidos::drivers::gps::forgetGpsIdentity ()
Erase the persisted GPS identity and clear the RAM cache.
constexpr boolkleidos::drivers::gps::parklogic::isParked (Verdict v)
Whether a verdict means the receiver is in standby.
voidkleidos::drivers::gps::probe::ingestLine (std::string_view sentence, StreamEvidence &acc)
Fold one just-completed sentence into the evidence.
voidkleidos::drivers::gps::probe::scan (const uint8_t *bytes, size_t n, StreamEvidence &acc)
Accumulate identity evidence from one chunk of receiver bytes.
GpsModelkleidos::drivers::gps::probe::identify (const StreamEvidence &e)
Decide the receiver family from accumulated stream evidence.
boolkleidos::drivers::gps::nmea::checksumValid (std::string_view sentence)
Validate a full NMEA sentence checksum ("$...*hh").
std::string_viewkleidos::drivers::gps::nmea::field (std::string_view body, size_t idx)
Return comma-separated field idx of body (empty when absent).
boolkleidos::drivers::gps::nmea::parseUint (std::string_view s, uint32_t &out)
Parse an unsigned decimal field (digits only, non-empty).
boolkleidos::drivers::gps::nmea::parseHms (std::string_view f, RtcTime &out)
Parse an NMEA hhmmss(.sss) time field into RtcTime.
boolkleidos::drivers::gps::nmea::parseRmc (std::string_view body, UtcFix &out)
Parse a GxRMC payload (valid fixes only) into a UTC instant.
boolkleidos::drivers::gps::nmea::parseSentence (std::string_view sentence, UtcFix &out)
Validate the checksum of a full sentence and parse it as an RMC fix.
voidkleidos::drivers::gps::ubx::checksum (const uint8_t *body, size_t len, uint8_t &ckA, uint8_t &ckB)
Compute the UBX 8-bit Fletcher checksum over a frame body.
size_tkleidos::drivers::gps::ubx::buildFrame (uint8_t cls, uint8_t id, const uint8_t *payload, uint16_t len, uint8_t *out, size_t outCap)
Assemble a complete UBX frame into a caller-supplied buffer.
size_tkleidos::drivers::gps::ubx::buildMonVerPoll (uint8_t *out, size_t cap)
Build the UBX-MON-VER poll frame (empty payload).
size_tkleidos::drivers::gps::ubx::buildValGet (uint32_t key, uint8_t *out, size_t cap)
Build a UBX-CFG-VALGET frame requesting one configuration key.
size_tkleidos::drivers::gps::ubx::valueBytes (UbxType t)
Number of value bytes carried by a UBX-CFG storage type.
size_tkleidos::drivers::gps::ubx::buildValSet (uint32_t key, const GpsCfgValue &v, uint8_t *out, size_t cap)
Build a UBX-CFG-VALSET frame writing one configuration key/value.
size_tkleidos::drivers::gps::ubx::buildPmreqBackup (uint8_t *out, size_t cap)
Build the UBX-RXM-PMREQ frame that puts an M10 in software standby until an edge on its UART RX line wakes it.
UbxTypekleidos::drivers::gps::ubx::typeOfKey (uint32_t key)
Decode the width-class of a 32-bit UBX configuration key.
boolkleidos::drivers::gps::ubx::decodeValue (UbxType t, const uint8_t *le, size_t n, GpsCfgValue &out)
Decode a little-endian UBX value into a GpsCfgValue.

Variables

constexpr autokleidos::drivers::gps::cfgmap::kAntStatus
UBX-MON-HW aStatus antenna-supervisor states (decode for MonHwLayout::kAStatus).
constexpr uint32_tkleidos::drivers::gps::parklogic::kListenMs
constexpr uint32_tkleidos::drivers::gps::parklogic::kProbeMs
How long a module that is talking gets to answer a UBX MON-VER poll.
constexpr uint32_tkleidos::drivers::gps::parklogic::kSettleMs
constexpr uint32_tkleidos::drivers::gps::parklogic::kVerifyMs
Silence after the settle that proves standby: longer than one output period.
constexpr uint8_tkleidos::drivers::gps::parklogic::kSendsPerRate
Standby frames sent at one rate before the park gives up.
constexpr std::array< uint32_t, 3 >kleidos::drivers::gps::parklogic::kFallbackBauds
Line rates tried when no identity is stored, after the board's own.
constexpr uint8_tkleidos::drivers::gps::probe::kUbxSync1
UBX frame sync byte 1 (u-blox interface manual "UBX frame structure").
constexpr uint8_tkleidos::drivers::gps::probe::kUbxSync2
UBX frame sync byte 2 (u-blox interface manual "UBX frame structure").
constexpr size_tkleidos::drivers::gps::probe::kMaxSentence
NMEA 0183 maximum sentence length; longer assemblies are dropped as garbage.
constexpr uint8_tkleidos::drivers::gps::ubx::kSync1
UBX sync char 1 (frame preamble byte 0).
constexpr uint8_tkleidos::drivers::gps::ubx::kSync2
UBX sync char 2 (frame preamble byte 1).
constexpr uint8_tkleidos::drivers::gps::ubx::kClassMon
UBX-MON-VER poll: message class (Monitoring).
constexpr uint8_tkleidos::drivers::gps::ubx::kIdMonVer
UBX-MON-VER poll: message id.
constexpr uint8_tkleidos::drivers::gps::ubx::kClassRxm
UBX-RXM-PMREQ: message class (Receiver Manager).
constexpr uint8_tkleidos::drivers::gps::ubx::kIdPmreq
UBX-RXM-PMREQ: message id (power management request).
constexpr uint8_tkleidos::drivers::gps::ubx::kClassCfg
UBX-CFG: message class (Configuration).
constexpr uint8_tkleidos::drivers::gps::ubx::kIdValGet
UBX-CFG-VALGET: message id.
constexpr uint8_tkleidos::drivers::gps::ubx::kIdValSet
UBX-CFG-VALSET: message id.
constexpr uint8_tkleidos::drivers::gps::ubx::kLayerRam
UBX-CFG-VALGET layer selector (a single enum value): volatile RAM = 0.
constexpr uint8_tkleidos::drivers::gps::ubx::kLayersRam
constexpr uint8_tkleidos::drivers::gps::ubx::kPmreqFlagBackup
UBX-RXM-PMREQ flags: enter backup (low-power) mode (bit 1).
constexpr uint8_tkleidos::drivers::gps::ubx::kPmreqFlagForce
constexpr uint8_tkleidos::drivers::gps::ubx::kPmreqWakeUartRx
UBX-RXM-PMREQ wakeupSources: an edge on the UART RX line wakes it (bit 3).
constexpr uint16_tkleidos::drivers::gps::ubx::kPmreqPayloadLen
UBX-RXM-PMREQ payload length of the one form the M10 documents.
constexpr size_tkleidos::drivers::gps::ubx::kFrameOverhead
Fixed frame overhead: sync(2) + class(1) + id(1) + length(2) + checksum(2).

Back to the top

Enumeration Type Documentation

Action #

enum class kleidos::drivers::gps::parklogic::Action : uint8_t

The one thing the caller does for a Machine::step.

Enumerator
None 

Nothing this step: call again on a later tick.

Open 

Open the port at Machine::baud, writing nothing to it.

SendProbe 

Write the UBX MON-VER poll (a talking module is identified).

SendStandby 

Write Machine::model's own standby frame.

FlushInput 

Discard what arrived while the module stopped.

Close 

Close the port and return the pads to idle.

Verdict #

enum class kleidos::drivers::gps::parklogic::Verdict : uint8_t

Where a park stands.

Enumerator
Idle 

Never started.

Pending 

Under way: keep stepping.

Silent 

It was already silent; nothing was written to it.

Parked 

A standby frame stopped it, and it stayed silent.

Failed 

It kept talking, or never framed, at every rate tried.

Back to the top

Function Documentation

buildFrame() #

size_t kleidos::drivers::gps::ubx::buildFrame(uint8_t cls, uint8_t id, const uint8_t * payload, uint16_t len, uint8_t * out, size_t outCap)
inline

Assemble a complete UBX frame into a caller-supplied buffer.

Parameters
NameDirectionMeaning
clsinUBX message class.
idinUBX message id.
payloadinPayload bytes (may be nullptr when len is 0).
leninPayload length in bytes.
outoutDestination buffer.
outCapinCapacity of out in bytes.
Returns
Total bytes written (kFrameOverhead + len), or 0 on overflow.

buildMonVerPoll() #

size_t kleidos::drivers::gps::ubx::buildMonVerPoll(uint8_t * out, size_t cap)
inline

Build the UBX-MON-VER poll frame (empty payload).

Parameters
NameDirectionMeaning
outoutDestination buffer.
capinCapacity of out in bytes.
Returns
Bytes written (8), or 0 on overflow.

buildPmreqBackup() #

size_t kleidos::drivers::gps::ubx::buildPmreqBackup(uint8_t * out, size_t cap)
inline

Build the UBX-RXM-PMREQ frame that puts an M10 in software standby until an edge on its UART RX line wakes it.

The 16-byte form, the only one the M10 interface description defines: version 0, three reserved bytes, a duration of 0 (no timed wake), the backup and force flags, and UART RX as the one wake source. Without force the receiver is not required to enter standby at all. Entering it clears the receiver's RAM, configuration included, so it wakes on its defaults.

Parameters
NameDirectionMeaning
outoutDestination buffer.
capinCapacity of out in bytes.
Returns
Bytes written (24), or 0 on overflow.

buildValGet() #

size_t kleidos::drivers::gps::ubx::buildValGet(uint32_t key, uint8_t * out, size_t cap)
inline

Build a UBX-CFG-VALGET frame requesting one configuration key.

Parameters
NameDirectionMeaning
keyin32-bit UBX configuration key id.
outoutDestination buffer.
capinCapacity of out in bytes.
Returns
Bytes written (16), or 0 on overflow.

buildValSet() #

size_t kleidos::drivers::gps::ubx::buildValSet(uint32_t key, const GpsCfgValue & v, uint8_t * out, size_t cap)
inline

Build a UBX-CFG-VALSET frame writing one configuration key/value.

Parameters
NameDirectionMeaning
keyin32-bit UBX configuration key id.
vinTyped value (little-endian bits in GpsCfgValue::raw).
outoutDestination buffer.
capinCapacity of out in bytes.
Returns
Bytes written, or 0 on overflow.

checksum() #

void kleidos::drivers::gps::ubx::checksum(const uint8_t * body, size_t len, uint8_t & ckA, uint8_t & ckB)
inline

Compute the UBX 8-bit Fletcher checksum over a frame body.

Parameters
NameDirectionMeaning
bodyinPointer to {class, id, len_lo, len_hi, payload...}.
leninNumber of bytes in body.
ckAoutAccumulated checksum A.
ckBoutAccumulated checksum B.

checksumValid() #

bool kleidos::drivers::gps::nmea::checksumValid(std::string_view sentence)
inline

Validate a full NMEA sentence checksum ("$...*hh").

Parameters
NameDirectionMeaning
sentenceinThe full sentence from '$' through the two hex digits.
Return values
ValueMeaning
trueXOR of the payload equals the trailing hex pair.
falseMissing '$'/'*hh', bad hex, or checksum mismatch.

count() #

size_t kleidos::drivers::gps::cfgmap::count()
inline

Number of configuration keys in table().

Returns
Key count.

createGps() #

IGps * kleidos::drivers::gps::createGps()

Resolve and return the fitted GPS receiver driver.

Returns the RAM-cached driver if one was already resolved this session; otherwise runs the NVS fast-path (with self-heal) and, failing that, the baud sweep described in the file header. The resolved driver is opened and ready to kleidos::drivers::gps::IGps::read.

Returns
A ready driver owned by function-local static storage (do not delete), or nullptr when no receiver responded (or the board has no GPS). A nullptr result is not cached — a module attached later can still be found on the next call.

decodeValue() #

bool kleidos::drivers::gps::ubx::decodeValue(UbxType t, const uint8_t * le, size_t n, GpsCfgValue & out)
inline

Decode a little-endian UBX value into a GpsCfgValue.

Assembles n little-endian bytes into GpsCfgValue::raw. Signed types (I1..I8) are sign-extended to 64 bits; L / E1 / X* / U* are zero-extended.

Parameters
NameDirectionMeaning
tinValue type.
leinLittle-endian value bytes.
ninNumber of bytes available in le.
outoutDecoded value (GpsCfgValue::type set to t).
Return values
ValueMeaning
trueDecoded (n matched the type width).
falseInsufficient bytes / null input.

driverForModel() #

IGps * kleidos::drivers::gps::driverForModel(GpsModel model)

The singleton driver for one receiver family, not opened.

The raw family lookup behind createGps, for the one caller that must not probe: a park sends one model's standby frame and closes the port again, so it needs the driver without the listen window that identifies it. The returned driver lives in function-local static storage (do not delete).

Parameters
NameDirectionMeaning
modelinReceiver family to resolve.
Returns
The family's driver, or nullptr for GpsModel::Unknown (and always on a board without a GPS).

field() #

std::string_view kleidos::drivers::gps::nmea::field(std::string_view body, size_t idx)
inline

Return comma-separated field idx of body (empty when absent).

Parameters
NameDirectionMeaning
bodyinSentence payload between '$' and '*'.
idxin0-based field index (field 0 is the sentence id).
Returns
The field's characters, or an empty view when the index is past the end.

find() #

const UbxCfgKey * kleidos::drivers::gps::cfgmap::find(uint32_t key)
inline

Find a key descriptor by its 32-bit key id (linear scan).

Parameters
NameDirectionMeaning
keyin32-bit UBX configuration key id.
Returns
Pointer to the matching descriptor, or nullptr if not present.

findByName() #

const UbxCfgKey * kleidos::drivers::gps::cfgmap::findByName(const char * name)
inline

Find a key descriptor by its canonical name (linear scan).

Parameters
NameDirectionMeaning
nameinKey name, e.g. "CFG-UART1-BAUDRATE".
Returns
Pointer to the matching descriptor, or nullptr if name is null or not present.

forgetGpsIdentity() #

void kleidos::drivers::gps::forgetGpsIdentity()

Erase the persisted GPS identity and clear the RAM cache.

Removes the stored identity from NVS and drops the file-scope cached driver, forcing the next createGps to re-run a full baud sweep. Used by the self-heal path. No-op on a board without a GPS.

Note
It touches no UART, so it cannot close a port a consumer still holds. An explicit re-detect goes through gps::forgetIdentity instead, which closes the receiver first.

identify() #

GpsModel kleidos::drivers::gps::probe::identify(const StreamEvidence & e)
inline

Decide the receiver family from accumulated stream evidence.

Parameters
NameDirectionMeaning
einEvidence gathered by one or more scan calls.
Return values
ValueMeaning
GpsModel::UbloxM10A UBX sync pair was seen (the receiver speaks UBX).
GpsModel::CasicL76kA checksum-valid NMEA line was seen but no UBX (the one NMEA-only family the factory knows).
GpsModel::UnknownNeither signal was observed.

ingestLine() #

void kleidos::drivers::gps::probe::ingestLine(std::string_view sentence, StreamEvidence & acc)
inline

Fold one just-completed sentence into the evidence.

Parameters
NameDirectionMeaning
sentenceinAssembled sentence "$…*hh" (no CR/LF).
accin, outEvidence updated when the checksum validates.

isParked() #

bool kleidos::drivers::gps::parklogic::isParked(Verdict v)
constexpr

Whether a verdict means the receiver is in standby.

Parameters
NameDirectionMeaning
vinA verdict.
Return values
ValueMeaning
trueVerdict::Silent or Verdict::Parked.
falseAny other.

parseHms() #

bool kleidos::drivers::gps::nmea::parseHms(std::string_view f, RtcTime & out)
inline

Parse an NMEA hhmmss(.sss) time field into RtcTime.

The fractional part is ignored. A leap-second ss of 60 is clamped to 59 so the value always fits the RtcTime contract (0..59).

Parameters
NameDirectionMeaning
finThe time field (e.g. "235960.00").
outoutReceives hours/minutes/seconds on success.
Return values
ValueMeaning
trueExactly six leading digits with hh<=23, mm<=59, ss<=60.
falseWrong length or out-of-range component.

parseRmc() #

bool kleidos::drivers::gps::nmea::parseRmc(std::string_view body, UtcFix & out)
inline

Parse a GxRMC payload (valid fixes only) into a UTC instant.

Parameters
NameDirectionMeaning
bodyinPayload between '$' and '*' (checksum already verified).
outoutReceives the UTC date+time on success.
Return values
ValueMeaning
trueRMC with status 'A', six-digit time and ddmmyy date in range.
falseNot RMC, void fix, or malformed/out-of-range fields.

parseSentence() #

bool kleidos::drivers::gps::nmea::parseSentence(std::string_view sentence, UtcFix & out)
inline

Validate the checksum of a full sentence and parse it as an RMC fix.

Parameters
NameDirectionMeaning
sentenceinFull sentence "$...*hh" (no CR/LF).
outoutReceives the UTC date+time on success.
Return values
ValueMeaning
trueA checksum-valid RMC with status A (a fix) and a full date.
falseBad checksum, other sentence types, or malformed fields.

parseUint() #

bool kleidos::drivers::gps::nmea::parseUint(std::string_view s, uint32_t & out)
inline

Parse an unsigned decimal field (digits only, non-empty).

Parameters
NameDirectionMeaning
sinThe field characters.
outoutReceives the parsed value on success.
Return values
ValueMeaning
trues is one to nine decimal digits.
falseEmpty field, more than nine digits (uint32_t wrap guard), or any non-digit character.

persistedGpsIdentity() #

bool kleidos::drivers::gps::persistedGpsIdentity(GpsModel & model, uint32_t & baud)

Read the persisted {model,baud} identity without verifying it.

The identity createGps stores at detection, straight out of flash: no port is opened and no stream is listened to, so this costs nothing and can be wrong (a swapped module, a reconfigured baud). For a park that is enough — a standby frame sent to the wrong model is noise, and the next real createGps still self-heals.

The flash is read at most once per boot: the answer, including a remembered negative, is memoised in RAM and kept honest by forgetGpsIdentity and by the write at detection. That is what lets the deep-sleep teardown park the receiver without opening NVS on a shutdown path.

Parameters
NameDirectionMeaning
modeloutThe persisted family on success.
baudoutThe persisted line rate on success.
Return values
ValueMeaning
trueA usable identity was stored and both outputs were written.
falseNothing cached yet, the stored model byte is not a family, or the board has no GPS.

scan() #

void kleidos::drivers::gps::probe::scan(const uint8_t * bytes, size_t n, StreamEvidence & acc)
inline

Accumulate identity evidence from one chunk of receiver bytes.

Walks bytes tracking two independent signals: the 0xB5 0x62 UBX sync pair (via the carried previous byte, so it survives a chunk boundary) and '$'-started NMEA lines (reassembled up to kMaxSentence and validated through kleidos::drivers::gps::nmea::checksumValid on the terminator). Safe to call any number of times with the same acc.

Parameters
NameDirectionMeaning
bytesinPointer to the chunk (may be null only when n is 0).
ninNumber of bytes in the chunk.
accin, outEvidence accumulator carried across chunks.

storeGpsIdentity() #

void kleidos::drivers::gps::storeGpsIdentity(GpsModel model, uint32_t baud)

Store an identity learned somewhere other than the factory's sweep.

The verified park identifies a module that is talking from its own stream (gps_park_logic.h); this keeps what it learned for the next boot, exactly as a sweep would have, so a later createGps takes the fast path.

Parameters
NameDirectionMeaning
modelinThe family the stream identified.
baudinThe rate it was heard at.

table() #

const UbxCfgKey * kleidos::drivers::gps::cfgmap::table()
inline

The datasheet-comprehensive u-blox M10 UBX-CFG key table.

Returns
Pointer to the first of count() immutable key descriptors.

typeOfKey() #

UbxType kleidos::drivers::gps::ubx::typeOfKey(uint32_t key)
inline

Decode the width-class of a 32-bit UBX configuration key.

Bits [30:28] of the key encode the storage size (1=1-bit L, 2=1-byte, 3=2-byte, 4=4-byte, 5=8-byte). This returns the width class; the caller's key map carries the precise signedness/enum semantics when they matter.

Parameters
NameDirectionMeaning
keyin32-bit UBX configuration key id.
Returns
The width-class type (L / U1 / U2 / U4 / U8).

valueBytes() #

size_t kleidos::drivers::gps::ubx::valueBytes(UbxType t)
inline

Number of value bytes carried by a UBX-CFG storage type.

Parameters
NameDirectionMeaning
tinValue type.
Returns
1, 2, 4, or 8 bytes (defaults to 1 for unknown inputs).

Back to the top

Variable Documentation

kLayersRam #

uint8_t kleidos::drivers::gps::ubx::kLayersRam
constexpr

UBX-CFG-VALSET layers selector (a bitmask, not an enum): the RAM bit is bit 0 (BBR = bit 1, Flash = bit 2). A VALSET with an all-zero layers mask selects no destination layer, so the receiver applies nothing and never sends an ACK — the write must set the RAM bit here.

kListenMs #

uint32_t kleidos::drivers::gps::parklogic::kListenMs
inlineconstexpr

How long the port is listened to before anything is written. Both families talk at 1 Hz by default, so 2.2 s spans two output periods with room for a sentence that started before the port opened.

kPmreqFlagForce #

uint8_t kleidos::drivers::gps::ubx::kPmreqFlagForce
constexpr

UBX-RXM-PMREQ flags: force the request (bit 2). The M10 interface description requires it for the receiver to enter software standby at all.

kSettleMs #

uint32_t kleidos::drivers::gps::parklogic::kSettleMs
inlineconstexpr

Time the module is given to act on its standby frame; what arrives in it is the tail of output already under way and is discarded.

Back to the top