Skip to content
This repository was archived by the owner on Jan 28, 2021. It is now read-only.

Commit 55bb4a2

Browse files
committed
Move keys to separate file
1 parent 6efce21 commit 55bb4a2

File tree

2 files changed

+69
-37
lines changed

2 files changed

+69
-37
lines changed

src/SparkFun_Ublox_Arduino_Library.h

Lines changed: 2 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@
4949

5050
#include <Wire.h>
5151

52+
#include "u-blox_config_keys.h"
53+
5254
// Define Serial for SparkFun SAMD based boards.
5355
// Boards like the RedBoard Turbo use SerialUSB (not Serial).
5456
// But other boards like the SAMD51 Thing Plus use Serial (not SerialUSB).
@@ -342,43 +344,6 @@ const uint8_t COM_TYPE_UBX = (1 << 0);
342344
const uint8_t COM_TYPE_NMEA = (1 << 1);
343345
const uint8_t COM_TYPE_RTCM3 = (1 << 5);
344346

345-
//The following consts are used to generate KEY values for the advanced protocol functions of VELGET/SET/DEL
346-
const uint8_t VAL_SIZE_1 = 0x01; //One bit
347-
const uint8_t VAL_SIZE_8 = 0x02; //One byte
348-
const uint8_t VAL_SIZE_16 = 0x03; //Two bytes
349-
const uint8_t VAL_SIZE_32 = 0x04; //Four bytes
350-
const uint8_t VAL_SIZE_64 = 0x05; //Eight bytes
351-
352-
//These are the Bitfield layers definitions for the UBX-CFG-VALSET message (not to be confused with Bitfield deviceMask in UBX-CFG-CFG)
353-
const uint8_t VAL_LAYER_RAM = (1 << 0);
354-
const uint8_t VAL_LAYER_BBR = (1 << 1);
355-
const uint8_t VAL_LAYER_FLASH = (1 << 2);
356-
const uint8_t VAL_LAYER_ALL = VAL_LAYER_RAM | VAL_LAYER_BBR | VAL_LAYER_FLASH; //Not valid with getVal()
357-
358-
//Below are various Groups, IDs, and sizes for various settings
359-
//These can be used to call getVal/setVal/delVal
360-
const uint8_t VAL_ID_PROT_UBX = 0x01;
361-
const uint8_t VAL_ID_PROT_NMEA = 0x02;
362-
const uint8_t VAL_ID_PROT_RTCM3 = 0x04;
363-
364-
const uint8_t VAL_GROUP_I2COUTPROT = 0x72;
365-
const uint8_t VAL_GROUP_UART1INPROT = 0x73;
366-
const uint8_t VAL_GROUP_UART1OUTPROT = 0x74;
367-
const uint8_t VAL_GROUP_I2C = 0x51;
368-
369-
const uint8_t VAL_GROUP_UART_SIZE = VAL_SIZE_1; //All fields in UART group are currently 1 bit
370-
const uint8_t VAL_GROUP_I2C_SIZE = VAL_SIZE_8; //All fields in I2C group are currently 1 byte
371-
372-
const uint8_t VAL_ID_I2C_ADDRESS = 0x01;
373-
374-
const uint32_t UBLOX_CFG_UART1INPROT_UBX = ((VAL_GROUP_UART_SIZE << 4) << (8 * 3)) | (VAL_GROUP_UART1INPROT << (8 * 2)) | (0x00 << (8 * 1)) | (VAL_ID_PROT_UBX << (8 * 0)); //0x10730001
375-
const uint32_t UBLOX_CFG_UART1INPROT_NMEA = ((VAL_GROUP_UART_SIZE << 4) << (8 * 3)) | (VAL_GROUP_UART1INPROT << (8 * 2)) | (0x00 << (8 * 1)) | (VAL_ID_PROT_NMEA << (8 * 0));
376-
const uint32_t UBLOX_CFG_UART1INPROT_RTCM3X = ((VAL_GROUP_UART_SIZE << 4) << (8 * 3)) | (VAL_GROUP_UART1INPROT << (8 * 2)) | (0x00 << (8 * 1)) | (VAL_ID_PROT_RTCM3 << (8 * 0));
377-
378-
const uint32_t UBLOX_CFG_UART1OUTPROT_UBX = ((VAL_GROUP_UART_SIZE << 4) << (8 * 3)) | (VAL_GROUP_UART1OUTPROT << (8 * 2)) | (0x00 << (8 * 1)) | (VAL_ID_PROT_UBX << (8 * 0));
379-
const uint32_t UBLOX_CFG_UART1OUTPROT_NMEA = ((VAL_GROUP_UART_SIZE << 4) << (8 * 3)) | (VAL_GROUP_UART1OUTPROT << (8 * 2)) | (0x00 << (8 * 1)) | (VAL_ID_PROT_NMEA << (8 * 0));
380-
const uint32_t UBLOX_CFG_UART1OUTPROT_RTCM3X = ((VAL_GROUP_UART_SIZE << 4) << (8 * 3)) | (VAL_GROUP_UART1OUTPROT << (8 * 2)) | (0x00 << (8 * 1)) | (VAL_ID_PROT_RTCM3 << (8 * 0));
381-
382347
// Configuration Sub-Section mask definitions for saveConfigSelective (UBX-CFG-CFG)
383348
const uint32_t VAL_CFG_SUBSEC_IOPORT = 0x00000001; // ioPort - communications port settings (causes IO system reset!)
384349
const uint32_t VAL_CFG_SUBSEC_MSGCONF = 0x00000002; // msgConf - message configuration

src/u-blox_config_keys.h

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
//The following consts are used to generate KEY values for the advanced protocol functions of VELGET/SET/DEL
2+
const uint8_t VAL_SIZE_1 = 0x01; //One bit
3+
const uint8_t VAL_SIZE_8 = 0x02; //One byte
4+
const uint8_t VAL_SIZE_16 = 0x03; //Two bytes
5+
const uint8_t VAL_SIZE_32 = 0x04; //Four bytes
6+
const uint8_t VAL_SIZE_64 = 0x05; //Eight bytes
7+
8+
//These are the Bitfield layers definitions for the UBX-CFG-VALSET message (not to be confused with Bitfield deviceMask in UBX-CFG-CFG)
9+
const uint8_t VAL_LAYER_RAM = (1 << 0);
10+
const uint8_t VAL_LAYER_BBR = (1 << 1);
11+
const uint8_t VAL_LAYER_FLASH = (1 << 2);
12+
const uint8_t VAL_LAYER_ALL = VAL_LAYER_RAM | VAL_LAYER_BBR | VAL_LAYER_FLASH; //Not valid with getVal()
13+
14+
//Below are various Groups, IDs, and sizes for various settings
15+
//These can be used to call getVal/setVal/delVal
16+
const uint8_t VAL_ID_PROT_UBX = 0x01;
17+
const uint8_t VAL_ID_PROT_NMEA = 0x02;
18+
const uint8_t VAL_ID_PROT_RTCM3 = 0x04;
19+
20+
const uint8_t VAL_GROUP_I2C = 0x51;
21+
const uint8_t VAL_GROUP_I2COUTPROT = 0x72;
22+
const uint8_t VAL_GROUP_UART1INPROT = 0x73;
23+
const uint8_t VAL_GROUP_UART1OUTPROT = 0x74;
24+
const uint8_t VAL_GROUP_UART2INPROT = 0x75;
25+
const uint8_t VAL_GROUP_UART2OUTPROT = 0x76;
26+
const uint8_t VAL_GROUP_USBINPROT = 0x77;
27+
const uint8_t VAL_GROUP_USBOUTPROT = 0x78;
28+
29+
const uint8_t VAL_GROUP_UART_SIZE = VAL_SIZE_1; //All fields in UART group are currently 1 bit
30+
const uint8_t VAL_GROUP_I2C_SIZE = VAL_SIZE_8; //All fields in I2C group are currently 1 byte
31+
32+
const uint8_t VAL_ID_I2C_ADDRESS = 0x01;
33+
34+
const uint32_t UBLOX_CFG_I2C_ADDRESS = 0x20510001;
35+
const uint32_t UBLOX_CFG_I2C_ENABLED = 0x10510003;
36+
37+
const uint32_t UBLOX_CFG_I2CINPROT_UBX = 0x10710001;
38+
const uint32_t UBLOX_CFG_I2CINPROT_NMEA = 0x10710002;
39+
const uint32_t UBLOX_CFG_I2CINPROT_RTCM3X = 0x10710004;
40+
41+
const uint32_t UBLOX_CFG_I2COUTPROT_UBX = 0x10720001;
42+
const uint32_t UBLOX_CFG_I2COUTPROT_NMEA = 0x10720002;
43+
const uint32_t UBLOX_CFG_I2COUTPROT_RTCM3X = 0x10720004;
44+
45+
const uint32_t UBLOX_CFG_UART1INPROT_UBX = ((VAL_GROUP_UART_SIZE << 4) << (8 * 3)) | (VAL_GROUP_UART1INPROT << (8 * 2)) | (0x00 << (8 * 1)) | (VAL_ID_PROT_UBX << (8 * 0)); //0x10730001
46+
const uint32_t UBLOX_CFG_UART1INPROT_NMEA = ((VAL_GROUP_UART_SIZE << 4) << (8 * 3)) | (VAL_GROUP_UART1INPROT << (8 * 2)) | (0x00 << (8 * 1)) | (VAL_ID_PROT_NMEA << (8 * 0));
47+
const uint32_t UBLOX_CFG_UART1INPROT_RTCM3X = ((VAL_GROUP_UART_SIZE << 4) << (8 * 3)) | (VAL_GROUP_UART1INPROT << (8 * 2)) | (0x00 << (8 * 1)) | (VAL_ID_PROT_RTCM3 << (8 * 0));
48+
49+
const uint32_t UBLOX_CFG_UART1OUTPROT_UBX = ((VAL_GROUP_UART_SIZE << 4) << (8 * 3)) | (VAL_GROUP_UART1OUTPROT << (8 * 2)) | (0x00 << (8 * 1)) | (VAL_ID_PROT_UBX << (8 * 0));
50+
const uint32_t UBLOX_CFG_UART1OUTPROT_NMEA = ((VAL_GROUP_UART_SIZE << 4) << (8 * 3)) | (VAL_GROUP_UART1OUTPROT << (8 * 2)) | (0x00 << (8 * 1)) | (VAL_ID_PROT_NMEA << (8 * 0));
51+
const uint32_t UBLOX_CFG_UART1OUTPROT_RTCM3X = ((VAL_GROUP_UART_SIZE << 4) << (8 * 3)) | (VAL_GROUP_UART1OUTPROT << (8 * 2)) | (0x00 << (8 * 1)) | (VAL_ID_PROT_RTCM3 << (8 * 0));
52+
53+
const uint32_t UBLOX_CFG_UART2INPROT_UBX = ((VAL_GROUP_UART_SIZE << 4) << (8 * 3)) | (VAL_GROUP_UART2INPROT << (8 * 2)) | (0x00 << (8 * 1)) | (VAL_ID_PROT_UBX << (8 * 0));
54+
const uint32_t UBLOX_CFG_UART2INPROT_NMEA = ((VAL_GROUP_UART_SIZE << 4) << (8 * 3)) | (VAL_GROUP_UART2INPROT << (8 * 2)) | (0x00 << (8 * 1)) | (VAL_ID_PROT_NMEA << (8 * 0));
55+
const uint32_t UBLOX_CFG_UART2INPROT_RTCM3X = ((VAL_GROUP_UART_SIZE << 4) << (8 * 3)) | (VAL_GROUP_UART2INPROT << (8 * 2)) | (0x00 << (8 * 1)) | (VAL_ID_PROT_RTCM3 << (8 * 0));
56+
57+
const uint32_t UBLOX_CFG_UART2OUTPROT_UBX = ((VAL_GROUP_UART_SIZE << 4) << (8 * 3)) | (VAL_GROUP_UART2OUTPROT << (8 * 2)) | (0x00 << (8 * 1)) | (VAL_ID_PROT_UBX << (8 * 0));
58+
const uint32_t UBLOX_CFG_UART2OUTPROT_NMEA = ((VAL_GROUP_UART_SIZE << 4) << (8 * 3)) | (VAL_GROUP_UART2OUTPROT << (8 * 2)) | (0x00 << (8 * 1)) | (VAL_ID_PROT_NMEA << (8 * 0));
59+
const uint32_t UBLOX_CFG_UART2OUTPROT_RTCM3X = ((VAL_GROUP_UART_SIZE << 4) << (8 * 3)) | (VAL_GROUP_UART2OUTPROT << (8 * 2)) | (0x00 << (8 * 1)) | (VAL_ID_PROT_RTCM3 << (8 * 0));
60+
61+
const uint32_t UBLOX_CFG_USBINPROT_UBX = 0x10770001;
62+
const uint32_t UBLOX_CFG_USBINPROT_NMEA = 0x10770002;
63+
const uint32_t UBLOX_CFG_USBINPROT_RTCM3X = 0x10770004;
64+
65+
const uint32_t UBLOX_CFG_USBOUTPROT_UBX = ((VAL_GROUP_UART_SIZE << 4) << (8 * 3)) | (VAL_GROUP_USBOUTPROT << (8 * 2)) | (0x00 << (8 * 1)) | (VAL_ID_PROT_UBX << (8 * 0));
66+
const uint32_t UBLOX_CFG_USBOUTPROT_NMEA = ((VAL_GROUP_UART_SIZE << 4) << (8 * 3)) | (VAL_GROUP_USBOUTPROT << (8 * 2)) | (0x00 << (8 * 1)) | (VAL_ID_PROT_NMEA << (8 * 0));
67+
const uint32_t UBLOX_CFG_USBOUTPROT_RTCM3X = ((VAL_GROUP_UART_SIZE << 4) << (8 * 3)) | (VAL_GROUP_USBOUTPROT << (8 * 2)) | (0x00 << (8 * 1)) | (VAL_ID_PROT_RTCM3 << (8 * 0));

0 commit comments

Comments
 (0)