This repository was archived by the owner on Jan 28, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 85
Expand getVal/setVal method #134
Merged
Merged
Changes from 6 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
6efce21
Change default setVal to RAM+BBR+Flash. Expanding key set.
nseidle 55bb4a2
Move keys to separate file
nseidle 79679f8
Add getVal8/16/32. Add a bunch of keys.
nseidle 583f528
Add getVal8/16/32 support for group/id/size combos.
nseidle 0fb2fcf
Update Example1_GetSetPortSettings.ino
nseidle 30bff51
Merge branch 'release_candidate' into Expand-getVal-setVal
PaulZC d4975d4
Resort and rename get/setVal examples in one chunk.
nseidle 03a91e5
Remove duplicate define
nseidle 5102d9f
Add MSGOUT keys. Update examples to use defined keys.
nseidle 6239fc2
Adding header guard
nseidle File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
100 changes: 100 additions & 0 deletions
100
examples/GetSetVal/Example1_GetSetPortSettings/Example1_GetSetPortSettings.ino
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
/* | ||
Configuring port settings using the newer getVal/setVal methods | ||
By: Nathan Seidle | ||
SparkFun Electronics | ||
Date: October 23rd, 2020 | ||
License: MIT. See license file for more information but you can | ||
basically do whatever you want with this code. | ||
|
||
This example shows how to query a Ublox module for its UART1 settings and | ||
then change them if the settings aren't what we want. | ||
|
||
Note: getVal/setVal/delVal are only support in u-blox protocol versions 27 and higher. | ||
|
||
Feel like supporting open source hardware? | ||
Buy a board from SparkFun! | ||
ZED-F9P RTK2: https://www.sparkfun.com/products/15136 | ||
NEO-M8P RTK: https://www.sparkfun.com/products/15005 | ||
SAM-M8Q: https://www.sparkfun.com/products/15106 | ||
|
||
Hardware Connections: | ||
Plug a Qwiic cable into the GPS and a RedBoard | ||
If you don't have a platform with a Qwiic connection use the SparkFun Qwiic Breadboard Jumper (https://www.sparkfun.com/products/14425) | ||
Open the serial monitor at 115200 baud to see the output | ||
*/ | ||
|
||
#include <Wire.h> //Needed for I2C to GPS | ||
|
||
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_Ublox_GPS | ||
SFE_UBLOX_GPS myGPS; | ||
|
||
void setup() | ||
{ | ||
Serial.begin(115200); | ||
while (!Serial) | ||
; //Wait for user to open terminal | ||
Serial.println("SparkFun Ublox Example"); | ||
|
||
Wire.begin(); | ||
|
||
if (myGPS.begin() == false) //Connect to the Ublox module using Wire port | ||
{ | ||
Serial.println(F("Ublox GPS not detected at default I2C address. Please check wiring. Freezing.")); | ||
while (1) | ||
; | ||
} | ||
|
||
bool response = true; | ||
|
||
//Read the settings from RAM (what the module is running right now, not BBR, Flash, or default) | ||
uint8_t currentUART1Setting_ubx = myGPS.getVal8(UBLOX_CFG_UART1INPROT_UBX); | ||
uint8_t currentUART1Setting_nmea = myGPS.getVal8(UBLOX_CFG_UART1INPROT_NMEA); | ||
uint8_t currentUART1Setting_rtcm3 = myGPS.getVal8(UBLOX_CFG_UART1INPROT_RTCM3X); | ||
|
||
Serial.print("currentUART1Setting_ubx: "); | ||
Serial.println(currentUART1Setting_ubx); | ||
Serial.print("currentUART1Setting_nmea: "); | ||
Serial.println(currentUART1Setting_nmea); | ||
Serial.print("currentUART1Setting_rtcm3: "); | ||
Serial.println(currentUART1Setting_rtcm3); | ||
|
||
//Check if NMEA and RTCM are enabled for UART1 | ||
if (currentUART1Setting_ubx == 0 || currentUART1Setting_nmea == 0) | ||
{ | ||
Serial.println("Updating UART1 configuration"); | ||
|
||
//setVal sets the values for RAM, BBR, and Flash automatically so no .saveConfiguration() is needed | ||
response &= myGPS.setVal8(UBLOX_CFG_UART1INPROT_UBX, 1); //Enable UBX on UART1 Input | ||
response &= myGPS.setVal8(UBLOX_CFG_UART1INPROT_NMEA, 1); //Enable NMEA on UART1 Input | ||
response &= myGPS.setVal8(UBLOX_CFG_UART1INPROT_RTCM3X, 0); //Disable RTCM on UART1 Input | ||
|
||
if (response == false) | ||
Serial.println("SetVal failed"); | ||
else | ||
Serial.println("SetVal succeeded"); | ||
} | ||
else | ||
Serial.println("No port change needed"); | ||
|
||
//Change speed of UART2 | ||
uint32_t currentUART2Baud = myGPS.getVal32(UBLOX_CFG_UART2_BAUDRATE); | ||
Serial.print("currentUART2Baud: "); | ||
Serial.println(currentUART2Baud); | ||
|
||
if (currentUART2Baud != 57600) | ||
{ | ||
response &= myGPS.setVal32(UBLOX_CFG_UART2_BAUDRATE, 57600); | ||
if (response == false) | ||
Serial.println("SetVal failed"); | ||
else | ||
Serial.println("SetVal succeeded"); | ||
} | ||
else | ||
Serial.println("No baud change needed"); | ||
|
||
Serial.println("Done"); | ||
} | ||
|
||
void loop() | ||
{ | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.