Skip to content

Commit d6b1d63

Browse files
authored
Merge pull request #1 from m5stack/dev
Add source code
2 parents 54a9548 + ecd8ab5 commit d6b1d63

32 files changed

+1532
-232
lines changed

.clang-format

Lines changed: 0 additions & 170 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
Language: C
21
BasedOnStyle: Google
32
AccessModifierOffset: -4
43
AlignAfterOpenBracket: Align
@@ -163,172 +162,3 @@ StatementMacros:
163162
TabWidth: 4
164163
UseCRLF: false
165164
UseTab: Never
166-
...
167-
168-
---
169-
Language: Cpp
170-
BasedOnStyle: Google
171-
AccessModifierOffset: -4
172-
AlignAfterOpenBracket: Align
173-
AlignConsecutiveMacros: true
174-
AlignConsecutiveAssignments: true
175-
AlignConsecutiveDeclarations: false
176-
AlignEscapedNewlines: Left
177-
AlignOperands: true
178-
AlignTrailingComments: true
179-
AllowAllArgumentsOnNextLine: true
180-
AllowAllConstructorInitializersOnNextLine: true
181-
AllowAllParametersOfDeclarationOnNextLine: true
182-
AllowShortBlocksOnASingleLine: Never
183-
AllowShortCaseLabelsOnASingleLine: false
184-
AllowShortFunctionsOnASingleLine: false
185-
AllowShortLambdasOnASingleLine: All
186-
AllowShortIfStatementsOnASingleLine: WithoutElse
187-
AllowShortLoopsOnASingleLine: true
188-
AlwaysBreakAfterDefinitionReturnType: None
189-
AlwaysBreakAfterReturnType: None
190-
AlwaysBreakBeforeMultilineStrings: true
191-
AlwaysBreakTemplateDeclarations: Yes
192-
BinPackArguments: true
193-
BinPackParameters: true
194-
BraceWrapping:
195-
AfterCaseLabel: false
196-
AfterClass: false
197-
AfterControlStatement: false
198-
AfterEnum: false
199-
AfterFunction: true
200-
AfterNamespace: false
201-
AfterObjCDeclaration: false
202-
AfterStruct: false
203-
AfterUnion: false
204-
AfterExternBlock: false
205-
BeforeCatch: false
206-
BeforeElse: false
207-
IndentBraces: false
208-
SplitEmptyFunction: true
209-
SplitEmptyRecord: true
210-
SplitEmptyNamespace: true
211-
BreakBeforeBinaryOperators: None
212-
BreakBeforeBraces: Custom
213-
BreakBeforeInheritanceComma: false
214-
BreakInheritanceList: BeforeColon
215-
BreakBeforeTernaryOperators: true
216-
BreakConstructorInitializersBeforeComma: false
217-
BreakConstructorInitializers: BeforeColon
218-
BreakAfterJavaFieldAnnotations: false
219-
BreakStringLiterals: true
220-
ColumnLimit: 120
221-
CommentPragmas: '^ IWYU pragma:'
222-
CompactNamespaces: false
223-
ConstructorInitializerAllOnOneLineOrOnePerLine: true
224-
ConstructorInitializerIndentWidth: 4
225-
ContinuationIndentWidth: 4
226-
Cpp11BracedListStyle: true
227-
DeriveLineEnding: true
228-
DerivePointerAlignment: true
229-
DisableFormat: false
230-
ExperimentalAutoDetectBinPacking: false
231-
FixNamespaceComments: true
232-
ForEachMacros:
233-
- foreach
234-
- Q_FOREACH
235-
- BOOST_FOREACH
236-
IncludeBlocks: Regroup
237-
IncludeCategories:
238-
- Regex: '^<ext/.*\.h>'
239-
Priority: 2
240-
SortPriority: 0
241-
- Regex: '^<.*\.h>'
242-
Priority: 1
243-
SortPriority: 0
244-
- Regex: '^<.*'
245-
Priority: 2
246-
SortPriority: 0
247-
- Regex: '.*'
248-
Priority: 3
249-
SortPriority: 0
250-
IncludeIsMainRegex: '([-_](test|unittest))?$'
251-
IncludeIsMainSourceRegex: ''
252-
IndentCaseLabels: true
253-
IndentGotoLabels: true
254-
IndentPPDirectives: None
255-
IndentWidth: 4
256-
IndentWrappedFunctionNames: false
257-
JavaScriptQuotes: Leave
258-
JavaScriptWrapImports: true
259-
KeepEmptyLinesAtTheStartOfBlocks: false
260-
MacroBlockBegin: ''
261-
MacroBlockEnd: ''
262-
MaxEmptyLinesToKeep: 1
263-
NamespaceIndentation: None
264-
ObjCBinPackProtocolList: Never
265-
ObjCBlockIndentWidth: 2
266-
ObjCSpaceAfterProperty: false
267-
ObjCSpaceBeforeProtocolList: true
268-
PenaltyBreakAssignment: 2
269-
PenaltyBreakBeforeFirstCallParameter: 1
270-
PenaltyBreakComment: 300
271-
PenaltyBreakFirstLessLess: 120
272-
PenaltyBreakString: 1000
273-
PenaltyBreakTemplateDeclaration: 10
274-
PenaltyExcessCharacter: 1000000
275-
PenaltyReturnTypeOnItsOwnLine: 200
276-
PointerAlignment: Left
277-
RawStringFormats:
278-
- Language: Cpp
279-
Delimiters:
280-
- cc
281-
- CC
282-
- cpp
283-
- Cpp
284-
- CPP
285-
- 'c++'
286-
- 'C++'
287-
CanonicalDelimiter: ''
288-
BasedOnStyle: google
289-
- Language: TextProto
290-
Delimiters:
291-
- pb
292-
- PB
293-
- proto
294-
- PROTO
295-
EnclosingFunctions:
296-
- EqualsProto
297-
- EquivToProto
298-
- PARSE_PARTIAL_TEXT_PROTO
299-
- PARSE_TEST_PROTO
300-
- PARSE_TEXT_PROTO
301-
- ParseTextOrDie
302-
- ParseTextProtoOrDie
303-
CanonicalDelimiter: ''
304-
BasedOnStyle: google
305-
ReflowComments: true
306-
SortIncludes: false
307-
SortUsingDeclarations: true
308-
SpaceAfterCStyleCast: false
309-
SpaceAfterLogicalNot: false
310-
SpaceAfterTemplateKeyword: true
311-
SpaceBeforeAssignmentOperators: true
312-
SpaceBeforeCpp11BracedList: false
313-
SpaceBeforeCtorInitializerColon: true
314-
SpaceBeforeInheritanceColon: true
315-
SpaceBeforeParens: ControlStatements
316-
SpaceBeforeRangeBasedForLoopColon: true
317-
SpaceInEmptyBlock: false
318-
SpaceInEmptyParentheses: false
319-
SpacesBeforeTrailingComments: 2
320-
SpacesInAngles: false
321-
SpacesInConditionalStatement: false
322-
SpacesInContainerLiterals: true
323-
SpacesInCStyleCastParentheses: false
324-
SpacesInParentheses: false
325-
SpacesInSquareBrackets: false
326-
SpaceBeforeSquareBrackets: false
327-
Standard: Auto
328-
StatementMacros:
329-
- Q_UNUSED
330-
- QT_REQUIRE_VERSION
331-
TabWidth: 4
332-
UseCRLF: false
333-
UseTab: Never
334-
...

.github/ISSUE_TEMPLATE/bug-report.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ body:
7676
label: Issue checklist
7777
description: Please double-check that you have done each of the following things before submitting the issue.
7878
options:
79-
- label: I searched for previous reports in [the issue tracker](https://github.com/m5stack/M5Stack/issues?q=)
79+
- label: I searched for previous reports in [the issue tracker](https://github.com/m5stack/M5PaperS3-UserDemo/issues?q=)
8080
required: true
8181
- label: My report contains all necessary details
8282
required: true

.github/workflows/Arduino-Lint-Check.yml

Lines changed: 0 additions & 27 deletions
This file was deleted.

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
# Build files
3838
build/
3939
cmake-build-*/
40+
components/
4041
managed_components/
4142

4243
# PlatformIO
@@ -59,3 +60,6 @@ bin/
5960
obj/
6061

6162
*.code-workspace
63+
64+
sdkconfig
65+
sdkconfig.old

CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# The following five lines of boilerplate have to be in your project's
2+
# CMakeLists in this exact order for cmake to work correctly
3+
cmake_minimum_required(VERSION 3.16)
4+
5+
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
6+
project(papers3)

README.md

Lines changed: 23 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,37 @@
1-
# Product Name
1+
# PaperS3 User Demo
22

3-
## Overview
3+
User demo source code of [PaperS3](https://docs.m5stack.com/en/core/PaperS3).
44

5-
### SKU:xxx
5+
## Build
66

7-
Description of the product
7+
### Fetch Dependencies
88

9-
## Related Link
9+
```bash
10+
python ./fetch_repos.py
11+
```
1012

11-
- [Document & Datasheet](https://docs.m5stack.com/en/unit/product_Link)
13+
### Tool Chains
1214

13-
## Required Libraries:
15+
[ESP-IDF v5.3.3](https://docs.espressif.com/projects/esp-idf/en/v5.3.3/esp32s3/index.html)
1416

15-
- [Adafruit_BMP280_Library](https://github.com/adafruit/Required_Libraries_Link)
17+
### Build
1618

17-
## License
19+
```bash
20+
idf.py build
21+
```
1822

19-
- [Product Name- MIT](LICENSE)
23+
### Flash
2024

21-
## Remaining steps(Editorial Staff Look,After following the steps, remember to delete all the content below)
25+
```bash
26+
idf.py flash
27+
```
2228

23-
1. Change [clang format check path](./.github/workflows/clang-format-check.yml#L42-L47).
24-
2. Add License content to [LICENSE](/LICENSE).
25-
3. Change link on line 78 of [bug-report.yml](./.github/ISSUE_TEMPLATE/bug-report.yml#L79).
29+
## Acknowledgments
2630

27-
```cpp
28-
Example
29-
# M5Unit-ENV
31+
This project references the following open-source libraries and resources:
3032

31-
## Overview
33+
- https://github.com/m5stack/M5GFX.git
34+
- https://github.com/m5stack/M5Unified.git
35+
- https://github.com/Forairaaaaa/mooncake
36+
- https://github.com/Forairaaaaa/mooncake_log
3237

33-
### SKU:U001 & U001-B & U001-C
34-
35-
Contains M5Stack-**UNIT ENV** series related case programs.ENV is an environmental sensor with integrated SHT30 and QMP6988 internally to detect temperature, humidity, and atmospheric pressure data.
36-
37-
## Related Link
38-
39-
- [Document & Datasheet](https://docs.m5stack.com/en/unit/envIII)
40-
41-
## Required Libraries:
42-
43-
- [Adafruit_BMP280_Library](https://github.com/adafruit/Adafruit_BMP280_Library)
44-
45-
## License
46-
47-
- [M5Unit-ENV - MIT](LICENSE)
48-
```

dependencies.lock

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
dependencies:
2+
idf:
3+
source:
4+
type: idf
5+
version: 5.3.3
6+
manifest_hash: 8622a8460fc97b1733c52dd6baf81ad1ba4ebea46542733fc63ae1bebcb2ba3c
7+
target: esp32s3
8+
version: 2.0.0

fetch_repos.py

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
import os
2+
import subprocess
3+
import json
4+
5+
6+
def clone_or_update_repo(
7+
repo_url, path, ref=None, with_submodules=False, patch_path=None
8+
):
9+
import os
10+
11+
if not os.path.exists(path):
12+
subprocess.run(["git", "clone", repo_url, path], check=True)
13+
else:
14+
subprocess.run(["git", "-C", path, "fetch"], check=True)
15+
16+
if ref:
17+
subprocess.run(["git", "-C", path, "checkout", ref], check=True)
18+
19+
if with_submodules:
20+
subprocess.run(
21+
["git", "-C", path, "submodule", "update", "--init", "--recursive"],
22+
check=True,
23+
)
24+
25+
# 应用 patch
26+
if patch_path:
27+
patch_full_path = (
28+
patch_path
29+
if os.path.isabs(patch_path)
30+
else os.path.join(os.getcwd(), patch_path)
31+
)
32+
# 使用 git apply --check 先检测补丁是否能应用,避免报错
33+
check_result = subprocess.run(
34+
["git", "-C", path, "apply", "--check", patch_full_path]
35+
)
36+
if check_result.returncode == 0:
37+
subprocess.run(["git", "-C", path, "apply", patch_full_path], check=True)
38+
print(f"Applied patch {patch_path} to {path}")
39+
else:
40+
print(f"Patch {patch_path} cannot be applied cleanly to {path}, skipped.")
41+
42+
43+
def fetch_dependencies():
44+
script_dir = os.path.dirname(os.path.abspath(__file__))
45+
config_path = os.path.join(script_dir, "repos.json")
46+
47+
with open(config_path) as f:
48+
repos = json.load(f)
49+
50+
for repo in repos:
51+
repo_path = os.path.join(script_dir, repo["path"])
52+
branch = repo.get("branch")
53+
with_submodules = repo.get("with_submodules", False)
54+
patch = repo.get("patch")
55+
if patch and not os.path.isabs(patch):
56+
patch = os.path.join(script_dir, patch)
57+
clone_or_update_repo(repo["url"], repo_path, branch, with_submodules, patch)
58+
59+
60+
if __name__ == "__main__":
61+
fetch_dependencies()

0 commit comments

Comments
 (0)