Skip to content

Commit 1fa44b0

Browse files
committed
Add array based setVal function.
1 parent 2411467 commit 1fa44b0

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

src/SparkFun_u-blox_GNSS_Arduino_Library.cpp

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4929,6 +4929,31 @@ uint8_t SFE_UBLOX_GNSS::setVal(uint32_t key, uint16_t value, uint8_t layer, uint
49294929
return setVal16(key, value, layer, maxWait);
49304930
}
49314931

4932+
//Given an array of data (most likely from a config file) push using valSet
4933+
uint8_t SFE_UBLOX_GNSS::setVal(uint8_t* value, uint16_t len, uint8_t layer, uint16_t maxWait)
4934+
{
4935+
packetCfg.cls = UBX_CLASS_CFG;
4936+
packetCfg.id = UBX_CFG_VALSET;
4937+
packetCfg.len = 4 + len; //4 byte header, *no* key ID, len bytes of raw data
4938+
packetCfg.startingSpot = 0;
4939+
4940+
//Clear packet payload
4941+
memset(payloadCfg, 0, packetCfg.len);
4942+
4943+
payloadCfg[0] = 1; //Message Version - set to 1
4944+
payloadCfg[1] = layer; //By default we ask for the RAM layer
4945+
4946+
// payloadCfg[2] = skipAmt >> 8 * 0; //Position - skip this many key values
4947+
// payloadCfg[3] = skipAmt >> 8 * 1;
4948+
4949+
//Copy data into payload
4950+
for(uint16_t x = 0 ; x < len ; x++)
4951+
payloadCfg[4 + x] = value[x];
4952+
4953+
//Send VALSET command with this key and value
4954+
return (sendCommand(&packetCfg, maxWait) == SFE_UBLOX_STATUS_DATA_SENT); // We are only expecting an ACK
4955+
}
4956+
49324957
//Given a key, set a 16-bit value
49334958
//This function takes a full 32-bit key
49344959
//Default layer is all: RAM+BBR+Flash

0 commit comments

Comments
 (0)