Skip to content

Commit f38b502

Browse files
authored
Merge pull request #810 from adafruit/offline-qmc5883p-after-mlx
Offline qmc5883p+AS5600 (after mlx) - with added Vector value support
2 parents 30a4fb1 + 524d1f3 commit f38b502

File tree

12 files changed

+1023
-33
lines changed

12 files changed

+1023
-33
lines changed

.clang-format

Lines changed: 243 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,243 @@
1+
Language: Cpp
2+
# BasedOnStyle: LLVM
3+
AccessModifierOffset: -2
4+
AlignAfterOpenBracket: Align
5+
AlignArrayOfStructures: None
6+
AlignConsecutiveAssignments:
7+
Enabled: false
8+
AcrossEmptyLines: false
9+
AcrossComments: false
10+
AlignCompound: false
11+
AlignFunctionPointers: false
12+
PadOperators: true
13+
AlignConsecutiveBitFields:
14+
Enabled: false
15+
AcrossEmptyLines: false
16+
AcrossComments: false
17+
AlignCompound: false
18+
AlignFunctionPointers: false
19+
PadOperators: false
20+
AlignConsecutiveDeclarations:
21+
Enabled: false
22+
AcrossEmptyLines: false
23+
AcrossComments: false
24+
AlignCompound: false
25+
AlignFunctionPointers: false
26+
PadOperators: false
27+
AlignConsecutiveMacros:
28+
Enabled: false
29+
AcrossEmptyLines: false
30+
AcrossComments: false
31+
AlignCompound: false
32+
AlignFunctionPointers: false
33+
PadOperators: false
34+
AlignConsecutiveShortCaseStatements:
35+
Enabled: false
36+
AcrossEmptyLines: false
37+
AcrossComments: false
38+
AlignCaseColons: false
39+
AlignEscapedNewlines: Right
40+
AlignOperands: Align
41+
AlignTrailingComments:
42+
Kind: Always
43+
OverEmptyLines: 0
44+
AllowAllArgumentsOnNextLine: true
45+
AllowAllParametersOfDeclarationOnNextLine: true
46+
AllowBreakBeforeNoexceptSpecifier: Never
47+
AllowShortBlocksOnASingleLine: Never
48+
AllowShortCaseLabelsOnASingleLine: false
49+
AllowShortCompoundRequirementOnASingleLine: true
50+
AllowShortEnumsOnASingleLine: true
51+
AllowShortFunctionsOnASingleLine: All
52+
AllowShortIfStatementsOnASingleLine: Never
53+
AllowShortLambdasOnASingleLine: All
54+
AllowShortLoopsOnASingleLine: false
55+
AlwaysBreakAfterDefinitionReturnType: None
56+
AlwaysBreakAfterReturnType: None
57+
AlwaysBreakBeforeMultilineStrings: false
58+
AlwaysBreakTemplateDeclarations: MultiLine
59+
AttributeMacros:
60+
- __capability
61+
BinPackArguments: true
62+
BinPackParameters: true
63+
BitFieldColonSpacing: Both
64+
BraceWrapping:
65+
AfterCaseLabel: false
66+
AfterClass: false
67+
AfterControlStatement: Never
68+
AfterEnum: false
69+
AfterExternBlock: false
70+
AfterFunction: false
71+
AfterNamespace: false
72+
AfterObjCDeclaration: false
73+
AfterStruct: false
74+
AfterUnion: false
75+
BeforeCatch: false
76+
BeforeElse: false
77+
BeforeLambdaBody: false
78+
BeforeWhile: false
79+
IndentBraces: false
80+
SplitEmptyFunction: true
81+
SplitEmptyRecord: true
82+
SplitEmptyNamespace: true
83+
BreakAdjacentStringLiterals: true
84+
BreakAfterAttributes: Leave
85+
BreakAfterJavaFieldAnnotations: false
86+
BreakArrays: true
87+
BreakBeforeBinaryOperators: None
88+
BreakBeforeConceptDeclarations: Always
89+
BreakBeforeBraces: Attach
90+
BreakBeforeInlineASMColon: OnlyMultiline
91+
BreakBeforeTernaryOperators: true
92+
BreakConstructorInitializers: BeforeColon
93+
BreakInheritanceList: BeforeColon
94+
BreakStringLiterals: true
95+
ColumnLimit: 80
96+
CommentPragmas: '^ IWYU pragma:'
97+
CompactNamespaces: false
98+
ConstructorInitializerIndentWidth: 4
99+
ContinuationIndentWidth: 4
100+
Cpp11BracedListStyle: true
101+
DerivePointerAlignment: false
102+
DisableFormat: false
103+
EmptyLineAfterAccessModifier: Never
104+
EmptyLineBeforeAccessModifier: LogicalBlock
105+
ExperimentalAutoDetectBinPacking: false
106+
FixNamespaceComments: true
107+
ForEachMacros:
108+
- foreach
109+
- Q_FOREACH
110+
- BOOST_FOREACH
111+
IfMacros:
112+
- KJ_IF_MAYBE
113+
IncludeBlocks: Preserve
114+
IncludeCategories:
115+
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
116+
Priority: 2
117+
SortPriority: 0
118+
CaseSensitive: false
119+
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
120+
Priority: 3
121+
SortPriority: 0
122+
CaseSensitive: false
123+
- Regex: '.*'
124+
Priority: 1
125+
SortPriority: 0
126+
CaseSensitive: false
127+
IncludeIsMainRegex: '(Test)?$'
128+
IncludeIsMainSourceRegex: ''
129+
IndentAccessModifiers: false
130+
IndentCaseBlocks: false
131+
IndentCaseLabels: false
132+
IndentExternBlock: AfterExternBlock
133+
IndentGotoLabels: true
134+
IndentPPDirectives: None
135+
IndentRequiresClause: true
136+
IndentWidth: 2
137+
IndentWrappedFunctionNames: false
138+
InsertBraces: false
139+
InsertNewlineAtEOF: false
140+
InsertTrailingCommas: None
141+
IntegerLiteralSeparator:
142+
Binary: 0
143+
BinaryMinDigits: 0
144+
Decimal: 0
145+
DecimalMinDigits: 0
146+
Hex: 0
147+
HexMinDigits: 0
148+
JavaScriptQuotes: Leave
149+
JavaScriptWrapImports: true
150+
KeepEmptyLinesAtTheStartOfBlocks: true
151+
KeepEmptyLinesAtEOF: false
152+
LambdaBodyIndentation: Signature
153+
LineEnding: DeriveLF
154+
MacroBlockBegin: ''
155+
MacroBlockEnd: ''
156+
MaxEmptyLinesToKeep: 1
157+
NamespaceIndentation: None
158+
ObjCBinPackProtocolList: Auto
159+
ObjCBlockIndentWidth: 2
160+
ObjCBreakBeforeNestedBlockParam: true
161+
ObjCSpaceAfterProperty: false
162+
ObjCSpaceBeforeProtocolList: true
163+
PackConstructorInitializers: BinPack
164+
PenaltyBreakAssignment: 2
165+
PenaltyBreakBeforeFirstCallParameter: 19
166+
PenaltyBreakComment: 300
167+
PenaltyBreakFirstLessLess: 120
168+
PenaltyBreakOpenParenthesis: 0
169+
PenaltyBreakScopeResolution: 500
170+
PenaltyBreakString: 1000
171+
PenaltyBreakTemplateDeclaration: 10
172+
PenaltyExcessCharacter: 1000000
173+
PenaltyIndentedWhitespace: 0
174+
PenaltyReturnTypeOnItsOwnLine: 60
175+
PointerAlignment: Right
176+
PPIndentWidth: -1
177+
QualifierAlignment: Leave
178+
ReferenceAlignment: Pointer
179+
ReflowComments: true
180+
RemoveBracesLLVM: false
181+
RemoveParentheses: Leave
182+
RemoveSemicolon: false
183+
RequiresClausePosition: OwnLine
184+
RequiresExpressionIndentation: OuterScope
185+
SeparateDefinitionBlocks: Leave
186+
ShortNamespaceLines: 1
187+
SkipMacroDefinitionBody: false
188+
SortIncludes: CaseSensitive
189+
SortJavaStaticImport: Before
190+
SortUsingDeclarations: LexicographicNumeric
191+
SpaceAfterCStyleCast: false
192+
SpaceAfterLogicalNot: false
193+
SpaceAfterTemplateKeyword: true
194+
SpaceAroundPointerQualifiers: Default
195+
SpaceBeforeAssignmentOperators: true
196+
SpaceBeforeCaseColon: false
197+
SpaceBeforeCpp11BracedList: false
198+
SpaceBeforeCtorInitializerColon: true
199+
SpaceBeforeInheritanceColon: true
200+
SpaceBeforeJsonColon: false
201+
SpaceBeforeParens: ControlStatements
202+
SpaceBeforeParensOptions:
203+
AfterControlStatements: true
204+
AfterForeachMacros: true
205+
AfterFunctionDefinitionName: false
206+
AfterFunctionDeclarationName: false
207+
AfterIfMacros: true
208+
AfterOverloadedOperator: false
209+
AfterPlacementOperator: true
210+
AfterRequiresInClause: false
211+
AfterRequiresInExpression: false
212+
BeforeNonEmptyParentheses: false
213+
SpaceBeforeRangeBasedForLoopColon: true
214+
SpaceBeforeSquareBrackets: false
215+
SpaceInEmptyBlock: false
216+
SpacesBeforeTrailingComments: 1
217+
SpacesInAngles: Never
218+
SpacesInContainerLiterals: true
219+
SpacesInLineCommentPrefix:
220+
Minimum: 1
221+
Maximum: -1
222+
SpacesInParens: Never
223+
SpacesInParensOptions:
224+
InCStyleCasts: false
225+
InConditionalStatements: false
226+
InEmptyParentheses: false
227+
Other: false
228+
SpacesInSquareBrackets: false
229+
Standard: Latest
230+
StatementAttributeLikeMacros:
231+
- Q_EMIT
232+
StatementMacros:
233+
- Q_UNUSED
234+
- QT_REQUIRE_VERSION
235+
TabWidth: 8
236+
UseTab: Never
237+
VerilogBreakBetweenInstancePorts: true
238+
WhitespaceSensitiveMacros:
239+
- BOOST_PP_STRINGIZE
240+
- CF_SWIFT_NAME
241+
- NS_SWIFT_NAME
242+
- PP_STRINGIZE
243+
- STRINGIZE

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ paragraph=Arduino application for Adafruit.io WipperSnapper
77
category=Communication
88
url=https://github.com/adafruit/Adafruit_Wippersnapper_Arduino
99
architectures=*
10-
depends=OmronD6T - Community Fork, SdFat - Adafruit Fork, Adafruit NeoPixel, Adafruit SPIFlash, ArduinoJson, Adafruit DotStar, Adafruit HDC302x, Adafruit INA219, Adafruit INA237 and INA238 Library, Adafruit INA260 Library, Adafruit LTR329 and LTR303, Adafruit LTR390 Library, Adafruit MCP3421, Adafruit MLX90632 Library, Adafruit NAU7802 Library, Adafruit SleepyDog Library, Adafruit TMP117, Adafruit TinyUSB Library, Adafruit AHTX0, Adafruit BME280 Library, Adafruit BMP280 Library, Adafruit BMP3XX Library, Adafruit DPS310, Adafruit DS248x, Adafruit SCD30, Adafruit SGP30 Sensor, Adafruit SGP40 Sensor, Sensirion I2C SCD4x, Sensirion I2C SEN5X, Sensirion I2C SEN66, arduino-sht, Adafruit Si7021 Library, Adafruit MQTT Library, Adafruit MS8607, Adafruit MCP9808 Library, Adafruit MCP9600 Library, Adafruit MPL115A2, Adafruit MPRLS Library, Adafruit TSL2591 Library, Adafruit_VL53L0X, Adafruit VL53L1X, STM32duino VL53L4CD, STM32duino VL53L4CX, Adafruit_VL6180X, Adafruit PM25 AQI Sensor, Adafruit VCNL4020 Library, Adafruit VCNL4040, Adafruit VCNL4200 Library, Adafruit VEML7700 Library, Adafruit LC709203F, Adafruit LPS2X, Adafruit LPS28, Adafruit LPS35HW, Adafruit seesaw Library, Adafruit BME680 Library, Adafruit MAX1704X, Adafruit ADT7410 Library, Adafruit HTS221, Adafruit HTU21DF Library, Adafruit HTU31D Library, Adafruit PCT2075, hp_BH1750, ENS160 - Adafruit Fork, Adafruit BusIO, Adafruit Unified Sensor, Sensirion Core, Adafruit GFX Library, Adafruit LED Backpack Library, Adafruit LiquidCrystal, Adafruit SH110X, Adafruit SSD1306, RTClib, StreamUtils, Adafruit SHT4x Library, Adafruit GPS Library, Adafruit uBlox
10+
depends=OmronD6T - Community Fork, SdFat - Adafruit Fork, Adafruit AS5600 Library, Adafruit NeoPixel, Adafruit SPIFlash, ArduinoJson, Adafruit DotStar, Adafruit HDC302x, Adafruit INA219, Adafruit INA237 and INA238 Library, Adafruit INA260 Library, Adafruit LTR329 and LTR303, Adafruit LTR390 Library, Adafruit MCP3421, Adafruit MLX90632 Library, Adafruit NAU7802 Library, Adafruit SleepyDog Library, Adafruit TMP117, Adafruit TinyUSB Library, Adafruit AHTX0, Adafruit BME280 Library, Adafruit BMP280 Library, Adafruit BMP3XX Library, Adafruit DPS310, Adafruit DS248x, Adafruit SCD30, Adafruit SGP30 Sensor, Adafruit SGP40 Sensor, Sensirion I2C SCD4x, Sensirion I2C SEN5X, Sensirion I2C SEN66, arduino-sht, Adafruit Si7021 Library, Adafruit MQTT Library, Adafruit MS8607, Adafruit MCP9808 Library, Adafruit MCP9600 Library, Adafruit MPL115A2, Adafruit MPRLS Library, Adafruit TSL2591 Library, Adafruit_VL53L0X, Adafruit VL53L1X, STM32duino VL53L4CD, STM32duino VL53L4CX, Adafruit_VL6180X, Adafruit PM25 AQI Sensor, Adafruit QMC5883P Library, Adafruit VCNL4020 Library, Adafruit VCNL4040, Adafruit VCNL4200 Library, Adafruit VEML7700 Library, Adafruit LC709203F, Adafruit LPS2X, Adafruit LPS28, Adafruit LPS35HW, Adafruit seesaw Library, Adafruit BME680 Library, Adafruit MAX1704X, Adafruit ADT7410 Library, Adafruit HTS221, Adafruit HTU21DF Library, Adafruit HTU31D Library, Adafruit PCT2075, hp_BH1750, ENS160 - Adafruit Fork, Adafruit BusIO, Adafruit Unified Sensor, Sensirion Core, Adafruit GFX Library, Adafruit LED Backpack Library, Adafruit LiquidCrystal, Adafruit SH110X, Adafruit SSD1306, RTClib, StreamUtils, Adafruit SHT4x Library, Adafruit GPS Library, Adafruit uBlox

platformio.ini

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
; PlatformIO Defaults
77
[platformio]
88
description = "Adafruit.IO WipperSnapper Firmware"
9-
default_envs = adafruit_feather_esp32s3_tft, adafruit_magtag29_esp32s2, adafruit_feather_esp32s3, featheresp32s2, adafruit_feather_esp32s2_reversetft, adafruit_metro_esp32s2, adafruit_qtpy_esp32s2, adafruit_feather_esp32s3_reversetft, adafruit_feather_esp32s3_nopsram, adafruit_feather_esp32s2_tft, adafruit_qtpy_esp32, adafruit_qtpy_esp32c3, featheresp32, adafruit_qtpy_esp32s3_nopsram, featheresp32v2, huzzah, adafruit_pyportal_m4, adafruit_pyportal_m4_titano
9+
; default_envs = adafruit_feather_esp32s3_tft, adafruit_magtag29_esp32s2, adafruit_feather_esp32s3, featheresp32s2, adafruit_feather_esp32s2_reversetft, adafruit_metro_esp32s2, adafruit_qtpy_esp32s2, adafruit_feather_esp32s3_reversetft, adafruit_feather_esp32s3_nopsram, adafruit_feather_esp32s2_tft, adafruit_qtpy_esp32, adafruit_qtpy_esp32c3, featheresp32, adafruit_qtpy_esp32s3_nopsram, featheresp32v2, huzzah, adafruit_pyportal_m4, adafruit_pyportal_m4_titano
10+
default_envs = adafruit_metro_esp32s3, raspberypi_picow_debug
1011

1112

1213
; Common Build Environment
@@ -48,6 +49,7 @@ lib_deps =
4849
adafruit/Adafruit LTR390 Library
4950
adafruit/Adafruit LTR329 and LTR303
5051
adafruit/Adafruit PCT2075
52+
adafruit/Adafruit QMC5883P Library
5153
adafruit/Adafruit SCD30
5254
adafruit/Adafruit SGP30 Sensor
5355
adafruit/Adafruit SGP40 Sensor
@@ -59,6 +61,7 @@ lib_deps =
5961
adafruit/Adafruit MCP9808 Library
6062
adafruit/Adafruit MCP9600 Library
6163
adafruit/Adafruit MLX90632 Library
64+
adafruit/Adafruit AS5600 Library
6265
adafruit/Adafruit MPL115A2
6366
adafruit/Adafruit MPRLS Library
6467
adafruit/Adafruit MS8607
@@ -274,6 +277,10 @@ build_flags = -DARDUINO_METRO_ESP32S3 -DBOARD_HAS_PSRAM
274277
;set partition to tinyuf2-partitions-16MB.csv as of idf 5.1
275278
board_build.partitions = tinyuf2-partitions-16MB.csv
276279
extra_scripts = pre:rename_usb_config.py
280+
debug_tool = jlink
281+
; debug_init_break = tbreak ws_sdcard.cpp:1000
282+
; upload_protocol = jlink
283+
277284

278285
; Adafruit Funhouse ESP32-S2
279286
[env:adafruit_funhouse_esp32s2]
@@ -288,7 +295,7 @@ extra_scripts = pre:rename_usb_config.py
288295
[env:adafruit_funhouse_esp32s2_debug]
289296
extends = common:esp32
290297
board = adafruit_funhouse_esp32s2
291-
;lib_extra_dirs =
298+
;lib_extra_dirs =
292299
build_type = debug
293300
build_flags =
294301
-DARDUINO_FUNHOUSE
@@ -421,13 +428,13 @@ monitor_port = auto
421428
; debug_init_break = tbreak clearConfiguration
422429
lib_ignore = USBHost
423430
build_flags = -DUSE_TINYUSB
424-
-D__SAMD51J20A__
425-
-DCRYSTALLESS
426-
-DADAFRUIT_PYPORTAL_M4_TITANO
427-
-D__SAMD51__
428-
-D__FPU_PRESENT
429-
-DARM_MATH_CM4
430-
-mfloat-abi=hard
431+
-D__SAMD51J20A__
432+
-DCRYSTALLESS
433+
-DADAFRUIT_PYPORTAL_M4_TITANO
434+
-D__SAMD51__
435+
-D__FPU_PRESENT
436+
-DARM_MATH_CM4
437+
-mfloat-abi=hard
431438
-mfpu=fpv4-sp-d16
432439
-DCORE_DEBUG_LEVEL=5
433440
-DARDUINO_USB_CDC_ON_BOOT=1
@@ -573,4 +580,3 @@ build_flags =
573580
; ; No USB stack
574581
; build_flags = -DPIO_FRAMEWORK_ARDUINO_NO_USB
575582
; -DPIO_FRAMEWORK_ARDUINO_ENABLE_IPV6
576-

src/Wippersnapper_V2.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1288,11 +1288,12 @@ void Wippersnapper_V2::connect() {
12881288
// Parse the JSON file
12891289
if (!WsV2._sdCardV2->ParseFileConfig())
12901290
haltErrorV2("[APP] Failed to parse config.json!");
1291-
WS_DEBUG_PRINTLN("[APP] Attempting to configure hardware...");
12921291
#ifndef OFFLINE_MODE_DEBUG
1292+
WS_DEBUG_PRINTLN("[APP] Creating new .log file on SD card...");
12931293
if (!WsV2._sdCardV2->CreateNewLogFile())
12941294
haltErrorV2("Unable to create new .log file on SD card!");
12951295
#endif
1296+
WS_DEBUG_PRINTLN("[APP] Attempting to configure hardware...");
12961297
// Call the TL signal decoder to parse the incoming JSON data
12971298
callDecodeB2D();
12981299
#ifndef OFFLINE_MODE_WOKWI

src/components/i2c/controller.cpp

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@ static const std::map<std::string, FnCreateI2CSensorDriver> I2cFactorySensor = {
5858
const char *driver_name) -> drvBase * {
5959
return new drvAhtx0(i2c, addr, mux_channel, driver_name);
6060
}},
61+
{"as5600",
62+
[](TwoWire *i2c, uint16_t addr, uint32_t mux_channel,
63+
const char *driver_name) -> drvBase * {
64+
return new drvAs5600(i2c, addr, mux_channel, driver_name);
65+
}},
6166
{"dht20",
6267
[](TwoWire *i2c, uint16_t addr, uint32_t mux_channel,
6368
const char *driver_name) -> drvBase * {
@@ -255,6 +260,11 @@ static const std::map<std::string, FnCreateI2CSensorDriver> I2cFactorySensor = {
255260
const char *driver_name) -> drvBase * {
256261
return new drvPm25(i2c, addr, mux_channel, driver_name);
257262
}},
263+
{"qmc5883p",
264+
[](TwoWire *i2c, uint16_t addr, uint32_t mux_channel,
265+
const char *driver_name) -> drvBase * {
266+
return new drvQmc5883p(i2c, addr, mux_channel, driver_name);
267+
}},
258268
{"scd40",
259269
[](TwoWire *i2c, uint16_t addr, uint32_t mux_channel,
260270
const char *driver_name) -> drvBase * {
@@ -411,6 +421,8 @@ static const std::unordered_map<uint16_t, std::vector<const char *>>
411421
{"ltr303", "pct2075", "tsl2591", "veml7700", "vl53l1x", "vl53l4cd",
412422
"vl53l4cx", "vl6180x"}},
413423
{0x2A, {"nau7802"}},
424+
{0x2C, {"qmc5883p"}},
425+
{0x36, {"as5600"}},
414426
{0x38, {"aht20", "max17048"}},
415427
{0x39, {"tsl2591"}},
416428
{0x3A, {"mlx90632"}},
@@ -1442,7 +1454,9 @@ void I2cController::update() {
14421454
sensors_event_t event = {0};
14431455
// Attempt to call driver's read handler function
14441456
if (!drv->GetSensorEvent(drv->_sensors[i], &event)) {
1445-
WS_DEBUG_PRINTLN("[i2c] ERROR: Failed to read sensor!");
1457+
WS_DEBUG_PRINT("[i2c] ERROR: Failed to read sensor! (");
1458+
WS_DEBUG_PRINT(drv->GetDrvName());
1459+
WS_DEBUG_PRINTLN(")");
14461460
continue;
14471461
}
14481462
// Fill the I2cDeviceEvent's sensor_event array submsg.

src/components/i2c/controller.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
// I2C Drivers
2121
#include "drivers/drvAdt7410.h"
2222
#include "drivers/drvAhtx0.h"
23+
#include "drivers/drvAs5600.h"
2324
#include "drivers/drvBase.h" ///< Base i2c input driver class
2425
#include "drivers/drvBh1750.h"
2526
#include "drivers/drvBme280.h"
@@ -59,6 +60,7 @@
5960
#include "drivers/drvOutputBase.h" ///< Base i2c output driver class
6061
#include "drivers/drvPct2075.h"
6162
#include "drivers/drvPm25.h"
63+
#include "drivers/drvQmc5883p.h"
6264
#include "drivers/drvScd30.h"
6365
#include "drivers/drvScd4x.h"
6466
#include "drivers/drvSen5x.h"

0 commit comments

Comments
 (0)