mirror of
https://gitee.com/dlmu-cone/tronone-h7-scaffold
synced 2026-07-24 19:37:45 +08:00
Compare commits
181 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0602520e4f | ||
|
|
dc57b5152e | ||
|
|
8671f84139 | ||
|
|
b2169513e1 | ||
|
|
8928b7c7db | ||
|
|
9ea9ddf310 | ||
|
|
f92585831a | ||
|
|
cda936d7e0 | ||
|
|
d13729b162 | ||
|
|
bd7f8f2962 | ||
|
|
4f7817f9de | ||
|
|
59de1fafa4 | ||
|
|
47f5e4ddab | ||
|
|
f4c0424c45 | ||
|
|
591707d9fc | ||
|
|
aa6eefda50 | ||
|
|
e84c3e11f3 | ||
|
|
f06df047db | ||
|
|
4c2bff6257 | ||
|
|
0ccdd0a0d5 | ||
|
|
e3f5951881 | ||
|
|
a96e9e939c | ||
| 79afbaf68d | |||
| 28006c3bd0 | |||
| cf1bc7b2ae | |||
| 9c58a09eab | |||
|
|
5145d60794 | ||
|
|
b5863332b6 | ||
|
|
2f0ca6d906 | ||
| 50edf7dedb | |||
| cf161df939 | |||
| 483d5f0ac4 | |||
| db95e9e44d | |||
| 1e75c1a5e1 | |||
| c3fc805aca | |||
|
|
596d3d4c65 | ||
| 6d7d23ebba | |||
| ed4e6ff0d1 | |||
| f8b8616966 | |||
| d8563db2be | |||
| ede790e849 | |||
| 216c96c2c6 | |||
| 522d6a4545 | |||
| c0c7658b39 | |||
| 17ce43a7ef | |||
| ebe9ad087e | |||
| e515c97955 | |||
| a941a3719a | |||
| 58299949c5 | |||
| 834f9e573c | |||
| 75f7c3defd | |||
| 8458a4ffe7 | |||
| 8f22f67c5a | |||
| b00cfac6f6 | |||
| d27b8e8473 | |||
| a025289597 | |||
| f94b76b982 | |||
| 3704e1c689 | |||
| 9628c1eae0 | |||
| de9b19b72d | |||
| d2b7acd3d4 | |||
| 19278fa68f | |||
| 55d36d3812 | |||
| 4ec7340bc4 | |||
| 86650fd2bd | |||
| f27dad8242 | |||
| 1059a007a2 | |||
| 85e5c7d6a0 | |||
|
|
bda8bf1b43 | ||
|
|
c6a0c3f0cc | ||
| 93abe2381f | |||
|
|
59e545e3f2 | ||
|
|
2ea642d04a | ||
|
|
f92289346d | ||
|
|
8c66f57642 | ||
|
|
987c402751 | ||
|
|
a78fe6ea11 | ||
|
|
2d905efeb7 | ||
| 8ce7e064e8 | |||
|
|
ec509f0bf1 | ||
|
|
c021b4794c | ||
|
|
7522bc9974 | ||
|
|
80dd342a18 | ||
|
|
74a2ded88a | ||
|
|
0da5af5742 | ||
|
|
2c7c458769 | ||
|
|
c1ebb09358 | ||
|
|
72e8500a27 | ||
|
|
2a40c85a2b | ||
|
|
a57f882fc3 | ||
|
|
e664bca77b | ||
|
|
4bfdd87bab | ||
|
|
d23a73e4bf | ||
|
|
eb9ecf9c12 | ||
|
|
262cff7d16 | ||
|
|
41648fe75f | ||
|
|
d97528291a | ||
|
|
1ff64dea82 | ||
|
|
d49c023f3c | ||
|
|
8d88556f5f | ||
|
|
bc248a88f7 | ||
|
|
a5428702d7 | ||
|
|
a46ac6e1d8 | ||
|
|
922370eeec | ||
|
|
69f6a4f799 | ||
|
|
d5185b491a | ||
|
|
3d73aeea5d | ||
|
|
bed78b6505 | ||
|
|
56639afc18 | ||
|
|
d1e7f30373 | ||
|
|
e08ffe766f | ||
|
|
977f266a42 | ||
|
|
38264c53e1 | ||
|
|
66da7a1935 | ||
|
|
053563e951 | ||
|
|
ab01747052 | ||
|
|
de8a0d5117 | ||
|
|
14a3cbb955 | ||
|
|
1a0484b332 | ||
|
|
b98674ac3f | ||
|
|
7c0273c80c | ||
|
|
71e9329709 | ||
|
|
0f85356b7d | ||
|
|
0ee14e9b47 | ||
|
|
39c4551d1f | ||
|
|
287cec0e84 | ||
|
|
190921dc76 | ||
|
|
9f205d6252 | ||
|
|
82f21f7d35 | ||
|
|
9aac6aca4d | ||
|
|
6bd8f0c5c3 | ||
|
|
f06946af8c | ||
|
|
b266f8d4dd | ||
| f8f3c229d8 | |||
| cdf7d35259 | |||
| ee44ce8979 | |||
| a3eed14110 | |||
| 0f5a3b51c4 | |||
| d252e8b178 | |||
| 99568ff0bb | |||
| 43678bf009 | |||
| 3143b12248 | |||
| 1554fcf449 | |||
| 44f890a6cb | |||
|
|
4f13aff020 | ||
| eb122d0898 | |||
| d27518d189 | |||
|
|
c49665cedc | ||
| f4f131803f | |||
| c736e3060c | |||
|
|
ed07d3659f | ||
|
|
0e1c9cbbc1 | ||
|
|
e82cca9692 | ||
|
|
deaefab9c3 | ||
|
|
e8a55af06a | ||
| fbedc008ef | |||
| bf787d97b4 | |||
| 9dddb18932 | |||
|
|
99ad2328a3 | ||
| ac14e19828 | |||
|
|
2dbfa43588 | ||
|
|
9dff60f9ae | ||
| dcc4e38451 | |||
| 4a00b40821 | |||
| 9d0b8c49f7 | |||
| 3b3e6c764f | |||
|
|
f51fe3cc4e | ||
|
|
d744034f45 | ||
|
|
cdc462789f | ||
|
|
183cc81446 | ||
|
|
7a113a32dd | ||
| 38ecee9603 | |||
| 95e8f8b623 | |||
| 9658cd656e | |||
| 9bffbabeac | |||
| 2cd749a652 | |||
| 2f5e60e86c | |||
| faca03ab2a | |||
| bd6bd124fa | |||
| dfd5692c86 | |||
| 239c7eca91 |
55
.clang-format
Normal file
55
.clang-format
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
---
|
||||||
|
Language: Cpp
|
||||||
|
BasedOnStyle: Microsoft
|
||||||
|
AccessModifierOffset: -4
|
||||||
|
AlignConsecutiveAssignments: false
|
||||||
|
AlignConsecutiveDeclarations: false
|
||||||
|
AlignOperands: true
|
||||||
|
AlignTrailingComments: false
|
||||||
|
AllowShortBlocksOnASingleLine: false
|
||||||
|
AlwaysBreakTemplateDeclarations: Yes
|
||||||
|
BraceWrapping:
|
||||||
|
AfterCaseLabel: true
|
||||||
|
AfterClass: true
|
||||||
|
AfterControlStatement: true
|
||||||
|
AfterEnum: true
|
||||||
|
AfterFunction: true
|
||||||
|
AfterNamespace: true
|
||||||
|
AfterStruct: true
|
||||||
|
AfterUnion: true
|
||||||
|
AfterExternBlock: true
|
||||||
|
BeforeCatch: true
|
||||||
|
BeforeElse: true
|
||||||
|
BeforeLambdaBody: true
|
||||||
|
BeforeWhile: true
|
||||||
|
IndentBraces: false
|
||||||
|
SplitEmptyFunction: true
|
||||||
|
SplitEmptyRecord: true
|
||||||
|
SplitEmptyNamespace: true
|
||||||
|
BreakConstructorInitializers: AfterColon
|
||||||
|
BreakConstructorInitializersBeforeComma: false
|
||||||
|
ConstructorInitializerAllOnOneLineOrOnePerLine: false
|
||||||
|
ContinuationIndentWidth: 8
|
||||||
|
IncludeCategories:
|
||||||
|
- Regex: '^<.*'
|
||||||
|
Priority: 1
|
||||||
|
- Regex: '^".*'
|
||||||
|
Priority: 2
|
||||||
|
- Regex: '.*'
|
||||||
|
Priority: 3
|
||||||
|
IncludeIsMainRegex: '([-_](test|unittest))?$'
|
||||||
|
IndentCaseLabels: true
|
||||||
|
InsertNewlineAtEOF: true
|
||||||
|
MacroBlockBegin: ''
|
||||||
|
MacroBlockEnd: ''
|
||||||
|
MaxEmptyLinesToKeep: 2
|
||||||
|
NamespaceIndentation: All
|
||||||
|
SpaceAfterCStyleCast: true
|
||||||
|
SpaceAfterTemplateKeyword: false
|
||||||
|
SpaceBeforeRangeBasedForLoopColon: false
|
||||||
|
SpaceInEmptyParentheses: false
|
||||||
|
SpacesInAngles: false
|
||||||
|
SpacesInConditionalStatement: false
|
||||||
|
SpacesInCStyleCastParentheses: false
|
||||||
|
SpacesInParentheses: false
|
||||||
|
...
|
||||||
4
.gitignore
vendored
4
.gitignore
vendored
@@ -13,3 +13,7 @@ cmake-build-debug-stm32cube
|
|||||||
/STM32H723VGTx_FLASH.ld
|
/STM32H723VGTx_FLASH.ld
|
||||||
|
|
||||||
/compile_commands.json
|
/compile_commands.json
|
||||||
|
|
||||||
|
.idea
|
||||||
|
|
||||||
|
cmake-build*
|
||||||
8
.idea/.gitignore
generated
vendored
8
.idea/.gitignore
generated
vendored
@@ -1,8 +0,0 @@
|
|||||||
# 默认忽略的文件
|
|
||||||
/shelf/
|
|
||||||
/workspace.xml
|
|
||||||
# 基于编辑器的 HTTP 客户端请求
|
|
||||||
/httpRequests/
|
|
||||||
# Datasource local storage ignored files
|
|
||||||
/dataSources/
|
|
||||||
/dataSources.local.xml
|
|
||||||
2
.idea/TronOneH7_Scaffold.iml
generated
2
.idea/TronOneH7_Scaffold.iml
generated
@@ -1,2 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<module classpath="CMake" type="CPP_MODULE" version="4" />
|
|
||||||
6
.idea/copilot.data.migration.agent.xml
generated
6
.idea/copilot.data.migration.agent.xml
generated
@@ -1,6 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="AgentMigrationStateService">
|
|
||||||
<option name="migrationStatus" value="COMPLETED" />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
||||||
6
.idea/copilot.data.migration.ask.xml
generated
6
.idea/copilot.data.migration.ask.xml
generated
@@ -1,6 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="AskMigrationStateService">
|
|
||||||
<option name="migrationStatus" value="COMPLETED" />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
||||||
6
.idea/copilot.data.migration.ask2agent.xml
generated
6
.idea/copilot.data.migration.ask2agent.xml
generated
@@ -1,6 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="Ask2AgentMigrationStateService">
|
|
||||||
<option name="migrationStatus" value="COMPLETED" />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
||||||
6
.idea/copilot.data.migration.edit.xml
generated
6
.idea/copilot.data.migration.edit.xml
generated
@@ -1,6 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="EditMigrationStateService">
|
|
||||||
<option name="migrationStatus" value="COMPLETED" />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
||||||
252
.idea/editor.xml
generated
252
.idea/editor.xml
generated
@@ -1,252 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="BackendCodeEditorSettings">
|
|
||||||
<option name="/Default/CodeInspection/GeneratedCode/GeneratedCodeRegions/=Component_0020Designer_0020generated_0020code/@EntryIndexedValue" value="Component Designer generated code" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/GeneratedCode/GeneratedCodeRegions/=Designer_0020generated_0020code/@EntryIndexedValue" value="Designer generated code" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/GeneratedCode/GeneratedCodeRegions/=Web_0020Form_0020Designer_0020generated_0020code/@EntryIndexedValue" value="Web Form Designer generated code" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/GeneratedCode/GeneratedCodeRegions/=Windows_0020Form_0020Designer_0020generated_0020code/@EntryIndexedValue" value="Windows Form Designer generated code" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CDeclarationWithImplicitIntType/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CommentTypo/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=ConstevalIfIsAlwaysConstant/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppAbstractClassWithoutSpecifier/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppAbstractFinalClass/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppAbstractVirtualFunctionCallInCtor/@EntryIndexedValue" value="ERROR" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppAccessSpecifierWithNoDeclarations/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppAwaiterTypeIsNotClass/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppBooleanIncrementExpression/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppBoostFormatBadCode/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppBoostFormatLegacyCode/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppBoostFormatMixedArgs/@EntryIndexedValue" value="ERROR" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppBoostFormatTooFewArgs/@EntryIndexedValue" value="ERROR" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppBoostFormatTooManyArgs/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppCStyleCast/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppCVQualifierCanNotBeAppliedToReference/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppClassCanBeFinal/@EntryIndexedValue" value="HINT" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppClassIsIncomplete/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppClassNeedsConstructorBecauseOfUninitializedMember/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppClassNeverUsed/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppCompileTimeConstantCanBeReplacedWithBooleanConstant/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppConceptNeverUsed/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppConditionalExpressionCanBeSimplified/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppConstParameterInDeclaration/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppConstValueFunctionReturnType/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppCoroutineCallResolveError/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAArrayIndexOutOfBounds/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAConstantConditions/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAConstantFunctionResult/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAConstantParameter/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFADeletedPointer/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAEndlessLoop/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAInfiniteRecursion/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAInvalidatedMemory/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFALocalValueEscapesFunction/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFALocalValueEscapesScope/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFALoopConditionNotUpdated/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAMemoryLeak/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFANotInitializedField/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFANullDereference/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFATimeOver/@EntryIndexedValue" value="HINT" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAUnreachableCode/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAUnreachableFunctionCall/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAUnreadVariable/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAUnusedValue/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeclarationHidesLocal/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeclarationHidesUncapturedLocal/@EntryIndexedValue" value="HINT" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeclarationSpecifierWithoutDeclarators/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeclaratorDisambiguatedAsFunction/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeclaratorNeverUsed/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeclaratorUsedBeforeInitialization/@EntryIndexedValue" value="ERROR" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDefaultCaseNotHandledInSwitchStatement/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDefaultInitializationWithNoUserConstructor/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDefaultIsUsedAsIdentifier/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDefaultedSpecialMemberFunctionIsImplicitlyDeleted/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeletingVoidPointer/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDependentTemplateWithoutTemplateKeyword/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDependentTypeWithoutTypenameKeyword/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeprecatedEntity/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeprecatedOverridenMethod/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeprecatedRegisterStorageClassSpecifier/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDereferenceOperatorLimitExceeded/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDiscardedPostfixOperatorResult/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDoxygenSyntaxError/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDoxygenUndocumentedParameter/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDoxygenUnresolvedReference/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEmptyDeclaration/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceCVQualifiersOrder/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceCVQualifiersPlacement/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceDoStatementBraces/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceForStatementBraces/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceFunctionDeclarationStyle/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceIfStatementBraces/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceNestedNamespacesStyle/@EntryIndexedValue" value="HINT" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceOverridingDestructorStyle/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceOverridingFunctionStyle/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceTypeAliasCodeStyle/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceWhileStatementBraces/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEntityAssignedButNoRead/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEntityUsedOnlyInUnevaluatedContext/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnumeratorNeverUsed/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEqualOperandsInBinaryExpression/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEvaluationFailure/@EntryIndexedValue" value="ERROR" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppExplicitSpecializationInNonNamespaceScope/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppExpressionWithoutSideEffects/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppFinalFunctionInFinalClass/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppFinalNonOverridingVirtualFunction/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppForLoopCanBeReplacedWithWhile/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppForwardEnumDeclarationWithoutUnderlyingType/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppFunctionDoesntReturnValue/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppFunctionIsNotImplemented/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppFunctionResultShouldBeUsed/@EntryIndexedValue" value="HINT" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppFunctionalStyleCast/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppHeaderHasBeenAlreadyIncluded/@EntryIndexedValue" value="HINT" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppHiddenFunction/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppHidingFunction/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppIdenticalOperandsInBinaryExpression/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppIfCanBeReplacedByConstexprIf/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppImplicitDefaultConstructorNotAvailable/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppIncompatiblePointerConversion/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppIncompleteSwitchStatement/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppInconsistentNaming/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppIntegralToPointerConversion/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppInvalidLineContinuation/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppJoinDeclarationAndAssignment/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppLambdaCaptureNeverUsed/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppLocalVariableMayBeConst/@EntryIndexedValue" value="HINT" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppLocalVariableMightNotBeInitialized/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppLocalVariableWithNonTrivialDtorIsNeverUsed/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppLongFloat/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMemberFunctionMayBeConst/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMemberFunctionMayBeStatic/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMemberInitializersOrder/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMismatchedClassTags/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMissingIncludeGuard/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMissingKeywordThrow/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppModulePartitionWithSeveralPartitionUnits/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMsExtAddressOfClassRValue/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMsExtBindingRValueToLvalueReference/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMsExtCopyElisionInCopyInitDeclarator/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMsExtDoubleUserConversionInCopyInit/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMsExtNotInitializedStaticConstLocalVar/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMsExtReinterpretCastFromNullptr/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMultiCharacterLiteral/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMultiCharacterWideLiteral/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMustBePublicVirtualToImplementInterface/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMutableSpecifierOnReferenceMember/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNoDiscardExpression/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNodiscardFunctionWithoutReturnValue/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNonExceptionSafeResourceAcquisition/@EntryIndexedValue" value="HINT" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNonExplicitConversionOperator/@EntryIndexedValue" value="HINT" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNonExplicitConvertingConstructor/@EntryIndexedValue" value="HINT" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNonInlineFunctionDefinitionInHeaderFile/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNonInlineVariableDefinitionInHeaderFile/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNotAllPathsReturnValue/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppObjectMemberMightNotBeInitialized/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppOutParameterMustBeWritten/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppParameterMayBeConst/@EntryIndexedValue" value="HINT" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppParameterMayBeConstPtrOrRef/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppParameterNamesMismatch/@EntryIndexedValue" value="HINT" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppParameterNeverUsed/@EntryIndexedValue" value="HINT" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPassValueParameterByConstReference/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPointerConversionDropsQualifiers/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPointerToIntegralConversion/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPolymorphicClassWithNonVirtualPublicDestructor/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPossiblyErroneousEmptyStatements/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPossiblyUninitializedMember/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPossiblyUnintendedObjectSlicing/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrecompiledHeaderIsNotIncluded/@EntryIndexedValue" value="ERROR" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrecompiledHeaderNotFound/@EntryIndexedValue" value="ERROR" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrintfBadFormat/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrintfExtraArg/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrintfMissedArg/@EntryIndexedValue" value="ERROR" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrintfRiskyFormat/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrivateSpecialMemberFunctionIsNotImplemented/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRangeBasedForIncompatibleReference/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedefinitionOfDefaultArgumentInOverrideFunction/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantAccessSpecifier/@EntryIndexedValue" value="HINT" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantBaseClassAccessSpecifier/@EntryIndexedValue" value="HINT" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantBaseClassInitializer/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantBooleanExpressionArgument/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantCastExpression/@EntryIndexedValue" value="HINT" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantComplexityInComparison/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantConditionalExpression/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantConstSpecifier/@EntryIndexedValue" value="HINT" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantControlFlowJump/@EntryIndexedValue" value="HINT" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantDereferencingAndTakingAddress/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantElaboratedTypeSpecifier/@EntryIndexedValue" value="HINT" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantElseKeyword/@EntryIndexedValue" value="HINT" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantElseKeywordInsideCompoundStatement/@EntryIndexedValue" value="HINT" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantEmptyDeclaration/@EntryIndexedValue" value="HINT" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantEmptyStatement/@EntryIndexedValue" value="HINT" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantExportKeyword/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantFwdClassOrEnumSpecifier/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantInlineSpecifier/@EntryIndexedValue" value="HINT" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantLambdaParameterList/@EntryIndexedValue" value="HINT" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantMemberInitializer/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantNamespaceDefinition/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantParentheses/@EntryIndexedValue" value="HINT" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantQualifier/@EntryIndexedValue" value="HINT" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantQualifierADL/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantStaticSpecifierOnMemberAllocationFunction/@EntryIndexedValue" value="HINT" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantStaticSpecifierOnThreadLocalLocalVariable/@EntryIndexedValue" value="HINT" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantTemplateArguments/@EntryIndexedValue" value="HINT" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantTemplateKeyword/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantTypenameKeyword/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantVoidArgumentList/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantZeroInitializerInAggregateInitialization/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppReinterpretCastFromVoidPtr/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRemoveRedundantBraces/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppReplaceMemsetWithZeroInitialization/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppReplaceTieWithStructuredBinding/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppReturnNoValueInNonVoidFunction/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppSmartPointerVsMakeFunction/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppSomeObjectMembersMightNotBeInitialized/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppSpecialFunctionWithoutNoexceptSpecification/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppStaticAssertFailure/@EntryIndexedValue" value="ERROR" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppStaticDataMemberInUnnamedStruct/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppStaticSpecifierOnAnonymousNamespaceMember/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppStringLiteralToCharPointerConversion/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTabsAreDisallowed/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTemplateArgumentsCanBeDeduced/@EntryIndexedValue" value="HINT" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTemplateParameterNeverUsed/@EntryIndexedValue" value="HINT" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTemplateParameterShadowing/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppThrowExpressionCanBeReplacedWithRethrow/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTooWideScope/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTooWideScopeInitStatement/@EntryIndexedValue" value="HINT" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTypeAliasNeverUsed/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUninitializedDependentBaseClass/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUninitializedNonStaticDataMember/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnionMemberOfReferenceType/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnmatchedPragmaEndRegionDirective/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnmatchedPragmaRegionDirective/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnnamedNamespaceInHeaderFile/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnnecessaryWhitespace/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnsignedZeroComparison/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnusedIncludeDirective/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseAlgorithmWithCount/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseAssociativeContains/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseAuto/@EntryIndexedValue" value="HINT" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseAutoForNumeric/@EntryIndexedValue" value="HINT" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseElementsView/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseEraseAlgorithm/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseFamiliarTemplateSyntaxForGenericLambdas/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseRangeAlgorithm/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseStdSize/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseStructuredBinding/@EntryIndexedValue" value="HINT" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseTypeTraitAlias/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUserDefinedLiteralSuffixDoesNotStartWithUnderscore/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUsingResultOfAssignmentAsCondition/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppVariableCanBeMadeConstexpr/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppVirtualFunctionCallInsideCtor/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppVirtualFunctionInFinalClass/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppVolatileParameterInDeclaration/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppWarningDirective/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppWrongIncludesOrder/@EntryIndexedValue" value="HINT" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppWrongSlashesInIncludeDirective/@EntryIndexedValue" value="HINT" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppZeroConstantCanBeReplacedWithNullptr/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppZeroValuedExpressionUsedAsNullPointer/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=IdentifierTypo/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=IfStdIsConstantEvaluatedCanBeReplaced/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=StdIsConstantEvaluatedWillAlwaysEvaluateToConstant/@EntryIndexedValue" value="WARNING" type="string" />
|
|
||||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=StringLiteralTypo/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
||||||
14
.idea/misc.xml
generated
14
.idea/misc.xml
generated
@@ -1,14 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="CMakePythonSetting">
|
|
||||||
<option name="pythonIntegrationState" value="YES" />
|
|
||||||
</component>
|
|
||||||
<component name="CMakeWorkspace" PROJECT_DIR="$PROJECT_DIR$" />
|
|
||||||
<component name="MaterialThemeProjectNewConfig">
|
|
||||||
<option name="metadata">
|
|
||||||
<MTProjectMetadataState>
|
|
||||||
<option name="userId" value="-4755b0c8:1993c71e271:-7fed" />
|
|
||||||
</MTProjectMetadataState>
|
|
||||||
</option>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
||||||
67
.mxproject
67
.mxproject
File diff suppressed because one or more lines are too long
327
CMakeLists.txt
327
CMakeLists.txt
@@ -1,68 +1,297 @@
|
|||||||
|
# ==============================================================================
|
||||||
|
# 大连民族大学创一工作室 达妙开发板脚手架-CMake构建系统
|
||||||
|
# ==============================================================================
|
||||||
cmake_minimum_required(VERSION 3.22)
|
cmake_minimum_required(VERSION 3.22)
|
||||||
|
|
||||||
#
|
#欢迎提示
|
||||||
# This file is generated only once,
|
message(NOTICE ">> 欢迎使用创一工作室达妙开发板脚手架的CMake构建系统")
|
||||||
# and is not re-generated if converter is called multiple times.
|
message(NOTICE ">> 如报错信息为未安装环境或找不到可用编译器,请先安装STM32CubeCLT,可以在ST官网找到下载链接 https://www.st.com/en/development-tools/stm32cubeclt.html")
|
||||||
#
|
message(NOTICE ">> 安装完STM32CubeCLT后记得重启刷新编译器环境变量或自己添加到环境变量PATH中")
|
||||||
# User is free to modify the file as much as necessary
|
message(NOTICE ">> 如使用Makefile,需要自己添加Make构建工具的环境变量,网上搜一搜教程,都有的")
|
||||||
#
|
message(NOTICE ">> 本项目默认使用arm-none-eabi-gcc,如需使用starm-clang请注意编译优化设置,截止发布前暂无法使用starm-clang构建的elf进行debug,无法打断点")
|
||||||
|
|
||||||
# Setup compiler settings
|
# ------------------------------------------------------------------------------
|
||||||
|
# 1. 机器人兵种选择开关 (Robot Configuration)
|
||||||
|
# 请将当前需要编译的机器人设置为 ON,其余保持 OFF
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
option(INFANTRY_MEC "1. 麦轮步兵 (Mecanum Infantry)" OFF)
|
||||||
|
option(INFANTRY_HALF_STEER "2. 半舵步兵 (Half-Steer Infantry)" OFF)
|
||||||
|
option(HERO_MEC "3. 麦轮英雄 (Mecanum Hero)" OFF)
|
||||||
|
option(SENTRY_STEER "4. 舵轮哨兵 (Steer Sentry)" OFF)
|
||||||
|
option(INFANTRY_TRANSFORM "5. 变形步兵 (Transformable Infantry)" OFF)
|
||||||
|
option(BALANCE_SERIAL "6. 串联腿平衡步兵 (Serial-Leg Balance)" OFF)
|
||||||
|
option(BALANCE_PARALLEL "7. 并联腿平衡步兵 (Parallel-Leg Balance)" OFF)
|
||||||
|
option(DART "8. 飞镖架 (Dart System)" OFF)
|
||||||
|
option(DEV_DEBUG "9. 调试模式 (Debug Mode)" ON)
|
||||||
|
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
# 2. 安全互斥检查 (Safety Check)
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
set(ROBOT_ENABLE_COUNT 0)
|
||||||
|
if(INFANTRY_MEC)
|
||||||
|
math(EXPR ROBOT_ENABLE_COUNT "${ROBOT_ENABLE_COUNT}+1")
|
||||||
|
endif()
|
||||||
|
if(INFANTRY_HALF_STEER)
|
||||||
|
math(EXPR ROBOT_ENABLE_COUNT "${ROBOT_ENABLE_COUNT}+1")
|
||||||
|
endif()
|
||||||
|
if(HERO_MEC)
|
||||||
|
math(EXPR ROBOT_ENABLE_COUNT "${ROBOT_ENABLE_COUNT}+1")
|
||||||
|
endif()
|
||||||
|
if(SENTRY_STEER)
|
||||||
|
math(EXPR ROBOT_ENABLE_COUNT "${ROBOT_ENABLE_COUNT}+1")
|
||||||
|
endif()
|
||||||
|
if(INFANTRY_TRANSFORM)
|
||||||
|
math(EXPR ROBOT_ENABLE_COUNT "${ROBOT_ENABLE_COUNT}+1")
|
||||||
|
endif()
|
||||||
|
if(BALANCE_SERIAL)
|
||||||
|
math(EXPR ROBOT_ENABLE_COUNT "${ROBOT_ENABLE_COUNT}+1")
|
||||||
|
endif()
|
||||||
|
if(BALANCE_PARALLEL)
|
||||||
|
math(EXPR ROBOT_ENABLE_COUNT "${ROBOT_ENABLE_COUNT}+1")
|
||||||
|
endif()
|
||||||
|
if(DART)
|
||||||
|
math(EXPR ROBOT_ENABLE_COUNT "${ROBOT_ENABLE_COUNT}+1")
|
||||||
|
endif()
|
||||||
|
if(DEV_DEBUG)
|
||||||
|
math(EXPR ROBOT_ENABLE_COUNT "${ROBOT_ENABLE_COUNT}+1")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(ROBOT_ENABLE_COUNT GREATER 1)
|
||||||
|
message(FATAL_ERROR "【错误】检测到同时开启了 ${ROBOT_ENABLE_COUNT} 个兵种!请检查 option 设置,确保只有一个为 ON。")
|
||||||
|
elseif(ROBOT_ENABLE_COUNT EQUAL 0)
|
||||||
|
message(WARNING "【警告】未选择任何兵种!将仅编译通用库,无法生成有效固件。")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
# 3. 基础项目配置 (Project Setup)
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
include(cmake/DetectToolchain.cmake)
|
||||||
|
project(TronOneH7_Scaffold)
|
||||||
|
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
|
||||||
|
|
||||||
|
set(CMAKE_EXPORT_COMPILE_COMMANDS TRUE)
|
||||||
|
enable_language(C CXX ASM)
|
||||||
|
|
||||||
|
# 标准设置 (C23 / C++23)
|
||||||
set(CMAKE_C_STANDARD 23)
|
set(CMAKE_C_STANDARD 23)
|
||||||
set(CMAKE_C_STANDARD_REQUIRED ON)
|
set(CMAKE_C_STANDARD_REQUIRED ON)
|
||||||
set(CMAKE_C_EXTENSIONS ON)
|
set(CMAKE_C_EXTENSIONS ON)
|
||||||
|
|
||||||
|
set(CMAKE_CXX_STANDARD 23)
|
||||||
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
set(CMAKE_CXX_EXTENSIONS ON)
|
||||||
|
|
||||||
# Define the build type
|
#标准提示
|
||||||
if(NOT CMAKE_BUILD_TYPE)
|
message(NOTICE ">> 本项目使用 C ${CMAKE_C_STANDARD} 及 C++ ${CMAKE_CXX_STANDARD} 标准")
|
||||||
|
|
||||||
|
# 根据构建类型设置不同的编译选项
|
||||||
|
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||||
|
set(CMAKE_C_FLAGS_DEBUG "-O0 -g") # 调试模式:无优化,包含调试信息
|
||||||
|
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g")
|
||||||
|
elseif (CMAKE_BUILD_TYPE STREQUAL "Release")
|
||||||
|
set(CMAKE_C_FLAGS_RELEASE "-O3") # 发布模式:最高级别优化
|
||||||
|
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
|
||||||
|
elseif (CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
|
||||||
|
set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g") # 带调试信息的发布模式:中等优化,包含调试信息
|
||||||
|
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g")
|
||||||
|
elseif (CMAKE_BUILD_TYPE STREQUAL "MinSizeRel")
|
||||||
|
set(CMAKE_C_FLAGS_MINSIZEREL "-Os") # 最小体积模式:优化代码大小
|
||||||
|
set(CMAKE_CXX_FLAGS_MINSIZEREL "-Os")
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
# 输出编译器路径
|
||||||
|
message(NOTICE ">> [Assembler] 找到的 C 编译器路径: ${CMAKE_C_COMPILER}")
|
||||||
|
message(NOTICE ">> [Assembler] 找到的 C++ 编译器路径: ${CMAKE_CXX_COMPILER}")
|
||||||
|
|
||||||
|
if (NOT CMAKE_BUILD_TYPE)
|
||||||
set(CMAKE_BUILD_TYPE "Debug")
|
set(CMAKE_BUILD_TYPE "Debug")
|
||||||
endif()
|
endif ()
|
||||||
|
|
||||||
# Set the project name
|
# 编译器标志
|
||||||
set(CMAKE_PROJECT_NAME TronOneH7_Scaffold)
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -frtti -Wno-volatile")
|
||||||
|
|
||||||
# Enable compile command to ease indexing with e.g. clangd
|
message(NOTICE ">> [Build Type] 当前构建类型: ${CMAKE_BUILD_TYPE}")
|
||||||
set(CMAKE_EXPORT_COMPILE_COMMANDS TRUE)
|
|
||||||
|
|
||||||
# Core project settings
|
# ------------------------------------------------------------------------------
|
||||||
project(${CMAKE_PROJECT_NAME})
|
# 4. 目标与库链接 (Target & Libraries)
|
||||||
message("Build type: " ${CMAKE_BUILD_TYPE})
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
# Enable CMake support for ASM and C languages
|
|
||||||
enable_language(C ASM)
|
|
||||||
|
|
||||||
# Create an executable object type
|
|
||||||
add_executable(${CMAKE_PROJECT_NAME})
|
add_executable(${CMAKE_PROJECT_NAME})
|
||||||
|
|
||||||
# Add STM32CubeMX generated sources
|
include(CompileOptions)
|
||||||
|
|
||||||
|
# FindModules
|
||||||
|
# 只有运行了这个,CMake 才会去执行 git clone 云端modules 并配置它的路径
|
||||||
|
include(FindModules)
|
||||||
|
|
||||||
|
# 添加 STM32CubeMX 底层库
|
||||||
add_subdirectory(cmake/stm32cubemx)
|
add_subdirectory(cmake/stm32cubemx)
|
||||||
|
|
||||||
# Link directories setup
|
# 链接库
|
||||||
target_link_directories(${CMAKE_PROJECT_NAME} PRIVATE
|
|
||||||
# Add user defined library search paths
|
|
||||||
)
|
|
||||||
|
|
||||||
# Add sources to executable
|
|
||||||
target_sources(${CMAKE_PROJECT_NAME} PRIVATE
|
|
||||||
# Add user sources here
|
|
||||||
)
|
|
||||||
|
|
||||||
# Add include paths
|
|
||||||
target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE
|
|
||||||
# Add user defined include paths
|
|
||||||
)
|
|
||||||
|
|
||||||
# Add project symbols (macros)
|
|
||||||
target_compile_definitions(${CMAKE_PROJECT_NAME} PRIVATE
|
|
||||||
# Add user defined symbols
|
|
||||||
)
|
|
||||||
|
|
||||||
# Remove wrong libob.a library dependency when using cpp files
|
|
||||||
list(REMOVE_ITEM CMAKE_C_IMPLICIT_LINK_LIBRARIES ob)
|
|
||||||
|
|
||||||
# Add linked libraries
|
|
||||||
target_link_libraries(${CMAKE_PROJECT_NAME}
|
target_link_libraries(${CMAKE_PROJECT_NAME}
|
||||||
stm32cubemx
|
stm32cubemx
|
||||||
|
# 因为 ems 是通过 FindModules 下载的外部库,不在 User_Code 里。
|
||||||
# Add user defined libraries
|
# 链接这个库会自动把 ems 的头文件路径加入到工程里。
|
||||||
|
ems
|
||||||
|
${CMAKE_SOURCE_DIR}/Drivers/CMSIS/DSP/Lib/GCC/libarm_cortexM7lfdp_math.a
|
||||||
|
)
|
||||||
|
|
||||||
|
link_libraries("Drivers/CMSIS/DSP/Lib/GCC/libarm_cortexM7lfdp_math.a")
|
||||||
|
|
||||||
|
include_directories(
|
||||||
|
./Drivers/CMSIS/Include
|
||||||
|
./Drivers/CMSIS/DSP/Include/
|
||||||
|
)
|
||||||
|
link_directories(
|
||||||
|
./Drivers/CMSIS/DSP/Lib/GCC
|
||||||
|
)
|
||||||
|
|
||||||
|
# ==============================================================================
|
||||||
|
# 5. 源码与头文件管理 (Source & Header Management)
|
||||||
|
# ==============================================================================
|
||||||
|
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
# A. 头文件管理:全自动模式,扫描 User_Code 下的所有头文件。
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
message(NOTICE ">> [Searching All Header] 正在全自动递归扫描 User_Code 下所有头文件路径...")
|
||||||
|
file(GLOB_RECURSE USER_HEADERS CONFIGURE_DEPENDS "${CMAKE_SOURCE_DIR}/User_Code/*.h" "${CMAKE_SOURCE_DIR}/User_Code/*.hpp")
|
||||||
|
|
||||||
|
foreach (header ${USER_HEADERS})
|
||||||
|
get_filename_component(dir ${header} DIRECTORY) # 获取头文件所在目录
|
||||||
|
target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE ${dir}) # 添加为私有包含目录
|
||||||
|
endforeach ()
|
||||||
|
|
||||||
|
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
# B. 源文件管理:半自动模式 (防止兵种冲突)
|
||||||
|
# 通用部分全自动扫描,特定兵种部分根据开关选择性扫描。
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
message(NOTICE ">> [INFO] 正在全自动递归扫描 User_Code/bsp下所有源文件路径...")
|
||||||
|
message(NOTICE ">> [INFO] 正在全自动递归扫描 User_Code/module下所有源文件路径...")
|
||||||
|
message(NOTICE ">> [INFO] 正在全自动递归扫描 User_Code/application下所有通用APP模块的源文件路径...")
|
||||||
|
|
||||||
|
# 1. 添加通用代码 (BSP & Module & Application 通用框架)
|
||||||
|
# 包含 bsp, module 以及 application 下的通用组件
|
||||||
|
file(GLOB_RECURSE COMMON_SOURCES CONFIGURE_DEPENDS
|
||||||
|
"${PROJECT_SOURCE_DIR}/User_Code/bsp/*.c"
|
||||||
|
"${PROJECT_SOURCE_DIR}/User_Code/bsp/*.cpp"
|
||||||
|
"${PROJECT_SOURCE_DIR}/User_Code/module/*.c"
|
||||||
|
"${PROJECT_SOURCE_DIR}/User_Code/module/*.cpp"
|
||||||
|
# 包含 application 根目录下的 robot.c 等文件 (不递归) todo 需重写
|
||||||
|
"${PROJECT_SOURCE_DIR}/User_Code/application/*.c"
|
||||||
|
"${PROJECT_SOURCE_DIR}/User_Code/application/*.cpp"
|
||||||
|
# 包含 application 下的通用模块 (根据目录结构递归) todo 需重写
|
||||||
|
"${PROJECT_SOURCE_DIR}/User_Code/application/chassis_app/*.c" "${PROJECT_SOURCE_DIR}/User_Code/application/chassis_app/*.cpp"
|
||||||
|
"${PROJECT_SOURCE_DIR}/User_Code/application/gimbal_app/*.c" "${PROJECT_SOURCE_DIR}/User_Code/application/gimbal_app/*.cpp" "${PROJECT_SOURCE_DIR}/User_Code/application/shoot_app/*.c" "${PROJECT_SOURCE_DIR}/User_Code/application/shoot_app/*.cpp"
|
||||||
|
"${PROJECT_SOURCE_DIR}/User_Code/application/indicator_app/*.c" "${PROJECT_SOURCE_DIR}/User_Code/application/indicator_app/*.cpp"
|
||||||
|
"${PROJECT_SOURCE_DIR}/User_Code/application/vision_app/*.c" "${PROJECT_SOURCE_DIR}/User_Code/application/vision_app/*.cpp"
|
||||||
|
)
|
||||||
|
target_sources(${CMAKE_PROJECT_NAME} PRIVATE ${COMMON_SOURCES})
|
||||||
|
|
||||||
|
list(LENGTH COMMON_SOURCES COMMON_SOURCES_COUNT)
|
||||||
|
|
||||||
|
# 输出统计结果
|
||||||
|
message(NOTICE ">> [INFO] 通用库源文件扫描结束,在通用库中共扫描到 ${COMMON_SOURCES_COUNT} 个源文件")
|
||||||
|
|
||||||
|
# 2. 根据开关添加特定兵种代码 (Specific Code)
|
||||||
|
|
||||||
|
# 定义一个变量来存储当前激活的 App 路径
|
||||||
|
set(ACTIVE_APP_DIR "")
|
||||||
|
|
||||||
|
# 1. 麦轮步兵
|
||||||
|
if(INFANTRY_MEC)
|
||||||
|
message(WARNING ">> 当前构建兵种: 麦轮步兵 (INFANTRY_MEC)")
|
||||||
|
set(ACTIVE_APP_DIR "${PROJECT_SOURCE_DIR}/User_Code/user_task/infantry_mec")
|
||||||
|
target_compile_definitions(${CMAKE_PROJECT_NAME} PRIVATE INFANTRY_MEC)
|
||||||
|
message(NOTICE ">> [Specific Source] 开始扫描各兵种对应代码,当前选中的兵种为: 麦轮步兵 (INFANTRY_MEC)")
|
||||||
|
|
||||||
|
# 2. 半舵步兵
|
||||||
|
elseif(INFANTRY_HALF_STEER)
|
||||||
|
message(NOTICE ">> 当前构建兵种: 半舵步兵 (INFANTRY_HALF_STEER)")
|
||||||
|
set(ACTIVE_APP_DIR "${PROJECT_SOURCE_DIR}/User_Code/user_task/infantry_half_steer")
|
||||||
|
target_compile_definitions(${CMAKE_PROJECT_NAME} PRIVATE INFANTRY_HALF_STEER)
|
||||||
|
message(NOTICE ">> [Specific Source] 开始扫描各兵种对应代码,当前选中的兵种为: 半舵步兵 (INFANTRY_HALF_STEER)")
|
||||||
|
|
||||||
|
# 3. 麦轮英雄
|
||||||
|
elseif(HERO_MEC)
|
||||||
|
message(NOTICE ">> 当前构建兵种: 麦轮英雄 (HERO_MEC)")
|
||||||
|
set(ACTIVE_APP_DIR "${PROJECT_SOURCE_DIR}/User_Code/user_task/hero_mec")
|
||||||
|
target_compile_definitions(${CMAKE_PROJECT_NAME} PRIVATE HERO_MEC)
|
||||||
|
message(NOTICE ">> [Specific Source] 开始扫描各兵种对应代码,当前选中的兵种为: 麦轮英雄 (HERO_MEC)")
|
||||||
|
|
||||||
|
# 4. 舵轮哨兵
|
||||||
|
elseif(SENTRY_STEER)
|
||||||
|
message(NOTICE ">> 当前构建兵种: 舵轮哨兵 (SENTRY_STEER)")
|
||||||
|
set(ACTIVE_APP_DIR "${PROJECT_SOURCE_DIR}/User_Code/user_task/sentry_steer")
|
||||||
|
target_compile_definitions(${CMAKE_PROJECT_NAME} PRIVATE SENTRY_STEER SENTRY)
|
||||||
|
message(NOTICE ">> [Specific Source] 开始扫描各兵种对应代码,当前选中的兵种为: 舵轮哨兵 (SENTRY_STEER)")
|
||||||
|
|
||||||
|
# 5. 变形步兵
|
||||||
|
elseif(INFANTRY_TRANSFORM)
|
||||||
|
message(NOTICE ">> 当前构建兵种: 变形步兵 (INFANTRY_TRANSFORM)")
|
||||||
|
set(ACTIVE_APP_DIR "${PROJECT_SOURCE_DIR}/User_Code/user_task/infantry_transform")
|
||||||
|
target_compile_definitions(${CMAKE_PROJECT_NAME} PRIVATE INFANTRY_TRANSFORM)
|
||||||
|
message(NOTICE ">> [Specific Source] 开始扫描各兵种对应代码,当前选中的兵种为: 变形步兵 (INFANTRY_TRANSFORM)")
|
||||||
|
|
||||||
|
# 6. 串联腿平衡步兵
|
||||||
|
elseif(BALANCE_SERIAL)
|
||||||
|
message(NOTICE ">> 当前构建兵种: 串联腿平衡步兵 (BALANCE_SERIAL)")
|
||||||
|
set(ACTIVE_APP_DIR "${PROJECT_SOURCE_DIR}/User_Code/user_task/balance_serial")
|
||||||
|
target_compile_definitions(${CMAKE_PROJECT_NAME} PRIVATE BALANCE_SERIAL BALANCE)
|
||||||
|
message(NOTICE ">> [Specific Source] 开始扫描各兵种对应代码,当前选中的兵种为: 串联腿平衡步兵 (BALANCE_SERIAL)")
|
||||||
|
|
||||||
|
# 7. 并联腿平衡步兵
|
||||||
|
elseif(BALANCE_PARALLEL)
|
||||||
|
message(NOTICE ">> 当前构建兵种: 并联腿平衡步兵 (BALANCE_PARALLEL)")
|
||||||
|
set(ACTIVE_APP_DIR "${PROJECT_SOURCE_DIR}/User_Code/user_task/balance_parallel")
|
||||||
|
target_compile_definitions(${CMAKE_PROJECT_NAME} PRIVATE BALANCE_PARALLEL BALANCE)
|
||||||
|
message(NOTICE ">> [Specific Source] 开始扫描各兵种对应代码,当前选中的兵种为: 并联腿平衡步兵 (BALANCE_PARALLEL)")
|
||||||
|
|
||||||
|
# 8. 飞镖架
|
||||||
|
elseif(DART)
|
||||||
|
message(NOTICE ">> 当前构建兵种: 飞镖架 (DART)")
|
||||||
|
set(ACTIVE_APP_DIR "${PROJECT_SOURCE_DIR}/User_Code/user_task/dart")
|
||||||
|
target_compile_definitions(${CMAKE_PROJECT_NAME} PRIVATE DART)
|
||||||
|
message(NOTICE ">> [Specific Source] 开始扫描各兵种对应代码,当前选中的兵种为: 飞镖架 (DART)")
|
||||||
|
|
||||||
|
# 9. 调试模式
|
||||||
|
elseif(DEV_DEBUG)
|
||||||
|
message(NOTICE ">> 当前构建兵种: 调试模式 (DEV_DEBUG)")
|
||||||
|
set(ACTIVE_APP_DIR "${PROJECT_SOURCE_DIR}/User_Code/user_task/dev_tasks")
|
||||||
|
target_compile_definitions(${CMAKE_PROJECT_NAME} PRIVATE DEV_DEBUG)
|
||||||
|
message(NOTICE ">> [Specific Source] 开始扫描各兵种对应代码,当前选中的兵种为: 调试模式 (DEV_DEBUG)")
|
||||||
|
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# 执行特定代码的添加
|
||||||
|
if(ACTIVE_APP_DIR)
|
||||||
|
if(EXISTS "${ACTIVE_APP_DIR}")
|
||||||
|
# 添加该兵种目录下的所有源码
|
||||||
|
file(GLOB_RECURSE APP_SOURCES CONFIGURE_DEPENDS "${ACTIVE_APP_DIR}/*.c" "${ACTIVE_APP_DIR}/*.cpp")
|
||||||
|
|
||||||
|
# --- 新增:统计文件数量 ---
|
||||||
|
list(LENGTH APP_SOURCES APP_SOURCES_COUNT)
|
||||||
|
message(NOTICE ">> [INFO] 兵种对应的源文件目录: ${ACTIVE_APP_DIR}")
|
||||||
|
message(NOTICE ">> [INFO] 已添加源文件数量: ${APP_SOURCES_COUNT}")
|
||||||
|
|
||||||
|
target_sources(${CMAKE_PROJECT_NAME} PRIVATE ${APP_SOURCES})
|
||||||
|
|
||||||
|
else()
|
||||||
|
message(FATAL_ERROR ">> [ERROR] 选中的兵种目录不存在: ${ACTIVE_APP_DIR}")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
# 6. 其他设置
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# 其他自定义头文件路径(如果还有不在 User_Code 里的)
|
||||||
|
target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE
|
||||||
|
# 可以在此处添加其他包含目录
|
||||||
|
)
|
||||||
|
|
||||||
|
target_compile_definitions(${CMAKE_PROJECT_NAME} PRIVATE
|
||||||
|
# RM_REFEREE
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,38 +0,0 @@
|
|||||||
{
|
|
||||||
"version": 3,
|
|
||||||
"configurePresets": [
|
|
||||||
{
|
|
||||||
"name": "default",
|
|
||||||
"hidden": true,
|
|
||||||
"generator": "Ninja",
|
|
||||||
"binaryDir": "${sourceDir}/build/${presetName}",
|
|
||||||
"toolchainFile": "${sourceDir}/cmake/starm-clang.cmake",
|
|
||||||
"cacheVariables": {
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Debug",
|
|
||||||
"inherits": "default",
|
|
||||||
"cacheVariables": {
|
|
||||||
"CMAKE_BUILD_TYPE": "Debug"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Release",
|
|
||||||
"inherits": "default",
|
|
||||||
"cacheVariables": {
|
|
||||||
"CMAKE_BUILD_TYPE": "Release"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"buildPresets": [
|
|
||||||
{
|
|
||||||
"name": "Debug",
|
|
||||||
"configurePreset": "Debug"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Release",
|
|
||||||
"configurePreset": "Release"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -67,8 +67,8 @@
|
|||||||
#define configCPU_CLOCK_HZ ( SystemCoreClock )
|
#define configCPU_CLOCK_HZ ( SystemCoreClock )
|
||||||
#define configTICK_RATE_HZ ((TickType_t)1000)
|
#define configTICK_RATE_HZ ((TickType_t)1000)
|
||||||
#define configMAX_PRIORITIES ( 56 )
|
#define configMAX_PRIORITIES ( 56 )
|
||||||
#define configMINIMAL_STACK_SIZE ((uint16_t)128)
|
#define configMINIMAL_STACK_SIZE ((uint16_t)256)
|
||||||
#define configTOTAL_HEAP_SIZE ((size_t)15360)
|
#define configTOTAL_HEAP_SIZE ((size_t)30720)
|
||||||
#define configMAX_TASK_NAME_LEN ( 16 )
|
#define configMAX_TASK_NAME_LEN ( 16 )
|
||||||
#define configUSE_TRACE_FACILITY 1
|
#define configUSE_TRACE_FACILITY 1
|
||||||
#define configUSE_16_BIT_TICKS 0
|
#define configUSE_16_BIT_TICKS 0
|
||||||
@@ -93,7 +93,7 @@
|
|||||||
#define configUSE_TIMERS 1
|
#define configUSE_TIMERS 1
|
||||||
#define configTIMER_TASK_PRIORITY ( 2 )
|
#define configTIMER_TASK_PRIORITY ( 2 )
|
||||||
#define configTIMER_QUEUE_LENGTH 10
|
#define configTIMER_QUEUE_LENGTH 10
|
||||||
#define configTIMER_TASK_STACK_DEPTH 256
|
#define configTIMER_TASK_STACK_DEPTH 512
|
||||||
|
|
||||||
/* CMSIS-RTOS V2 flags */
|
/* CMSIS-RTOS V2 flags */
|
||||||
#define configUSE_OS2_THREAD_SUSPEND_RESUME 1
|
#define configUSE_OS2_THREAD_SUSPEND_RESUME 1
|
||||||
@@ -167,6 +167,34 @@ standard names. */
|
|||||||
|
|
||||||
/* USER CODE BEGIN Defines */
|
/* USER CODE BEGIN Defines */
|
||||||
/* Section where parameter definitions can be added (for instance, to override default ones in FreeRTOS.h) */
|
/* Section where parameter definitions can be added (for instance, to override default ones in FreeRTOS.h) */
|
||||||
|
#include CMSIS_device_header
|
||||||
|
|
||||||
|
#define INCLUDE_xTaskGetIdleTaskHandle 1
|
||||||
|
#define configGENERATE_RUN_TIME_STATS 1
|
||||||
|
#define configUSE_STATS_FORMATTING_FUNCTIONS 0
|
||||||
|
#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() \
|
||||||
|
do { \
|
||||||
|
CoreDebug->DEMCR |= CoreDebug_DEMCR_TRCENA_Msk; \
|
||||||
|
DWT->CYCCNT = 0U; \
|
||||||
|
DWT->CTRL |= DWT_CTRL_CYCCNTENA_Msk; \
|
||||||
|
} while (0)
|
||||||
|
#define portGET_RUN_TIME_COUNTER_VALUE() DWT->CYCCNT
|
||||||
|
|
||||||
|
#ifndef traceTASK_SWITCHED_IN
|
||||||
|
#define traceTASK_SWITCHED_IN() \
|
||||||
|
do { \
|
||||||
|
extern void lv_freertos_task_switch_in(const char * name); \
|
||||||
|
lv_freertos_task_switch_in(pxCurrentTCB->pcTaskName); \
|
||||||
|
} while (0)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceTASK_SWITCHED_OUT
|
||||||
|
#define traceTASK_SWITCHED_OUT() \
|
||||||
|
do { \
|
||||||
|
extern void lv_freertos_task_switch_out(void); \
|
||||||
|
lv_freertos_task_switch_out(); \
|
||||||
|
} while (0)
|
||||||
|
#endif
|
||||||
/* USER CODE END Defines */
|
/* USER CODE END Defines */
|
||||||
|
|
||||||
#endif /* FREERTOS_CONFIG_H */
|
#endif /* FREERTOS_CONFIG_H */
|
||||||
|
|||||||
@@ -32,12 +32,15 @@ extern "C" {
|
|||||||
|
|
||||||
/* USER CODE END Includes */
|
/* USER CODE END Includes */
|
||||||
|
|
||||||
|
extern ADC_HandleTypeDef hadc1;
|
||||||
|
|
||||||
extern ADC_HandleTypeDef hadc3;
|
extern ADC_HandleTypeDef hadc3;
|
||||||
|
|
||||||
/* USER CODE BEGIN Private defines */
|
/* USER CODE BEGIN Private defines */
|
||||||
|
|
||||||
/* USER CODE END Private defines */
|
/* USER CODE END Private defines */
|
||||||
|
|
||||||
|
void MX_ADC1_Init(void);
|
||||||
void MX_ADC3_Init(void);
|
void MX_ADC3_Init(void);
|
||||||
|
|
||||||
/* USER CODE BEGIN Prototypes */
|
/* USER CODE BEGIN Prototypes */
|
||||||
|
|||||||
@@ -1,52 +0,0 @@
|
|||||||
/* USER CODE BEGIN Header */
|
|
||||||
/**
|
|
||||||
******************************************************************************
|
|
||||||
* @file iwdg.h
|
|
||||||
* @brief This file contains all the function prototypes for
|
|
||||||
* the iwdg.c file
|
|
||||||
******************************************************************************
|
|
||||||
* @attention
|
|
||||||
*
|
|
||||||
* Copyright (c) 2025 STMicroelectronics.
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* This software is licensed under terms that can be found in the LICENSE file
|
|
||||||
* in the root directory of this software component.
|
|
||||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
|
||||||
*
|
|
||||||
******************************************************************************
|
|
||||||
*/
|
|
||||||
/* USER CODE END Header */
|
|
||||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
|
||||||
#ifndef __IWDG_H__
|
|
||||||
#define __IWDG_H__
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Includes ------------------------------------------------------------------*/
|
|
||||||
#include "main.h"
|
|
||||||
|
|
||||||
/* USER CODE BEGIN Includes */
|
|
||||||
|
|
||||||
/* USER CODE END Includes */
|
|
||||||
|
|
||||||
extern IWDG_HandleTypeDef hiwdg1;
|
|
||||||
|
|
||||||
/* USER CODE BEGIN Private defines */
|
|
||||||
|
|
||||||
/* USER CODE END Private defines */
|
|
||||||
|
|
||||||
void MX_IWDG1_Init(void);
|
|
||||||
|
|
||||||
/* USER CODE BEGIN Prototypes */
|
|
||||||
|
|
||||||
/* USER CODE END Prototypes */
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* __IWDG_H__ */
|
|
||||||
|
|
||||||
@@ -57,14 +57,20 @@ void Error_Handler(void);
|
|||||||
/* USER CODE END EFP */
|
/* USER CODE END EFP */
|
||||||
|
|
||||||
/* Private defines -----------------------------------------------------------*/
|
/* Private defines -----------------------------------------------------------*/
|
||||||
|
#define Power2_Pin GPIO_PIN_13
|
||||||
|
#define Power2_GPIO_Port GPIOC
|
||||||
|
#define Power1_Pin GPIO_PIN_14
|
||||||
|
#define Power1_GPIO_Port GPIOC
|
||||||
|
#define Power_5V_EN_Pin GPIO_PIN_15
|
||||||
|
#define Power_5V_EN_GPIO_Port GPIOC
|
||||||
#define ACC_CS_Pin GPIO_PIN_0
|
#define ACC_CS_Pin GPIO_PIN_0
|
||||||
#define ACC_CS_GPIO_Port GPIOC
|
#define ACC_CS_GPIO_Port GPIOC
|
||||||
#define GYRO_CS_Pin GPIO_PIN_3
|
#define GYRO_CS_Pin GPIO_PIN_3
|
||||||
#define GYRO_CS_GPIO_Port GPIOC
|
#define GYRO_CS_GPIO_Port GPIOC
|
||||||
#define pump1_Pin GPIO_PIN_0
|
#define power2_Pin GPIO_PIN_0
|
||||||
#define pump1_GPIO_Port GPIOA
|
#define power2_GPIO_Port GPIOA
|
||||||
#define pump2_Pin GPIO_PIN_2
|
#define power1_Pin GPIO_PIN_2
|
||||||
#define pump2_GPIO_Port GPIOA
|
#define power1_GPIO_Port GPIOA
|
||||||
#define pump3_Pin GPIO_PIN_9
|
#define pump3_Pin GPIO_PIN_9
|
||||||
#define pump3_GPIO_Port GPIOE
|
#define pump3_GPIO_Port GPIOE
|
||||||
#define ACC_INT_Pin GPIO_PIN_10
|
#define ACC_INT_Pin GPIO_PIN_10
|
||||||
|
|||||||
@@ -61,7 +61,7 @@
|
|||||||
/* #define HAL_OSPI_MODULE_ENABLED */
|
/* #define HAL_OSPI_MODULE_ENABLED */
|
||||||
/* #define HAL_I2S_MODULE_ENABLED */
|
/* #define HAL_I2S_MODULE_ENABLED */
|
||||||
/* #define HAL_SMBUS_MODULE_ENABLED */
|
/* #define HAL_SMBUS_MODULE_ENABLED */
|
||||||
#define HAL_IWDG_MODULE_ENABLED
|
/* #define HAL_IWDG_MODULE_ENABLED */
|
||||||
/* #define HAL_LPTIM_MODULE_ENABLED */
|
/* #define HAL_LPTIM_MODULE_ENABLED */
|
||||||
/* #define HAL_LTDC_MODULE_ENABLED */
|
/* #define HAL_LTDC_MODULE_ENABLED */
|
||||||
/* #define HAL_QSPI_MODULE_ENABLED */
|
/* #define HAL_QSPI_MODULE_ENABLED */
|
||||||
|
|||||||
@@ -52,14 +52,18 @@ void MemManage_Handler(void);
|
|||||||
void BusFault_Handler(void);
|
void BusFault_Handler(void);
|
||||||
void UsageFault_Handler(void);
|
void UsageFault_Handler(void);
|
||||||
void DebugMon_Handler(void);
|
void DebugMon_Handler(void);
|
||||||
|
void DMA1_Stream0_IRQHandler(void);
|
||||||
void DMA1_Stream1_IRQHandler(void);
|
void DMA1_Stream1_IRQHandler(void);
|
||||||
void DMA1_Stream2_IRQHandler(void);
|
void DMA1_Stream2_IRQHandler(void);
|
||||||
void DMA1_Stream3_IRQHandler(void);
|
void DMA1_Stream3_IRQHandler(void);
|
||||||
void DMA1_Stream4_IRQHandler(void);
|
void DMA1_Stream4_IRQHandler(void);
|
||||||
void DMA1_Stream5_IRQHandler(void);
|
void DMA1_Stream5_IRQHandler(void);
|
||||||
void DMA1_Stream6_IRQHandler(void);
|
void DMA1_Stream6_IRQHandler(void);
|
||||||
|
void ADC_IRQHandler(void);
|
||||||
void FDCAN1_IT0_IRQHandler(void);
|
void FDCAN1_IT0_IRQHandler(void);
|
||||||
void FDCAN2_IT0_IRQHandler(void);
|
void FDCAN2_IT0_IRQHandler(void);
|
||||||
|
void FDCAN1_IT1_IRQHandler(void);
|
||||||
|
void FDCAN2_IT1_IRQHandler(void);
|
||||||
void SPI1_IRQHandler(void);
|
void SPI1_IRQHandler(void);
|
||||||
void SPI2_IRQHandler(void);
|
void SPI2_IRQHandler(void);
|
||||||
void USART1_IRQHandler(void);
|
void USART1_IRQHandler(void);
|
||||||
@@ -78,6 +82,7 @@ void OTG_HS_IRQHandler(void);
|
|||||||
void UART7_IRQHandler(void);
|
void UART7_IRQHandler(void);
|
||||||
void USART10_IRQHandler(void);
|
void USART10_IRQHandler(void);
|
||||||
void FDCAN3_IT0_IRQHandler(void);
|
void FDCAN3_IT0_IRQHandler(void);
|
||||||
|
void FDCAN3_IT1_IRQHandler(void);
|
||||||
void TIM23_IRQHandler(void);
|
void TIM23_IRQHandler(void);
|
||||||
/* USER CODE BEGIN EFP */
|
/* USER CODE BEGIN EFP */
|
||||||
|
|
||||||
|
|||||||
167
Core/Src/adc.c
167
Core/Src/adc.c
@@ -24,8 +24,84 @@
|
|||||||
|
|
||||||
/* USER CODE END 0 */
|
/* USER CODE END 0 */
|
||||||
|
|
||||||
|
ADC_HandleTypeDef hadc1;
|
||||||
ADC_HandleTypeDef hadc3;
|
ADC_HandleTypeDef hadc3;
|
||||||
|
DMA_HandleTypeDef hdma_adc1;
|
||||||
|
|
||||||
|
/* ADC1 init function */
|
||||||
|
void MX_ADC1_Init(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
/* USER CODE BEGIN ADC1_Init 0 */
|
||||||
|
|
||||||
|
/* USER CODE END ADC1_Init 0 */
|
||||||
|
|
||||||
|
ADC_MultiModeTypeDef multimode = {0};
|
||||||
|
ADC_ChannelConfTypeDef sConfig = {0};
|
||||||
|
|
||||||
|
/* USER CODE BEGIN ADC1_Init 1 */
|
||||||
|
|
||||||
|
/* USER CODE END ADC1_Init 1 */
|
||||||
|
|
||||||
|
/** Common config
|
||||||
|
*/
|
||||||
|
hadc1.Instance = ADC1;
|
||||||
|
hadc1.Init.ClockPrescaler = ADC_CLOCK_ASYNC_DIV64;
|
||||||
|
hadc1.Init.Resolution = ADC_RESOLUTION_16B;
|
||||||
|
hadc1.Init.ScanConvMode = ADC_SCAN_ENABLE;
|
||||||
|
hadc1.Init.EOCSelection = ADC_EOC_SINGLE_CONV;
|
||||||
|
hadc1.Init.LowPowerAutoWait = DISABLE;
|
||||||
|
hadc1.Init.ContinuousConvMode = ENABLE;
|
||||||
|
hadc1.Init.NbrOfConversion = 2;
|
||||||
|
hadc1.Init.DiscontinuousConvMode = DISABLE;
|
||||||
|
hadc1.Init.ExternalTrigConv = ADC_SOFTWARE_START;
|
||||||
|
hadc1.Init.ExternalTrigConvEdge = ADC_EXTERNALTRIGCONVEDGE_NONE;
|
||||||
|
hadc1.Init.ConversionDataManagement = ADC_CONVERSIONDATA_DMA_CIRCULAR;
|
||||||
|
hadc1.Init.Overrun = ADC_OVR_DATA_PRESERVED;
|
||||||
|
hadc1.Init.LeftBitShift = ADC_LEFTBITSHIFT_NONE;
|
||||||
|
hadc1.Init.OversamplingMode = DISABLE;
|
||||||
|
hadc1.Init.Oversampling.Ratio = 1;
|
||||||
|
if (HAL_ADC_Init(&hadc1) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Configure the ADC multi-mode
|
||||||
|
*/
|
||||||
|
multimode.Mode = ADC_MODE_INDEPENDENT;
|
||||||
|
if (HAL_ADCEx_MultiModeConfigChannel(&hadc1, &multimode) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Configure Regular Channel
|
||||||
|
*/
|
||||||
|
sConfig.Channel = ADC_CHANNEL_4;
|
||||||
|
sConfig.Rank = ADC_REGULAR_RANK_1;
|
||||||
|
sConfig.SamplingTime = ADC_SAMPLETIME_64CYCLES_5;
|
||||||
|
sConfig.SingleDiff = ADC_SINGLE_ENDED;
|
||||||
|
sConfig.OffsetNumber = ADC_OFFSET_NONE;
|
||||||
|
sConfig.Offset = 0;
|
||||||
|
sConfig.OffsetSignedSaturation = DISABLE;
|
||||||
|
if (HAL_ADC_ConfigChannel(&hadc1, &sConfig) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Configure Regular Channel
|
||||||
|
*/
|
||||||
|
sConfig.Channel = ADC_CHANNEL_19;
|
||||||
|
sConfig.Rank = ADC_REGULAR_RANK_2;
|
||||||
|
sConfig.SamplingTime = ADC_SAMPLETIME_64CYCLES_5;
|
||||||
|
if (HAL_ADC_ConfigChannel(&hadc1, &sConfig) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
/* USER CODE BEGIN ADC1_Init 2 */
|
||||||
|
|
||||||
|
/* USER CODE END ADC1_Init 2 */
|
||||||
|
|
||||||
|
}
|
||||||
/* ADC3 init function */
|
/* ADC3 init function */
|
||||||
void MX_ADC3_Init(void)
|
void MX_ADC3_Init(void)
|
||||||
{
|
{
|
||||||
@@ -88,30 +164,62 @@ void MX_ADC3_Init(void)
|
|||||||
void HAL_ADC_MspInit(ADC_HandleTypeDef* adcHandle)
|
void HAL_ADC_MspInit(ADC_HandleTypeDef* adcHandle)
|
||||||
{
|
{
|
||||||
|
|
||||||
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0};
|
GPIO_InitTypeDef GPIO_InitStruct = {0};
|
||||||
if(adcHandle->Instance==ADC3)
|
if(adcHandle->Instance==ADC1)
|
||||||
{
|
{
|
||||||
/* USER CODE BEGIN ADC3_MspInit 0 */
|
/* USER CODE BEGIN ADC1_MspInit 0 */
|
||||||
|
|
||||||
/* USER CODE END ADC3_MspInit 0 */
|
/* USER CODE END ADC1_MspInit 0 */
|
||||||
|
/* ADC1 clock enable */
|
||||||
|
__HAL_RCC_ADC12_CLK_ENABLE();
|
||||||
|
|
||||||
/** Initializes the peripherals clock
|
__HAL_RCC_GPIOA_CLK_ENABLE();
|
||||||
|
__HAL_RCC_GPIOC_CLK_ENABLE();
|
||||||
|
/**ADC1 GPIO Configuration
|
||||||
|
PA5 ------> ADC1_INP19
|
||||||
|
PC4 ------> ADC1_INP4
|
||||||
*/
|
*/
|
||||||
PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_ADC;
|
GPIO_InitStruct.Pin = GPIO_PIN_5;
|
||||||
PeriphClkInitStruct.PLL2.PLL2M = 2;
|
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
|
||||||
PeriphClkInitStruct.PLL2.PLL2N = 16;
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
PeriphClkInitStruct.PLL2.PLL2P = 2;
|
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
||||||
PeriphClkInitStruct.PLL2.PLL2Q = 2;
|
|
||||||
PeriphClkInitStruct.PLL2.PLL2R = 2;
|
GPIO_InitStruct.Pin = GPIO_PIN_4;
|
||||||
PeriphClkInitStruct.PLL2.PLL2RGE = RCC_PLL2VCIRANGE_3;
|
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
|
||||||
PeriphClkInitStruct.PLL2.PLL2VCOSEL = RCC_PLL2VCOWIDE;
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
PeriphClkInitStruct.PLL2.PLL2FRACN = 0;
|
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
|
||||||
PeriphClkInitStruct.AdcClockSelection = RCC_ADCCLKSOURCE_PLL2;
|
|
||||||
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK)
|
/* ADC1 DMA Init */
|
||||||
|
/* ADC1 Init */
|
||||||
|
hdma_adc1.Instance = DMA1_Stream2;
|
||||||
|
hdma_adc1.Init.Request = DMA_REQUEST_ADC1;
|
||||||
|
hdma_adc1.Init.Direction = DMA_PERIPH_TO_MEMORY;
|
||||||
|
hdma_adc1.Init.PeriphInc = DMA_PINC_DISABLE;
|
||||||
|
hdma_adc1.Init.MemInc = DMA_MINC_ENABLE;
|
||||||
|
hdma_adc1.Init.PeriphDataAlignment = DMA_PDATAALIGN_HALFWORD;
|
||||||
|
hdma_adc1.Init.MemDataAlignment = DMA_MDATAALIGN_HALFWORD;
|
||||||
|
hdma_adc1.Init.Mode = DMA_CIRCULAR;
|
||||||
|
hdma_adc1.Init.Priority = DMA_PRIORITY_LOW;
|
||||||
|
hdma_adc1.Init.FIFOMode = DMA_FIFOMODE_DISABLE;
|
||||||
|
if (HAL_DMA_Init(&hdma_adc1) != HAL_OK)
|
||||||
{
|
{
|
||||||
Error_Handler();
|
Error_Handler();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
__HAL_LINKDMA(adcHandle,DMA_Handle,hdma_adc1);
|
||||||
|
|
||||||
|
/* ADC1 interrupt Init */
|
||||||
|
HAL_NVIC_SetPriority(ADC_IRQn, 5, 0);
|
||||||
|
HAL_NVIC_EnableIRQ(ADC_IRQn);
|
||||||
|
/* USER CODE BEGIN ADC1_MspInit 1 */
|
||||||
|
|
||||||
|
/* USER CODE END ADC1_MspInit 1 */
|
||||||
|
}
|
||||||
|
else if(adcHandle->Instance==ADC3)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN ADC3_MspInit 0 */
|
||||||
|
|
||||||
|
/* USER CODE END ADC3_MspInit 0 */
|
||||||
/* ADC3 clock enable */
|
/* ADC3 clock enable */
|
||||||
__HAL_RCC_ADC3_CLK_ENABLE();
|
__HAL_RCC_ADC3_CLK_ENABLE();
|
||||||
/* USER CODE BEGIN ADC3_MspInit 1 */
|
/* USER CODE BEGIN ADC3_MspInit 1 */
|
||||||
@@ -123,7 +231,32 @@ void HAL_ADC_MspInit(ADC_HandleTypeDef* adcHandle)
|
|||||||
void HAL_ADC_MspDeInit(ADC_HandleTypeDef* adcHandle)
|
void HAL_ADC_MspDeInit(ADC_HandleTypeDef* adcHandle)
|
||||||
{
|
{
|
||||||
|
|
||||||
if(adcHandle->Instance==ADC3)
|
if(adcHandle->Instance==ADC1)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN ADC1_MspDeInit 0 */
|
||||||
|
|
||||||
|
/* USER CODE END ADC1_MspDeInit 0 */
|
||||||
|
/* Peripheral clock disable */
|
||||||
|
__HAL_RCC_ADC12_CLK_DISABLE();
|
||||||
|
|
||||||
|
/**ADC1 GPIO Configuration
|
||||||
|
PA5 ------> ADC1_INP19
|
||||||
|
PC4 ------> ADC1_INP4
|
||||||
|
*/
|
||||||
|
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_5);
|
||||||
|
|
||||||
|
HAL_GPIO_DeInit(GPIOC, GPIO_PIN_4);
|
||||||
|
|
||||||
|
/* ADC1 DMA DeInit */
|
||||||
|
HAL_DMA_DeInit(adcHandle->DMA_Handle);
|
||||||
|
|
||||||
|
/* ADC1 interrupt Deinit */
|
||||||
|
HAL_NVIC_DisableIRQ(ADC_IRQn);
|
||||||
|
/* USER CODE BEGIN ADC1_MspDeInit 1 */
|
||||||
|
|
||||||
|
/* USER CODE END ADC1_MspDeInit 1 */
|
||||||
|
}
|
||||||
|
else if(adcHandle->Instance==ADC3)
|
||||||
{
|
{
|
||||||
/* USER CODE BEGIN ADC3_MspDeInit 0 */
|
/* USER CODE BEGIN ADC3_MspDeInit 0 */
|
||||||
|
|
||||||
|
|||||||
@@ -44,6 +44,9 @@ void MX_DMA_Init(void)
|
|||||||
__HAL_RCC_DMA1_CLK_ENABLE();
|
__HAL_RCC_DMA1_CLK_ENABLE();
|
||||||
|
|
||||||
/* DMA interrupt init */
|
/* DMA interrupt init */
|
||||||
|
/* DMA1_Stream0_IRQn interrupt configuration */
|
||||||
|
HAL_NVIC_SetPriority(DMA1_Stream0_IRQn, 5, 0);
|
||||||
|
HAL_NVIC_EnableIRQ(DMA1_Stream0_IRQn);
|
||||||
/* DMA1_Stream1_IRQn interrupt configuration */
|
/* DMA1_Stream1_IRQn interrupt configuration */
|
||||||
HAL_NVIC_SetPriority(DMA1_Stream1_IRQn, 5, 0);
|
HAL_NVIC_SetPriority(DMA1_Stream1_IRQn, 5, 0);
|
||||||
HAL_NVIC_EnableIRQ(DMA1_Stream1_IRQn);
|
HAL_NVIC_EnableIRQ(DMA1_Stream1_IRQn);
|
||||||
|
|||||||
@@ -42,9 +42,9 @@ void MX_FDCAN1_Init(void)
|
|||||||
hfdcan1.Instance = FDCAN1;
|
hfdcan1.Instance = FDCAN1;
|
||||||
hfdcan1.Init.FrameFormat = FDCAN_FRAME_CLASSIC;
|
hfdcan1.Init.FrameFormat = FDCAN_FRAME_CLASSIC;
|
||||||
hfdcan1.Init.Mode = FDCAN_MODE_NORMAL;
|
hfdcan1.Init.Mode = FDCAN_MODE_NORMAL;
|
||||||
hfdcan1.Init.AutoRetransmission = ENABLE;
|
hfdcan1.Init.AutoRetransmission = DISABLE;
|
||||||
hfdcan1.Init.TransmitPause = DISABLE;
|
hfdcan1.Init.TransmitPause = DISABLE;
|
||||||
hfdcan1.Init.ProtocolException = ENABLE;
|
hfdcan1.Init.ProtocolException = DISABLE;
|
||||||
hfdcan1.Init.NominalPrescaler = 3;
|
hfdcan1.Init.NominalPrescaler = 3;
|
||||||
hfdcan1.Init.NominalSyncJumpWidth = 10;
|
hfdcan1.Init.NominalSyncJumpWidth = 10;
|
||||||
hfdcan1.Init.NominalTimeSeg1 = 29;
|
hfdcan1.Init.NominalTimeSeg1 = 29;
|
||||||
@@ -54,11 +54,11 @@ void MX_FDCAN1_Init(void)
|
|||||||
hfdcan1.Init.DataTimeSeg1 = 29;
|
hfdcan1.Init.DataTimeSeg1 = 29;
|
||||||
hfdcan1.Init.DataTimeSeg2 = 10;
|
hfdcan1.Init.DataTimeSeg2 = 10;
|
||||||
hfdcan1.Init.MessageRAMOffset = 0;
|
hfdcan1.Init.MessageRAMOffset = 0;
|
||||||
hfdcan1.Init.StdFiltersNbr = 1;
|
hfdcan1.Init.StdFiltersNbr = 14;
|
||||||
hfdcan1.Init.ExtFiltersNbr = 0;
|
hfdcan1.Init.ExtFiltersNbr = 0;
|
||||||
hfdcan1.Init.RxFifo0ElmtsNbr = 32;
|
hfdcan1.Init.RxFifo0ElmtsNbr = 4;
|
||||||
hfdcan1.Init.RxFifo0ElmtSize = FDCAN_DATA_BYTES_8;
|
hfdcan1.Init.RxFifo0ElmtSize = FDCAN_DATA_BYTES_8;
|
||||||
hfdcan1.Init.RxFifo1ElmtsNbr = 0;
|
hfdcan1.Init.RxFifo1ElmtsNbr = 4;
|
||||||
hfdcan1.Init.RxFifo1ElmtSize = FDCAN_DATA_BYTES_8;
|
hfdcan1.Init.RxFifo1ElmtSize = FDCAN_DATA_BYTES_8;
|
||||||
hfdcan1.Init.RxBuffersNbr = 0;
|
hfdcan1.Init.RxBuffersNbr = 0;
|
||||||
hfdcan1.Init.RxBufferSize = FDCAN_DATA_BYTES_8;
|
hfdcan1.Init.RxBufferSize = FDCAN_DATA_BYTES_8;
|
||||||
@@ -90,9 +90,9 @@ void MX_FDCAN2_Init(void)
|
|||||||
hfdcan2.Instance = FDCAN2;
|
hfdcan2.Instance = FDCAN2;
|
||||||
hfdcan2.Init.FrameFormat = FDCAN_FRAME_CLASSIC;
|
hfdcan2.Init.FrameFormat = FDCAN_FRAME_CLASSIC;
|
||||||
hfdcan2.Init.Mode = FDCAN_MODE_NORMAL;
|
hfdcan2.Init.Mode = FDCAN_MODE_NORMAL;
|
||||||
hfdcan2.Init.AutoRetransmission = ENABLE;
|
hfdcan2.Init.AutoRetransmission = DISABLE;
|
||||||
hfdcan2.Init.TransmitPause = DISABLE;
|
hfdcan2.Init.TransmitPause = DISABLE;
|
||||||
hfdcan2.Init.ProtocolException = ENABLE;
|
hfdcan2.Init.ProtocolException = DISABLE;
|
||||||
hfdcan2.Init.NominalPrescaler = 3;
|
hfdcan2.Init.NominalPrescaler = 3;
|
||||||
hfdcan2.Init.NominalSyncJumpWidth = 10;
|
hfdcan2.Init.NominalSyncJumpWidth = 10;
|
||||||
hfdcan2.Init.NominalTimeSeg1 = 29;
|
hfdcan2.Init.NominalTimeSeg1 = 29;
|
||||||
@@ -102,11 +102,11 @@ void MX_FDCAN2_Init(void)
|
|||||||
hfdcan2.Init.DataTimeSeg1 = 29;
|
hfdcan2.Init.DataTimeSeg1 = 29;
|
||||||
hfdcan2.Init.DataTimeSeg2 = 10;
|
hfdcan2.Init.DataTimeSeg2 = 10;
|
||||||
hfdcan2.Init.MessageRAMOffset = 853;
|
hfdcan2.Init.MessageRAMOffset = 853;
|
||||||
hfdcan2.Init.StdFiltersNbr = 1;
|
hfdcan2.Init.StdFiltersNbr = 14;
|
||||||
hfdcan2.Init.ExtFiltersNbr = 0;
|
hfdcan2.Init.ExtFiltersNbr = 0;
|
||||||
hfdcan2.Init.RxFifo0ElmtsNbr = 0;
|
hfdcan2.Init.RxFifo0ElmtsNbr = 4;
|
||||||
hfdcan2.Init.RxFifo0ElmtSize = FDCAN_DATA_BYTES_8;
|
hfdcan2.Init.RxFifo0ElmtSize = FDCAN_DATA_BYTES_8;
|
||||||
hfdcan2.Init.RxFifo1ElmtsNbr = 32;
|
hfdcan2.Init.RxFifo1ElmtsNbr = 4;
|
||||||
hfdcan2.Init.RxFifo1ElmtSize = FDCAN_DATA_BYTES_8;
|
hfdcan2.Init.RxFifo1ElmtSize = FDCAN_DATA_BYTES_8;
|
||||||
hfdcan2.Init.RxBuffersNbr = 0;
|
hfdcan2.Init.RxBuffersNbr = 0;
|
||||||
hfdcan2.Init.RxBufferSize = FDCAN_DATA_BYTES_8;
|
hfdcan2.Init.RxBufferSize = FDCAN_DATA_BYTES_8;
|
||||||
@@ -138,29 +138,29 @@ void MX_FDCAN3_Init(void)
|
|||||||
hfdcan3.Instance = FDCAN3;
|
hfdcan3.Instance = FDCAN3;
|
||||||
hfdcan3.Init.FrameFormat = FDCAN_FRAME_CLASSIC;
|
hfdcan3.Init.FrameFormat = FDCAN_FRAME_CLASSIC;
|
||||||
hfdcan3.Init.Mode = FDCAN_MODE_NORMAL;
|
hfdcan3.Init.Mode = FDCAN_MODE_NORMAL;
|
||||||
hfdcan3.Init.AutoRetransmission = ENABLE;
|
hfdcan3.Init.AutoRetransmission = DISABLE;
|
||||||
hfdcan3.Init.TransmitPause = DISABLE;
|
hfdcan3.Init.TransmitPause = DISABLE;
|
||||||
hfdcan3.Init.ProtocolException = ENABLE;
|
hfdcan3.Init.ProtocolException = DISABLE;
|
||||||
hfdcan3.Init.NominalPrescaler = 24;
|
hfdcan3.Init.NominalPrescaler = 3;
|
||||||
hfdcan3.Init.NominalSyncJumpWidth = 10;
|
hfdcan3.Init.NominalSyncJumpWidth = 10;
|
||||||
hfdcan3.Init.NominalTimeSeg1 = 2;
|
hfdcan3.Init.NominalTimeSeg1 = 29;
|
||||||
hfdcan3.Init.NominalTimeSeg2 = 2;
|
hfdcan3.Init.NominalTimeSeg2 = 10;
|
||||||
hfdcan3.Init.DataPrescaler = 3;
|
hfdcan3.Init.DataPrescaler = 3;
|
||||||
hfdcan3.Init.DataSyncJumpWidth = 10;
|
hfdcan3.Init.DataSyncJumpWidth = 10;
|
||||||
hfdcan3.Init.DataTimeSeg1 = 29;
|
hfdcan3.Init.DataTimeSeg1 = 29;
|
||||||
hfdcan3.Init.DataTimeSeg2 = 10;
|
hfdcan3.Init.DataTimeSeg2 = 10;
|
||||||
hfdcan3.Init.MessageRAMOffset = 1706;
|
hfdcan3.Init.MessageRAMOffset = 1706;
|
||||||
hfdcan3.Init.StdFiltersNbr = 1;
|
hfdcan3.Init.StdFiltersNbr = 14;
|
||||||
hfdcan3.Init.ExtFiltersNbr = 0;
|
hfdcan3.Init.ExtFiltersNbr = 0;
|
||||||
hfdcan3.Init.RxFifo0ElmtsNbr = 0;
|
hfdcan3.Init.RxFifo0ElmtsNbr = 4;
|
||||||
hfdcan3.Init.RxFifo0ElmtSize = FDCAN_DATA_BYTES_8;
|
hfdcan3.Init.RxFifo0ElmtSize = FDCAN_DATA_BYTES_8;
|
||||||
hfdcan3.Init.RxFifo1ElmtsNbr = 32;
|
hfdcan3.Init.RxFifo1ElmtsNbr = 4;
|
||||||
hfdcan3.Init.RxFifo1ElmtSize = FDCAN_DATA_BYTES_8;
|
hfdcan3.Init.RxFifo1ElmtSize = FDCAN_DATA_BYTES_8;
|
||||||
hfdcan3.Init.RxBuffersNbr = 0;
|
hfdcan3.Init.RxBuffersNbr = 0;
|
||||||
hfdcan3.Init.RxBufferSize = FDCAN_DATA_BYTES_8;
|
hfdcan3.Init.RxBufferSize = FDCAN_DATA_BYTES_8;
|
||||||
hfdcan3.Init.TxEventsNbr = 0;
|
hfdcan3.Init.TxEventsNbr = 0;
|
||||||
hfdcan3.Init.TxBuffersNbr = 0;
|
hfdcan3.Init.TxBuffersNbr = 0;
|
||||||
hfdcan3.Init.TxFifoQueueElmtsNbr = 6;
|
hfdcan3.Init.TxFifoQueueElmtsNbr = 32;
|
||||||
hfdcan3.Init.TxFifoQueueMode = FDCAN_TX_FIFO_OPERATION;
|
hfdcan3.Init.TxFifoQueueMode = FDCAN_TX_FIFO_OPERATION;
|
||||||
hfdcan3.Init.TxElmtSize = FDCAN_DATA_BYTES_8;
|
hfdcan3.Init.TxElmtSize = FDCAN_DATA_BYTES_8;
|
||||||
if (HAL_FDCAN_Init(&hfdcan3) != HAL_OK)
|
if (HAL_FDCAN_Init(&hfdcan3) != HAL_OK)
|
||||||
@@ -216,6 +216,8 @@ void HAL_FDCAN_MspInit(FDCAN_HandleTypeDef* fdcanHandle)
|
|||||||
/* FDCAN1 interrupt Init */
|
/* FDCAN1 interrupt Init */
|
||||||
HAL_NVIC_SetPriority(FDCAN1_IT0_IRQn, 5, 0);
|
HAL_NVIC_SetPriority(FDCAN1_IT0_IRQn, 5, 0);
|
||||||
HAL_NVIC_EnableIRQ(FDCAN1_IT0_IRQn);
|
HAL_NVIC_EnableIRQ(FDCAN1_IT0_IRQn);
|
||||||
|
HAL_NVIC_SetPriority(FDCAN1_IT1_IRQn, 5, 0);
|
||||||
|
HAL_NVIC_EnableIRQ(FDCAN1_IT1_IRQn);
|
||||||
/* USER CODE BEGIN FDCAN1_MspInit 1 */
|
/* USER CODE BEGIN FDCAN1_MspInit 1 */
|
||||||
|
|
||||||
/* USER CODE END FDCAN1_MspInit 1 */
|
/* USER CODE END FDCAN1_MspInit 1 */
|
||||||
@@ -256,6 +258,8 @@ void HAL_FDCAN_MspInit(FDCAN_HandleTypeDef* fdcanHandle)
|
|||||||
/* FDCAN2 interrupt Init */
|
/* FDCAN2 interrupt Init */
|
||||||
HAL_NVIC_SetPriority(FDCAN2_IT0_IRQn, 5, 0);
|
HAL_NVIC_SetPriority(FDCAN2_IT0_IRQn, 5, 0);
|
||||||
HAL_NVIC_EnableIRQ(FDCAN2_IT0_IRQn);
|
HAL_NVIC_EnableIRQ(FDCAN2_IT0_IRQn);
|
||||||
|
HAL_NVIC_SetPriority(FDCAN2_IT1_IRQn, 5, 0);
|
||||||
|
HAL_NVIC_EnableIRQ(FDCAN2_IT1_IRQn);
|
||||||
/* USER CODE BEGIN FDCAN2_MspInit 1 */
|
/* USER CODE BEGIN FDCAN2_MspInit 1 */
|
||||||
|
|
||||||
/* USER CODE END FDCAN2_MspInit 1 */
|
/* USER CODE END FDCAN2_MspInit 1 */
|
||||||
@@ -296,6 +300,8 @@ void HAL_FDCAN_MspInit(FDCAN_HandleTypeDef* fdcanHandle)
|
|||||||
/* FDCAN3 interrupt Init */
|
/* FDCAN3 interrupt Init */
|
||||||
HAL_NVIC_SetPriority(FDCAN3_IT0_IRQn, 5, 0);
|
HAL_NVIC_SetPriority(FDCAN3_IT0_IRQn, 5, 0);
|
||||||
HAL_NVIC_EnableIRQ(FDCAN3_IT0_IRQn);
|
HAL_NVIC_EnableIRQ(FDCAN3_IT0_IRQn);
|
||||||
|
HAL_NVIC_SetPriority(FDCAN3_IT1_IRQn, 5, 0);
|
||||||
|
HAL_NVIC_EnableIRQ(FDCAN3_IT1_IRQn);
|
||||||
/* USER CODE BEGIN FDCAN3_MspInit 1 */
|
/* USER CODE BEGIN FDCAN3_MspInit 1 */
|
||||||
|
|
||||||
/* USER CODE END FDCAN3_MspInit 1 */
|
/* USER CODE END FDCAN3_MspInit 1 */
|
||||||
@@ -324,6 +330,7 @@ void HAL_FDCAN_MspDeInit(FDCAN_HandleTypeDef* fdcanHandle)
|
|||||||
|
|
||||||
/* FDCAN1 interrupt Deinit */
|
/* FDCAN1 interrupt Deinit */
|
||||||
HAL_NVIC_DisableIRQ(FDCAN1_IT0_IRQn);
|
HAL_NVIC_DisableIRQ(FDCAN1_IT0_IRQn);
|
||||||
|
HAL_NVIC_DisableIRQ(FDCAN1_IT1_IRQn);
|
||||||
/* USER CODE BEGIN FDCAN1_MspDeInit 1 */
|
/* USER CODE BEGIN FDCAN1_MspDeInit 1 */
|
||||||
|
|
||||||
/* USER CODE END FDCAN1_MspDeInit 1 */
|
/* USER CODE END FDCAN1_MspDeInit 1 */
|
||||||
@@ -347,6 +354,7 @@ void HAL_FDCAN_MspDeInit(FDCAN_HandleTypeDef* fdcanHandle)
|
|||||||
|
|
||||||
/* FDCAN2 interrupt Deinit */
|
/* FDCAN2 interrupt Deinit */
|
||||||
HAL_NVIC_DisableIRQ(FDCAN2_IT0_IRQn);
|
HAL_NVIC_DisableIRQ(FDCAN2_IT0_IRQn);
|
||||||
|
HAL_NVIC_DisableIRQ(FDCAN2_IT1_IRQn);
|
||||||
/* USER CODE BEGIN FDCAN2_MspDeInit 1 */
|
/* USER CODE BEGIN FDCAN2_MspDeInit 1 */
|
||||||
|
|
||||||
/* USER CODE END FDCAN2_MspDeInit 1 */
|
/* USER CODE END FDCAN2_MspDeInit 1 */
|
||||||
@@ -370,6 +378,7 @@ void HAL_FDCAN_MspDeInit(FDCAN_HandleTypeDef* fdcanHandle)
|
|||||||
|
|
||||||
/* FDCAN3 interrupt Deinit */
|
/* FDCAN3 interrupt Deinit */
|
||||||
HAL_NVIC_DisableIRQ(FDCAN3_IT0_IRQn);
|
HAL_NVIC_DisableIRQ(FDCAN3_IT0_IRQn);
|
||||||
|
HAL_NVIC_DisableIRQ(FDCAN3_IT1_IRQn);
|
||||||
/* USER CODE BEGIN FDCAN3_MspDeInit 1 */
|
/* USER CODE BEGIN FDCAN3_MspDeInit 1 */
|
||||||
|
|
||||||
/* USER CODE END FDCAN3_MspDeInit 1 */
|
/* USER CODE END FDCAN3_MspDeInit 1 */
|
||||||
|
|||||||
@@ -25,7 +25,19 @@
|
|||||||
|
|
||||||
/* Private includes ----------------------------------------------------------*/
|
/* Private includes ----------------------------------------------------------*/
|
||||||
/* USER CODE BEGIN Includes */
|
/* USER CODE BEGIN Includes */
|
||||||
|
#include "ws2812status.h"
|
||||||
|
#include "ins_task.h"
|
||||||
|
#include "buzzer.h"
|
||||||
|
#include "tft.h"
|
||||||
|
#include "prts.h"
|
||||||
|
// #include "remoteTask.h"
|
||||||
|
//
|
||||||
|
// #include "bsp_dwt.h"
|
||||||
|
// // #include "ins_task.h"
|
||||||
|
// #include "bsp_log.h"
|
||||||
|
#include "dev_cmd.h"
|
||||||
|
#include "daemon.h"
|
||||||
|
#include "bsp_usart.h"
|
||||||
/* USER CODE END Includes */
|
/* USER CODE END Includes */
|
||||||
|
|
||||||
/* Private typedef -----------------------------------------------------------*/
|
/* Private typedef -----------------------------------------------------------*/
|
||||||
@@ -35,6 +47,8 @@
|
|||||||
|
|
||||||
/* Private define ------------------------------------------------------------*/
|
/* Private define ------------------------------------------------------------*/
|
||||||
/* USER CODE BEGIN PD */
|
/* USER CODE BEGIN PD */
|
||||||
|
#define PRTS_STATUS_UPDATE_PERIOD_MS 50U
|
||||||
|
#define PRTS_TASK_SLEEP_CAP_MS 1U
|
||||||
|
|
||||||
/* USER CODE END PD */
|
/* USER CODE END PD */
|
||||||
|
|
||||||
@@ -51,7 +65,7 @@
|
|||||||
osThreadId_t BeginTaskHandle;
|
osThreadId_t BeginTaskHandle;
|
||||||
const osThreadAttr_t BeginTask_attributes = {
|
const osThreadAttr_t BeginTask_attributes = {
|
||||||
.name = "BeginTask",
|
.name = "BeginTask",
|
||||||
.stack_size = 256 * 4,
|
.stack_size = 512 * 4,
|
||||||
.priority = (osPriority_t) osPriorityNormal,
|
.priority = (osPriority_t) osPriorityNormal,
|
||||||
};
|
};
|
||||||
/* Definitions for shoot */
|
/* Definitions for shoot */
|
||||||
@@ -103,9 +117,62 @@ const osThreadAttr_t reference_attributes = {
|
|||||||
.stack_size = 512 * 4,
|
.stack_size = 512 * 4,
|
||||||
.priority = (osPriority_t) osPriorityNormal,
|
.priority = (osPriority_t) osPriorityNormal,
|
||||||
};
|
};
|
||||||
|
/* Definitions for WS2812Task */
|
||||||
|
osThreadId_t WS2812TaskHandle;
|
||||||
|
const osThreadAttr_t WS2812Task_attributes = {
|
||||||
|
.name = "WS2812Task",
|
||||||
|
.stack_size = 256 * 4,
|
||||||
|
.priority = (osPriority_t) osPriorityBelowNormal,
|
||||||
|
};
|
||||||
|
|
||||||
/* Private function prototypes -----------------------------------------------*/
|
/* Private function prototypes -----------------------------------------------*/
|
||||||
/* USER CODE BEGIN FunctionPrototypes */
|
/* USER CODE BEGIN FunctionPrototypes */
|
||||||
|
//@Todo:测试instask
|
||||||
|
const osThreadAttr_t instask_attributes = {
|
||||||
|
.name = "instask",
|
||||||
|
.priority = osPriorityAboveNormal, // 较高优先级
|
||||||
|
.stack_size = 1024 * 4 // 栈大小,单位是字节(通常是字数的4倍)
|
||||||
|
};
|
||||||
|
|
||||||
|
//@Todo:测试使用
|
||||||
|
osThreadId insTaskHandle;
|
||||||
|
|
||||||
|
void StartINSTASK(void *argument);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//@Todo:测试daemon(但是没有daemon注册)
|
||||||
|
const osThreadAttr_t daemon_attributes = {
|
||||||
|
.name = "daemon",
|
||||||
|
.priority = osPriorityAboveNormal, // 较高优先级
|
||||||
|
.stack_size = 1024 * 4 // 栈大小,单位是字节(通常是字数的4倍)
|
||||||
|
};
|
||||||
|
|
||||||
|
//@Todo:测试使用
|
||||||
|
osThreadId daemonHandle;
|
||||||
|
|
||||||
|
void StartDaemonTask(void *argument); // <--- 新的,带参数的标准 RTOS 线程声明
|
||||||
|
|
||||||
|
const osThreadAttr_t buzzer_attributes = {
|
||||||
|
.name = "buzzer",
|
||||||
|
.priority = osPriorityNormal,
|
||||||
|
.stack_size = 512 * 4
|
||||||
|
};
|
||||||
|
osThreadId buzzerHandle;
|
||||||
|
extern void buzzerTask(void const *argument);
|
||||||
|
|
||||||
|
static StackType_t prtsTaskStack[1024];
|
||||||
|
static StaticTask_t prtsTaskControlBlock;
|
||||||
|
const osThreadAttr_t prts_attributes = {
|
||||||
|
.name = "prts",
|
||||||
|
.cb_mem = &prtsTaskControlBlock,
|
||||||
|
.cb_size = sizeof(prtsTaskControlBlock),
|
||||||
|
.stack_mem = prtsTaskStack,
|
||||||
|
.stack_size = sizeof(prtsTaskStack),
|
||||||
|
.priority = osPriorityNormal
|
||||||
|
};
|
||||||
|
osThreadId_t prtsHandle;
|
||||||
|
void StartPRTSTask(void *argument);
|
||||||
|
|
||||||
/* USER CODE END FunctionPrototypes */
|
/* USER CODE END FunctionPrototypes */
|
||||||
|
|
||||||
@@ -117,6 +184,7 @@ void StartInitTask(void *argument);
|
|||||||
void VisionTask(void *argument);
|
void VisionTask(void *argument);
|
||||||
void CmdTask(void *argument);
|
void CmdTask(void *argument);
|
||||||
void RefereeTask(void *argument);
|
void RefereeTask(void *argument);
|
||||||
|
extern void ws2812Task(void *argument);
|
||||||
|
|
||||||
extern void MX_USB_DEVICE_Init(void);
|
extern void MX_USB_DEVICE_Init(void);
|
||||||
void MX_FREERTOS_Init(void); /* (MISRA C 2004 rule 8.1) */
|
void MX_FREERTOS_Init(void); /* (MISRA C 2004 rule 8.1) */
|
||||||
@@ -132,6 +200,7 @@ void vApplicationStackOverflowHook(xTaskHandle xTask, signed char *pcTaskName)
|
|||||||
configCHECK_FOR_STACK_OVERFLOW is defined to 1 or 2. This hook function is
|
configCHECK_FOR_STACK_OVERFLOW is defined to 1 or 2. This hook function is
|
||||||
called if a stack overflow is detected. */
|
called if a stack overflow is detected. */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* USER CODE END 4 */
|
/* USER CODE END 4 */
|
||||||
|
|
||||||
/* USER CODE BEGIN 5 */
|
/* USER CODE BEGIN 5 */
|
||||||
@@ -148,6 +217,7 @@ void vApplicationMallocFailedHook(void)
|
|||||||
to query the size of free heap space that remains (although it does not
|
to query the size of free heap space that remains (although it does not
|
||||||
provide information on how the remaining heap might be fragmented). */
|
provide information on how the remaining heap might be fragmented). */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* USER CODE END 5 */
|
/* USER CODE END 5 */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -201,8 +271,20 @@ void MX_FREERTOS_Init(void) {
|
|||||||
/* creation of reference */
|
/* creation of reference */
|
||||||
referenceHandle = osThreadNew(RefereeTask, NULL, &reference_attributes);
|
referenceHandle = osThreadNew(RefereeTask, NULL, &reference_attributes);
|
||||||
|
|
||||||
|
/* creation of WS2812Task */
|
||||||
|
WS2812TaskHandle = osThreadNew(ws2812Task, NULL, &WS2812Task_attributes);
|
||||||
|
|
||||||
/* USER CODE BEGIN RTOS_THREADS */
|
/* USER CODE BEGIN RTOS_THREADS */
|
||||||
/* add threads, ... */
|
/* add threads, ... */
|
||||||
|
//@Todo:INS_Task是测试版本
|
||||||
|
// 创建线程
|
||||||
|
insTaskHandle = osThreadNew(StartINSTASK, NULL, &instask_attributes);
|
||||||
|
|
||||||
|
//@Todo:daemon是测试版本
|
||||||
|
// 创建线程
|
||||||
|
daemonHandle = osThreadNew(StartDaemonTask, NULL, &daemon_attributes); // <--- 换成新的函数名
|
||||||
|
buzzerHandle = osThreadNew(buzzerTask, NULL, &buzzer_attributes);
|
||||||
|
prtsHandle = osThreadNew(StartPRTSTask, NULL, &prts_attributes);
|
||||||
/* USER CODE END RTOS_THREADS */
|
/* USER CODE END RTOS_THREADS */
|
||||||
|
|
||||||
/* USER CODE BEGIN RTOS_EVENTS */
|
/* USER CODE BEGIN RTOS_EVENTS */
|
||||||
@@ -224,9 +306,9 @@ __weak void StartDefaultTask(void *argument)
|
|||||||
MX_USB_DEVICE_Init();
|
MX_USB_DEVICE_Init();
|
||||||
/* USER CODE BEGIN StartDefaultTask */
|
/* USER CODE BEGIN StartDefaultTask */
|
||||||
/* Infinite loop */
|
/* Infinite loop */
|
||||||
for(;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
osDelay(1);
|
osDelay(1000);
|
||||||
}
|
}
|
||||||
/* USER CODE END StartDefaultTask */
|
/* USER CODE END StartDefaultTask */
|
||||||
}
|
}
|
||||||
@@ -242,7 +324,7 @@ __weak void ShootTask(void *argument)
|
|||||||
{
|
{
|
||||||
/* USER CODE BEGIN ShootTask */
|
/* USER CODE BEGIN ShootTask */
|
||||||
/* Infinite loop */
|
/* Infinite loop */
|
||||||
for(;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
osDelay(1);
|
osDelay(1);
|
||||||
}
|
}
|
||||||
@@ -260,7 +342,7 @@ __weak void GimbalTask(void *argument)
|
|||||||
{
|
{
|
||||||
/* USER CODE BEGIN GimbalTask */
|
/* USER CODE BEGIN GimbalTask */
|
||||||
/* Infinite loop */
|
/* Infinite loop */
|
||||||
for(;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
osDelay(1);
|
osDelay(1);
|
||||||
}
|
}
|
||||||
@@ -278,7 +360,7 @@ __weak void ChassisTask(void *argument)
|
|||||||
{
|
{
|
||||||
/* USER CODE BEGIN ChassisTask */
|
/* USER CODE BEGIN ChassisTask */
|
||||||
/* Infinite loop */
|
/* Infinite loop */
|
||||||
for(;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
osDelay(1);
|
osDelay(1);
|
||||||
}
|
}
|
||||||
@@ -296,7 +378,7 @@ __weak void StartInitTask(void *argument)
|
|||||||
{
|
{
|
||||||
/* USER CODE BEGIN StartInitTask */
|
/* USER CODE BEGIN StartInitTask */
|
||||||
/* Infinite loop */
|
/* Infinite loop */
|
||||||
for(;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
osDelay(1);
|
osDelay(1);
|
||||||
}
|
}
|
||||||
@@ -314,7 +396,7 @@ __weak void VisionTask(void *argument)
|
|||||||
{
|
{
|
||||||
/* USER CODE BEGIN VisionTask */
|
/* USER CODE BEGIN VisionTask */
|
||||||
/* Infinite loop */
|
/* Infinite loop */
|
||||||
for(;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
osDelay(1);
|
osDelay(1);
|
||||||
}
|
}
|
||||||
@@ -332,7 +414,7 @@ __weak void CmdTask(void *argument)
|
|||||||
{
|
{
|
||||||
/* USER CODE BEGIN CmdTask */
|
/* USER CODE BEGIN CmdTask */
|
||||||
/* Infinite loop */
|
/* Infinite loop */
|
||||||
for(;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
osDelay(1);
|
osDelay(1);
|
||||||
}
|
}
|
||||||
@@ -350,7 +432,7 @@ __weak void RefereeTask(void *argument)
|
|||||||
{
|
{
|
||||||
/* USER CODE BEGIN RefereeTask */
|
/* USER CODE BEGIN RefereeTask */
|
||||||
/* Infinite loop */
|
/* Infinite loop */
|
||||||
for(;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
osDelay(1);
|
osDelay(1);
|
||||||
}
|
}
|
||||||
@@ -360,5 +442,100 @@ __weak void RefereeTask(void *argument)
|
|||||||
/* Private application code --------------------------------------------------*/
|
/* Private application code --------------------------------------------------*/
|
||||||
/* USER CODE BEGIN Application */
|
/* USER CODE BEGIN Application */
|
||||||
|
|
||||||
|
//@Todo:INS_Task是测试阶段使用。
|
||||||
|
__attribute__((noreturn)) void StartINSTASK(void *argument)
|
||||||
|
{
|
||||||
|
static float ins_start;
|
||||||
|
static float ins_dt;
|
||||||
|
INS_Init(); // 确保BMI088被正确初始化.
|
||||||
|
// LOGINFO("[freeRTOS] INS Task Start");
|
||||||
|
for (;;)
|
||||||
|
{
|
||||||
|
// 1kHz
|
||||||
|
// ins_start = DWT_GetTimeline_ms();
|
||||||
|
INS_Task();
|
||||||
|
// ins_dt = DWT_GetTimeline_ms() - ins_start;
|
||||||
|
// if (ins_dt > 1)
|
||||||
|
// @Todo: LOGERROR("[freeRTOS] INS Task is being DELAY! dt = [%f]", &ins_dt);
|
||||||
|
// // VisionSend(); // 解算完成后发送视觉数据,但是当前的实现不太优雅,后续若添加硬件触发需要重新考虑结构的组织
|
||||||
|
osDelay(1); // 1ms, 1kHz
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Function implementing the reference thread.
|
||||||
|
* @param argument: Not used
|
||||||
|
* @retval None
|
||||||
|
* @Todo:Deamon task 后期加入cmd和def
|
||||||
|
*/
|
||||||
|
/* USER CODE END Header_RefereeTask */
|
||||||
|
__attribute__((noreturn)) void StartDaemonTask(void *argument)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN StartDaemonTask */
|
||||||
|
// LOGINFO("[freeRTOS] Daemon Task Start");
|
||||||
|
|
||||||
|
/* Infinite loop */
|
||||||
|
for (;;)
|
||||||
|
{
|
||||||
|
USARTServiceTask();
|
||||||
|
|
||||||
|
// 1. 执行核心的数据刷新逻辑
|
||||||
|
Daemon_Update();
|
||||||
|
|
||||||
|
// 2. 线程休眠 10ms (100Hz 运行频率)
|
||||||
|
osDelay(10);
|
||||||
|
}
|
||||||
|
/* USER CODE END StartDaemonTask */
|
||||||
|
}
|
||||||
|
|
||||||
|
// 注意:把你原来写在 freertos.c 里的那个 __weak void DaemonTask() 整个删掉,防止干扰!
|
||||||
|
|
||||||
|
__attribute__((noreturn)) void StartPRTSTask(void *argument)
|
||||||
|
{
|
||||||
|
(void) argument;
|
||||||
|
|
||||||
|
bool prts_ok = PRTS_Init();
|
||||||
|
uint32_t refresh_ms = PRTS_STATUS_UPDATE_PERIOD_MS;
|
||||||
|
|
||||||
|
if (!prts_ok)
|
||||||
|
{
|
||||||
|
TFT_Init();
|
||||||
|
}
|
||||||
|
|
||||||
|
for (;;)
|
||||||
|
{
|
||||||
|
uint32_t delay_ms = PRTS_TASK_SLEEP_CAP_MS;
|
||||||
|
|
||||||
|
if (refresh_ms >= PRTS_STATUS_UPDATE_PERIOD_MS)
|
||||||
|
{
|
||||||
|
if (prts_ok)
|
||||||
|
{
|
||||||
|
PRTS_UpdateStatus(BMI088.Temperature, RobotMode);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TFT_ShowStatus(BMI088.Temperature, RobotMode);
|
||||||
|
}
|
||||||
|
refresh_ms = 0U;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (prts_ok)
|
||||||
|
{
|
||||||
|
delay_ms = PRTS_Task();
|
||||||
|
if (delay_ms == 0U || delay_ms > PRTS_TASK_SLEEP_CAP_MS)
|
||||||
|
{
|
||||||
|
delay_ms = PRTS_TASK_SLEEP_CAP_MS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
prts_ok = PRTS_Init();
|
||||||
|
}
|
||||||
|
|
||||||
|
osDelay(delay_ms);
|
||||||
|
refresh_ms += delay_ms;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* USER CODE END Application */
|
/* USER CODE END Application */
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,6 @@
|
|||||||
* Output
|
* Output
|
||||||
* EVENT_OUT
|
* EVENT_OUT
|
||||||
* EXTI
|
* EXTI
|
||||||
PA6 ------> SPI6_MISO
|
|
||||||
PA7 ------> SPI6_MOSI
|
PA7 ------> SPI6_MOSI
|
||||||
PA8 ------> RCC_MCO_1
|
PA8 ------> RCC_MCO_1
|
||||||
PC10 ------> SPI3_SCK
|
PC10 ------> SPI3_SCK
|
||||||
@@ -58,13 +57,10 @@ void MX_GPIO_Init(void)
|
|||||||
__HAL_RCC_GPIOD_CLK_ENABLE();
|
__HAL_RCC_GPIOD_CLK_ENABLE();
|
||||||
|
|
||||||
/*Configure GPIO pin Output Level */
|
/*Configure GPIO pin Output Level */
|
||||||
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_14|ACC_CS_Pin, GPIO_PIN_RESET);
|
HAL_GPIO_WritePin(GPIOC, Power2_Pin|Power1_Pin|Power_5V_EN_Pin|ACC_CS_Pin|GYRO_CS_Pin, GPIO_PIN_SET);
|
||||||
|
|
||||||
/*Configure GPIO pin Output Level */
|
/*Configure GPIO pin Output Level */
|
||||||
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_15|GYRO_CS_Pin, GPIO_PIN_SET);
|
HAL_GPIO_WritePin(GPIOA, power2_Pin|power1_Pin, GPIO_PIN_SET);
|
||||||
|
|
||||||
/*Configure GPIO pin Output Level */
|
|
||||||
HAL_GPIO_WritePin(GPIOA, pump1_Pin|pump2_Pin, GPIO_PIN_SET);
|
|
||||||
|
|
||||||
/*Configure GPIO pin Output Level */
|
/*Configure GPIO pin Output Level */
|
||||||
HAL_GPIO_WritePin(GPIOE, pump3_Pin|pump4_Pin, GPIO_PIN_RESET);
|
HAL_GPIO_WritePin(GPIOE, pump3_Pin|pump4_Pin, GPIO_PIN_RESET);
|
||||||
@@ -78,8 +74,8 @@ void MX_GPIO_Init(void)
|
|||||||
/*Configure GPIO pin Output Level */
|
/*Configure GPIO pin Output Level */
|
||||||
HAL_GPIO_WritePin(cs3_GPIO_Port, cs3_Pin, GPIO_PIN_SET);
|
HAL_GPIO_WritePin(cs3_GPIO_Port, cs3_Pin, GPIO_PIN_SET);
|
||||||
|
|
||||||
/*Configure GPIO pins : PC14 PC15 */
|
/*Configure GPIO pins : Power2_Pin Power1_Pin Power_5V_EN_Pin */
|
||||||
GPIO_InitStruct.Pin = GPIO_PIN_14|GPIO_PIN_15;
|
GPIO_InitStruct.Pin = Power2_Pin|Power1_Pin|Power_5V_EN_Pin;
|
||||||
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
||||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||||
@@ -92,15 +88,21 @@ void MX_GPIO_Init(void)
|
|||||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||||
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
|
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
|
||||||
|
|
||||||
/*Configure GPIO pins : pump1_Pin pump2_Pin */
|
/*Configure GPIO pins : power2_Pin power1_Pin */
|
||||||
GPIO_InitStruct.Pin = pump1_Pin|pump2_Pin;
|
GPIO_InitStruct.Pin = power2_Pin|power1_Pin;
|
||||||
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
||||||
GPIO_InitStruct.Pull = GPIO_PULLDOWN;
|
GPIO_InitStruct.Pull = GPIO_PULLDOWN;
|
||||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
|
||||||
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
||||||
|
|
||||||
/*Configure GPIO pins : PA6 PA7 */
|
/*Configure GPIO pin : PA6 */
|
||||||
GPIO_InitStruct.Pin = GPIO_PIN_6|GPIO_PIN_7;
|
GPIO_InitStruct.Pin = GPIO_PIN_6;
|
||||||
|
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
|
||||||
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
|
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
/*Configure GPIO pin : PA7 */
|
||||||
|
GPIO_InitStruct.Pin = GPIO_PIN_7;
|
||||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||||
|
|||||||
@@ -1,56 +0,0 @@
|
|||||||
/* USER CODE BEGIN Header */
|
|
||||||
/**
|
|
||||||
******************************************************************************
|
|
||||||
* @file iwdg.c
|
|
||||||
* @brief This file provides code for the configuration
|
|
||||||
* of the IWDG instances.
|
|
||||||
******************************************************************************
|
|
||||||
* @attention
|
|
||||||
*
|
|
||||||
* Copyright (c) 2025 STMicroelectronics.
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* This software is licensed under terms that can be found in the LICENSE file
|
|
||||||
* in the root directory of this software component.
|
|
||||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
|
||||||
*
|
|
||||||
******************************************************************************
|
|
||||||
*/
|
|
||||||
/* USER CODE END Header */
|
|
||||||
/* Includes ------------------------------------------------------------------*/
|
|
||||||
#include "iwdg.h"
|
|
||||||
|
|
||||||
/* USER CODE BEGIN 0 */
|
|
||||||
|
|
||||||
/* USER CODE END 0 */
|
|
||||||
|
|
||||||
IWDG_HandleTypeDef hiwdg1;
|
|
||||||
|
|
||||||
/* IWDG1 init function */
|
|
||||||
void MX_IWDG1_Init(void)
|
|
||||||
{
|
|
||||||
|
|
||||||
/* USER CODE BEGIN IWDG1_Init 0 */
|
|
||||||
|
|
||||||
/* USER CODE END IWDG1_Init 0 */
|
|
||||||
|
|
||||||
/* USER CODE BEGIN IWDG1_Init 1 */
|
|
||||||
|
|
||||||
/* USER CODE END IWDG1_Init 1 */
|
|
||||||
hiwdg1.Instance = IWDG1;
|
|
||||||
hiwdg1.Init.Prescaler = IWDG_PRESCALER_4;
|
|
||||||
hiwdg1.Init.Window = 4095;
|
|
||||||
hiwdg1.Init.Reload = 4095;
|
|
||||||
if (HAL_IWDG_Init(&hiwdg1) != HAL_OK)
|
|
||||||
{
|
|
||||||
Error_Handler();
|
|
||||||
}
|
|
||||||
/* USER CODE BEGIN IWDG1_Init 2 */
|
|
||||||
|
|
||||||
/* USER CODE END IWDG1_Init 2 */
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/* USER CODE BEGIN 1 */
|
|
||||||
|
|
||||||
/* USER CODE END 1 */
|
|
||||||
@@ -23,7 +23,6 @@
|
|||||||
#include "crc.h"
|
#include "crc.h"
|
||||||
#include "dma.h"
|
#include "dma.h"
|
||||||
#include "fdcan.h"
|
#include "fdcan.h"
|
||||||
#include "iwdg.h"
|
|
||||||
#include "spi.h"
|
#include "spi.h"
|
||||||
#include "tim.h"
|
#include "tim.h"
|
||||||
#include "usart.h"
|
#include "usart.h"
|
||||||
@@ -33,6 +32,11 @@
|
|||||||
/* Private includes ----------------------------------------------------------*/
|
/* Private includes ----------------------------------------------------------*/
|
||||||
/* USER CODE BEGIN Includes */
|
/* USER CODE BEGIN Includes */
|
||||||
|
|
||||||
|
#include "buzzer.h"
|
||||||
|
#include "ws2812status.h"
|
||||||
|
#include "robot.h"
|
||||||
|
#include "tft.h"
|
||||||
|
|
||||||
/* USER CODE END Includes */
|
/* USER CODE END Includes */
|
||||||
|
|
||||||
/* Private typedef -----------------------------------------------------------*/
|
/* Private typedef -----------------------------------------------------------*/
|
||||||
@@ -58,6 +62,7 @@
|
|||||||
|
|
||||||
/* Private function prototypes -----------------------------------------------*/
|
/* Private function prototypes -----------------------------------------------*/
|
||||||
void SystemClock_Config(void);
|
void SystemClock_Config(void);
|
||||||
|
void PeriphCommonClock_Config(void);
|
||||||
static void MPU_Config(void);
|
static void MPU_Config(void);
|
||||||
void MX_FREERTOS_Init(void);
|
void MX_FREERTOS_Init(void);
|
||||||
/* USER CODE BEGIN PFP */
|
/* USER CODE BEGIN PFP */
|
||||||
@@ -103,6 +108,9 @@ int main(void)
|
|||||||
/* Configure the system clock */
|
/* Configure the system clock */
|
||||||
SystemClock_Config();
|
SystemClock_Config();
|
||||||
|
|
||||||
|
/* Configure the peripherals common clocks */
|
||||||
|
PeriphCommonClock_Config();
|
||||||
|
|
||||||
/* USER CODE BEGIN SysInit */
|
/* USER CODE BEGIN SysInit */
|
||||||
|
|
||||||
/* USER CODE END SysInit */
|
/* USER CODE END SysInit */
|
||||||
@@ -126,9 +134,15 @@ int main(void)
|
|||||||
MX_SPI1_Init();
|
MX_SPI1_Init();
|
||||||
MX_UART5_Init();
|
MX_UART5_Init();
|
||||||
MX_TIM3_Init();
|
MX_TIM3_Init();
|
||||||
MX_IWDG1_Init();
|
MX_ADC1_Init();
|
||||||
/* USER CODE BEGIN 2 */
|
/* USER CODE BEGIN 2 */
|
||||||
|
|
||||||
|
TFT_ShowBootScreen();
|
||||||
|
robotSelfCheck(); //自检LED
|
||||||
|
RobotInit();
|
||||||
|
systemstart_song(); //开机音乐
|
||||||
|
|
||||||
|
/*还没有启动调度器!不允许任何涉及到 Freertos ticks的内容在这里运行!!!*/
|
||||||
/* USER CODE END 2 */
|
/* USER CODE END 2 */
|
||||||
|
|
||||||
/* Init scheduler */
|
/* Init scheduler */
|
||||||
@@ -174,11 +188,10 @@ void SystemClock_Config(void)
|
|||||||
* in the RCC_OscInitTypeDef structure.
|
* in the RCC_OscInitTypeDef structure.
|
||||||
*/
|
*/
|
||||||
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI48|RCC_OSCILLATORTYPE_HSI
|
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI48|RCC_OSCILLATORTYPE_HSI
|
||||||
|RCC_OSCILLATORTYPE_LSI|RCC_OSCILLATORTYPE_HSE;
|
|RCC_OSCILLATORTYPE_HSE;
|
||||||
RCC_OscInitStruct.HSEState = RCC_HSE_ON;
|
RCC_OscInitStruct.HSEState = RCC_HSE_ON;
|
||||||
RCC_OscInitStruct.HSIState = RCC_HSI_DIV1;
|
RCC_OscInitStruct.HSIState = RCC_HSI_DIV1;
|
||||||
RCC_OscInitStruct.HSICalibrationValue = 64;
|
RCC_OscInitStruct.HSICalibrationValue = 64;
|
||||||
RCC_OscInitStruct.LSIState = RCC_LSI_ON;
|
|
||||||
RCC_OscInitStruct.HSI48State = RCC_HSI48_ON;
|
RCC_OscInitStruct.HSI48State = RCC_HSI48_ON;
|
||||||
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
|
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
|
||||||
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
|
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
|
||||||
@@ -215,6 +228,32 @@ void SystemClock_Config(void)
|
|||||||
HAL_RCC_MCOConfig(RCC_MCO1, RCC_MCO1SOURCE_HSI, RCC_MCODIV_1);
|
HAL_RCC_MCOConfig(RCC_MCO1, RCC_MCO1SOURCE_HSI, RCC_MCODIV_1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Peripherals Common Clock Configuration
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
void PeriphCommonClock_Config(void)
|
||||||
|
{
|
||||||
|
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0};
|
||||||
|
|
||||||
|
/** Initializes the peripherals clock
|
||||||
|
*/
|
||||||
|
PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_ADC;
|
||||||
|
PeriphClkInitStruct.PLL2.PLL2M = 2;
|
||||||
|
PeriphClkInitStruct.PLL2.PLL2N = 16;
|
||||||
|
PeriphClkInitStruct.PLL2.PLL2P = 2;
|
||||||
|
PeriphClkInitStruct.PLL2.PLL2Q = 2;
|
||||||
|
PeriphClkInitStruct.PLL2.PLL2R = 2;
|
||||||
|
PeriphClkInitStruct.PLL2.PLL2RGE = RCC_PLL2VCIRANGE_3;
|
||||||
|
PeriphClkInitStruct.PLL2.PLL2VCOSEL = RCC_PLL2VCOWIDE;
|
||||||
|
PeriphClkInitStruct.PLL2.PLL2FRACN = 0;
|
||||||
|
PeriphClkInitStruct.AdcClockSelection = RCC_ADCCLKSOURCE_PLL2;
|
||||||
|
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* USER CODE BEGIN 4 */
|
/* USER CODE BEGIN 4 */
|
||||||
|
|
||||||
/* USER CODE END 4 */
|
/* USER CODE END 4 */
|
||||||
|
|||||||
@@ -45,11 +45,11 @@ void MX_SPI1_Init(void)
|
|||||||
hspi1.Instance = SPI1;
|
hspi1.Instance = SPI1;
|
||||||
hspi1.Init.Mode = SPI_MODE_MASTER;
|
hspi1.Init.Mode = SPI_MODE_MASTER;
|
||||||
hspi1.Init.Direction = SPI_DIRECTION_2LINES;
|
hspi1.Init.Direction = SPI_DIRECTION_2LINES;
|
||||||
hspi1.Init.DataSize = SPI_DATASIZE_16BIT;
|
hspi1.Init.DataSize = SPI_DATASIZE_8BIT;
|
||||||
hspi1.Init.CLKPolarity = SPI_POLARITY_LOW;
|
hspi1.Init.CLKPolarity = SPI_POLARITY_LOW;
|
||||||
hspi1.Init.CLKPhase = SPI_PHASE_1EDGE;
|
hspi1.Init.CLKPhase = SPI_PHASE_1EDGE;
|
||||||
hspi1.Init.NSS = SPI_NSS_SOFT;
|
hspi1.Init.NSS = SPI_NSS_SOFT;
|
||||||
hspi1.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_16;
|
hspi1.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_2;
|
||||||
hspi1.Init.FirstBit = SPI_FIRSTBIT_MSB;
|
hspi1.Init.FirstBit = SPI_FIRSTBIT_MSB;
|
||||||
hspi1.Init.TIMode = SPI_TIMODE_DISABLE;
|
hspi1.Init.TIMode = SPI_TIMODE_DISABLE;
|
||||||
hspi1.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLE;
|
hspi1.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLE;
|
||||||
@@ -149,14 +149,14 @@ void HAL_SPI_MspInit(SPI_HandleTypeDef* spiHandle)
|
|||||||
GPIO_InitStruct.Pin = GPIO_PIN_7;
|
GPIO_InitStruct.Pin = GPIO_PIN_7;
|
||||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||||
GPIO_InitStruct.Alternate = GPIO_AF5_SPI1;
|
GPIO_InitStruct.Alternate = GPIO_AF5_SPI1;
|
||||||
HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
|
HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
|
||||||
|
|
||||||
GPIO_InitStruct.Pin = GPIO_PIN_3|GPIO_PIN_4;
|
GPIO_InitStruct.Pin = GPIO_PIN_3|GPIO_PIN_4;
|
||||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||||
GPIO_InitStruct.Alternate = GPIO_AF5_SPI1;
|
GPIO_InitStruct.Alternate = GPIO_AF5_SPI1;
|
||||||
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
||||||
|
|
||||||
@@ -167,8 +167,8 @@ void HAL_SPI_MspInit(SPI_HandleTypeDef* spiHandle)
|
|||||||
hdma_spi1_rx.Init.Direction = DMA_PERIPH_TO_MEMORY;
|
hdma_spi1_rx.Init.Direction = DMA_PERIPH_TO_MEMORY;
|
||||||
hdma_spi1_rx.Init.PeriphInc = DMA_PINC_DISABLE;
|
hdma_spi1_rx.Init.PeriphInc = DMA_PINC_DISABLE;
|
||||||
hdma_spi1_rx.Init.MemInc = DMA_MINC_ENABLE;
|
hdma_spi1_rx.Init.MemInc = DMA_MINC_ENABLE;
|
||||||
hdma_spi1_rx.Init.PeriphDataAlignment = DMA_PDATAALIGN_HALFWORD;
|
hdma_spi1_rx.Init.PeriphDataAlignment = DMA_PDATAALIGN_BYTE;
|
||||||
hdma_spi1_rx.Init.MemDataAlignment = DMA_MDATAALIGN_HALFWORD;
|
hdma_spi1_rx.Init.MemDataAlignment = DMA_MDATAALIGN_BYTE;
|
||||||
hdma_spi1_rx.Init.Mode = DMA_NORMAL;
|
hdma_spi1_rx.Init.Mode = DMA_NORMAL;
|
||||||
hdma_spi1_rx.Init.Priority = DMA_PRIORITY_VERY_HIGH;
|
hdma_spi1_rx.Init.Priority = DMA_PRIORITY_VERY_HIGH;
|
||||||
hdma_spi1_rx.Init.FIFOMode = DMA_FIFOMODE_DISABLE;
|
hdma_spi1_rx.Init.FIFOMode = DMA_FIFOMODE_DISABLE;
|
||||||
@@ -180,13 +180,13 @@ void HAL_SPI_MspInit(SPI_HandleTypeDef* spiHandle)
|
|||||||
__HAL_LINKDMA(spiHandle,hdmarx,hdma_spi1_rx);
|
__HAL_LINKDMA(spiHandle,hdmarx,hdma_spi1_rx);
|
||||||
|
|
||||||
/* SPI1_TX Init */
|
/* SPI1_TX Init */
|
||||||
hdma_spi1_tx.Instance = DMA1_Stream2;
|
hdma_spi1_tx.Instance = DMA1_Stream3;
|
||||||
hdma_spi1_tx.Init.Request = DMA_REQUEST_SPI1_TX;
|
hdma_spi1_tx.Init.Request = DMA_REQUEST_SPI1_TX;
|
||||||
hdma_spi1_tx.Init.Direction = DMA_MEMORY_TO_PERIPH;
|
hdma_spi1_tx.Init.Direction = DMA_MEMORY_TO_PERIPH;
|
||||||
hdma_spi1_tx.Init.PeriphInc = DMA_PINC_DISABLE;
|
hdma_spi1_tx.Init.PeriphInc = DMA_PINC_DISABLE;
|
||||||
hdma_spi1_tx.Init.MemInc = DMA_MINC_ENABLE;
|
hdma_spi1_tx.Init.MemInc = DMA_MINC_ENABLE;
|
||||||
hdma_spi1_tx.Init.PeriphDataAlignment = DMA_PDATAALIGN_HALFWORD;
|
hdma_spi1_tx.Init.PeriphDataAlignment = DMA_PDATAALIGN_BYTE;
|
||||||
hdma_spi1_tx.Init.MemDataAlignment = DMA_MDATAALIGN_HALFWORD;
|
hdma_spi1_tx.Init.MemDataAlignment = DMA_MDATAALIGN_BYTE;
|
||||||
hdma_spi1_tx.Init.Mode = DMA_NORMAL;
|
hdma_spi1_tx.Init.Mode = DMA_NORMAL;
|
||||||
hdma_spi1_tx.Init.Priority = DMA_PRIORITY_VERY_HIGH;
|
hdma_spi1_tx.Init.Priority = DMA_PRIORITY_VERY_HIGH;
|
||||||
hdma_spi1_tx.Init.FIFOMode = DMA_FIFOMODE_DISABLE;
|
hdma_spi1_tx.Init.FIFOMode = DMA_FIFOMODE_DISABLE;
|
||||||
@@ -245,7 +245,7 @@ void HAL_SPI_MspInit(SPI_HandleTypeDef* spiHandle)
|
|||||||
|
|
||||||
/* SPI2 DMA Init */
|
/* SPI2 DMA Init */
|
||||||
/* SPI2_RX Init */
|
/* SPI2_RX Init */
|
||||||
hdma_spi2_rx.Instance = DMA1_Stream3;
|
hdma_spi2_rx.Instance = DMA1_Stream0;
|
||||||
hdma_spi2_rx.Init.Request = DMA_REQUEST_SPI2_RX;
|
hdma_spi2_rx.Init.Request = DMA_REQUEST_SPI2_RX;
|
||||||
hdma_spi2_rx.Init.Direction = DMA_PERIPH_TO_MEMORY;
|
hdma_spi2_rx.Init.Direction = DMA_PERIPH_TO_MEMORY;
|
||||||
hdma_spi2_rx.Init.PeriphInc = DMA_PINC_DISABLE;
|
hdma_spi2_rx.Init.PeriphInc = DMA_PINC_DISABLE;
|
||||||
|
|||||||
@@ -56,6 +56,8 @@
|
|||||||
|
|
||||||
/* External variables --------------------------------------------------------*/
|
/* External variables --------------------------------------------------------*/
|
||||||
extern PCD_HandleTypeDef hpcd_USB_OTG_HS;
|
extern PCD_HandleTypeDef hpcd_USB_OTG_HS;
|
||||||
|
extern DMA_HandleTypeDef hdma_adc1;
|
||||||
|
extern ADC_HandleTypeDef hadc1;
|
||||||
extern FDCAN_HandleTypeDef hfdcan1;
|
extern FDCAN_HandleTypeDef hfdcan1;
|
||||||
extern FDCAN_HandleTypeDef hfdcan2;
|
extern FDCAN_HandleTypeDef hfdcan2;
|
||||||
extern FDCAN_HandleTypeDef hfdcan3;
|
extern FDCAN_HandleTypeDef hfdcan3;
|
||||||
@@ -185,6 +187,20 @@ void DebugMon_Handler(void)
|
|||||||
/* please refer to the startup file (startup_stm32h7xx.s). */
|
/* please refer to the startup file (startup_stm32h7xx.s). */
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function handles DMA1 stream0 global interrupt.
|
||||||
|
*/
|
||||||
|
void DMA1_Stream0_IRQHandler(void)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN DMA1_Stream0_IRQn 0 */
|
||||||
|
|
||||||
|
/* USER CODE END DMA1_Stream0_IRQn 0 */
|
||||||
|
HAL_DMA_IRQHandler(&hdma_spi2_rx);
|
||||||
|
/* USER CODE BEGIN DMA1_Stream0_IRQn 1 */
|
||||||
|
|
||||||
|
/* USER CODE END DMA1_Stream0_IRQn 1 */
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This function handles DMA1 stream1 global interrupt.
|
* @brief This function handles DMA1 stream1 global interrupt.
|
||||||
*/
|
*/
|
||||||
@@ -207,7 +223,7 @@ void DMA1_Stream2_IRQHandler(void)
|
|||||||
/* USER CODE BEGIN DMA1_Stream2_IRQn 0 */
|
/* USER CODE BEGIN DMA1_Stream2_IRQn 0 */
|
||||||
|
|
||||||
/* USER CODE END DMA1_Stream2_IRQn 0 */
|
/* USER CODE END DMA1_Stream2_IRQn 0 */
|
||||||
HAL_DMA_IRQHandler(&hdma_spi1_tx);
|
HAL_DMA_IRQHandler(&hdma_adc1);
|
||||||
/* USER CODE BEGIN DMA1_Stream2_IRQn 1 */
|
/* USER CODE BEGIN DMA1_Stream2_IRQn 1 */
|
||||||
|
|
||||||
/* USER CODE END DMA1_Stream2_IRQn 1 */
|
/* USER CODE END DMA1_Stream2_IRQn 1 */
|
||||||
@@ -221,7 +237,7 @@ void DMA1_Stream3_IRQHandler(void)
|
|||||||
/* USER CODE BEGIN DMA1_Stream3_IRQn 0 */
|
/* USER CODE BEGIN DMA1_Stream3_IRQn 0 */
|
||||||
|
|
||||||
/* USER CODE END DMA1_Stream3_IRQn 0 */
|
/* USER CODE END DMA1_Stream3_IRQn 0 */
|
||||||
HAL_DMA_IRQHandler(&hdma_spi2_rx);
|
HAL_DMA_IRQHandler(&hdma_spi1_tx);
|
||||||
/* USER CODE BEGIN DMA1_Stream3_IRQn 1 */
|
/* USER CODE BEGIN DMA1_Stream3_IRQn 1 */
|
||||||
|
|
||||||
/* USER CODE END DMA1_Stream3_IRQn 1 */
|
/* USER CODE END DMA1_Stream3_IRQn 1 */
|
||||||
@@ -269,6 +285,20 @@ void DMA1_Stream6_IRQHandler(void)
|
|||||||
/* USER CODE END DMA1_Stream6_IRQn 1 */
|
/* USER CODE END DMA1_Stream6_IRQn 1 */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function handles ADC1 and ADC2 global interrupts.
|
||||||
|
*/
|
||||||
|
void ADC_IRQHandler(void)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN ADC_IRQn 0 */
|
||||||
|
|
||||||
|
/* USER CODE END ADC_IRQn 0 */
|
||||||
|
HAL_ADC_IRQHandler(&hadc1);
|
||||||
|
/* USER CODE BEGIN ADC_IRQn 1 */
|
||||||
|
|
||||||
|
/* USER CODE END ADC_IRQn 1 */
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This function handles FDCAN1 interrupt 0.
|
* @brief This function handles FDCAN1 interrupt 0.
|
||||||
*/
|
*/
|
||||||
@@ -297,6 +327,34 @@ void FDCAN2_IT0_IRQHandler(void)
|
|||||||
/* USER CODE END FDCAN2_IT0_IRQn 1 */
|
/* USER CODE END FDCAN2_IT0_IRQn 1 */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function handles FDCAN1 interrupt 1.
|
||||||
|
*/
|
||||||
|
void FDCAN1_IT1_IRQHandler(void)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN FDCAN1_IT1_IRQn 0 */
|
||||||
|
|
||||||
|
/* USER CODE END FDCAN1_IT1_IRQn 0 */
|
||||||
|
HAL_FDCAN_IRQHandler(&hfdcan1);
|
||||||
|
/* USER CODE BEGIN FDCAN1_IT1_IRQn 1 */
|
||||||
|
|
||||||
|
/* USER CODE END FDCAN1_IT1_IRQn 1 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function handles FDCAN2 interrupt 1.
|
||||||
|
*/
|
||||||
|
void FDCAN2_IT1_IRQHandler(void)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN FDCAN2_IT1_IRQn 0 */
|
||||||
|
|
||||||
|
/* USER CODE END FDCAN2_IT1_IRQn 0 */
|
||||||
|
HAL_FDCAN_IRQHandler(&hfdcan2);
|
||||||
|
/* USER CODE BEGIN FDCAN2_IT1_IRQn 1 */
|
||||||
|
|
||||||
|
/* USER CODE END FDCAN2_IT1_IRQn 1 */
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This function handles SPI1 global interrupt.
|
* @brief This function handles SPI1 global interrupt.
|
||||||
*/
|
*/
|
||||||
@@ -549,6 +607,20 @@ void FDCAN3_IT0_IRQHandler(void)
|
|||||||
/* USER CODE END FDCAN3_IT0_IRQn 1 */
|
/* USER CODE END FDCAN3_IT0_IRQn 1 */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function handles FDCAN3 interrupt 1.
|
||||||
|
*/
|
||||||
|
void FDCAN3_IT1_IRQHandler(void)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN FDCAN3_IT1_IRQn 0 */
|
||||||
|
|
||||||
|
/* USER CODE END FDCAN3_IT1_IRQn 0 */
|
||||||
|
HAL_FDCAN_IRQHandler(&hfdcan3);
|
||||||
|
/* USER CODE BEGIN FDCAN3_IT1_IRQn 1 */
|
||||||
|
|
||||||
|
/* USER CODE END FDCAN3_IT1_IRQn 1 */
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This function handles TIM23 global interrupt.
|
* @brief This function handles TIM23 global interrupt.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -57,11 +57,11 @@
|
|||||||
#endif /* HSE_VALUE */
|
#endif /* HSE_VALUE */
|
||||||
|
|
||||||
#if !defined (CSI_VALUE)
|
#if !defined (CSI_VALUE)
|
||||||
#define CSI_VALUE ((uint32_t)4000000) /*!< Value of the Internal oscillator in Hz*/
|
#define CSI_VALUE ((uint32_t)4000000) /*!< Value of the Internal oscillator in Hz*/
|
||||||
#endif /* CSI_VALUE */
|
#endif /* CSI_VALUE */
|
||||||
|
|
||||||
#if !defined (HSI_VALUE)
|
#if !defined (HSI_VALUE)
|
||||||
#define HSI_VALUE ((uint32_t)64000000) /*!< Value of the Internal oscillator in Hz*/
|
#define HSI_VALUE ((uint32_t)64000000) /*!< Value of the Internal oscillator in Hz*/
|
||||||
#endif /* HSI_VALUE */
|
#endif /* HSI_VALUE */
|
||||||
|
|
||||||
|
|
||||||
@@ -142,17 +142,17 @@
|
|||||||
/** @addtogroup STM32H7xx_System_Private_Variables
|
/** @addtogroup STM32H7xx_System_Private_Variables
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
/* This variable is updated in three ways:
|
/* This variable is updated in three ways:
|
||||||
1) by calling CMSIS function SystemCoreClockUpdate()
|
1) by calling CMSIS function SystemCoreClockUpdate()
|
||||||
2) by calling HAL API function HAL_RCC_GetHCLKFreq()
|
2) by calling HAL API function HAL_RCC_GetHCLKFreq()
|
||||||
3) each time HAL_RCC_ClockConfig() is called to configure the system clock frequency
|
3) each time HAL_RCC_ClockConfig() is called to configure the system clock frequency
|
||||||
Note: If you use this function to configure the system clock; then there
|
Note: If you use this function to configure the system clock; then there
|
||||||
is no need to call the 2 first functions listed above, since SystemCoreClock
|
is no need to call the 2 first functions listed above, since SystemCoreClock
|
||||||
variable is updated automatically.
|
variable is updated automatically.
|
||||||
*/
|
*/
|
||||||
uint32_t SystemCoreClock = 64000000;
|
uint32_t SystemCoreClock = 64000000;
|
||||||
uint32_t SystemD2Clock = 64000000;
|
uint32_t SystemD2Clock = 64000000;
|
||||||
const uint8_t D1CorePrescTable[16] = {0, 0, 0, 0, 1, 2, 3, 4, 1, 2, 3, 4, 6, 7, 8, 9};
|
const uint8_t D1CorePrescTable[16] = {0, 0, 0, 0, 1, 2, 3, 4, 1, 2, 3, 4, 6, 7, 8, 9};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
@@ -177,20 +177,20 @@
|
|||||||
* @param None
|
* @param None
|
||||||
* @retval None
|
* @retval None
|
||||||
*/
|
*/
|
||||||
void SystemInit (void)
|
void SystemInit(void)
|
||||||
{
|
{
|
||||||
#if defined (DATA_IN_D2_SRAM)
|
#if defined (DATA_IN_D2_SRAM)
|
||||||
__IO uint32_t tmpreg;
|
__IO uint32_t tmpreg;
|
||||||
#endif /* DATA_IN_D2_SRAM */
|
#endif /* DATA_IN_D2_SRAM */
|
||||||
|
|
||||||
/* FPU settings ------------------------------------------------------------*/
|
/* FPU settings ------------------------------------------------------------*/
|
||||||
#if (__FPU_PRESENT == 1) && (__FPU_USED == 1)
|
#if (__FPU_PRESENT == 1) && (__FPU_USED == 1)
|
||||||
SCB->CPACR |= ((3UL << (10*2))|(3UL << (11*2))); /* set CP10 and CP11 Full Access */
|
SCB->CPACR |= ((3UL << (10 * 2)) | (3UL << (11 * 2))); /* set CP10 and CP11 Full Access */
|
||||||
#endif
|
#endif
|
||||||
/* Reset the RCC clock configuration to the default reset state ------------*/
|
/* Reset the RCC clock configuration to the default reset state ------------*/
|
||||||
|
|
||||||
/* Increasing the CPU frequency */
|
/* Increasing the CPU frequency */
|
||||||
if(FLASH_LATENCY_DEFAULT > (READ_BIT((FLASH->ACR), FLASH_ACR_LATENCY)))
|
if (FLASH_LATENCY_DEFAULT > (READ_BIT((FLASH->ACR), FLASH_ACR_LATENCY)))
|
||||||
{
|
{
|
||||||
/* Program the new number of wait states to the LATENCY bits in the FLASH_ACR register */
|
/* Program the new number of wait states to the LATENCY bits in the FLASH_ACR register */
|
||||||
MODIFY_REG(FLASH->ACR, FLASH_ACR_LATENCY, (uint32_t)(FLASH_LATENCY_DEFAULT));
|
MODIFY_REG(FLASH->ACR, FLASH_ACR_LATENCY, (uint32_t)(FLASH_LATENCY_DEFAULT));
|
||||||
@@ -206,7 +206,7 @@ void SystemInit (void)
|
|||||||
RCC->CR &= 0xEAF6ED7FU;
|
RCC->CR &= 0xEAF6ED7FU;
|
||||||
|
|
||||||
/* Decreasing the number of wait states because of lower CPU frequency */
|
/* Decreasing the number of wait states because of lower CPU frequency */
|
||||||
if(FLASH_LATENCY_DEFAULT < (READ_BIT((FLASH->ACR), FLASH_ACR_LATENCY)))
|
if (FLASH_LATENCY_DEFAULT < (READ_BIT((FLASH->ACR), FLASH_ACR_LATENCY)))
|
||||||
{
|
{
|
||||||
/* Program the new number of wait states to the LATENCY bits in the FLASH_ACR register */
|
/* Program the new number of wait states to the LATENCY bits in the FLASH_ACR register */
|
||||||
MODIFY_REG(FLASH->ACR, FLASH_ACR_LATENCY, (uint32_t)(FLASH_LATENCY_DEFAULT));
|
MODIFY_REG(FLASH->ACR, FLASH_ACR_LATENCY, (uint32_t)(FLASH_LATENCY_DEFAULT));
|
||||||
@@ -261,11 +261,17 @@ void SystemInit (void)
|
|||||||
|
|
||||||
#if (STM32H7_DEV_ID == 0x450UL)
|
#if (STM32H7_DEV_ID == 0x450UL)
|
||||||
/* dual core CM7 or single core line */
|
/* dual core CM7 or single core line */
|
||||||
if((DBGMCU->IDCODE & 0xFFFF0000U) < 0x20000000U)
|
if ((DBGMCU->IDCODE & 0xFFFF0000U) < 0x20000000U)
|
||||||
{
|
{
|
||||||
/* if stm32h7 revY*/
|
/* if stm32h7 revY*/
|
||||||
/* Change the switch matrix read issuing capability to 1 for the AXI SRAM target (Target 7) */
|
/* Change the switch matrix read issuing capability to 1 for the AXI SRAM target (Target 7) */
|
||||||
*((__IO uint32_t*)0x51008108) = 0x000000001U;
|
*((__IO
|
||||||
|
uint32_t *
|
||||||
|
)
|
||||||
|
0x51008108
|
||||||
|
)
|
||||||
|
=
|
||||||
|
0x000000001U;
|
||||||
}
|
}
|
||||||
#endif /* STM32H7_DEV_ID */
|
#endif /* STM32H7_DEV_ID */
|
||||||
|
|
||||||
@@ -286,11 +292,12 @@ void SystemInit (void)
|
|||||||
#if defined(DUAL_CORE) && defined(CORE_CM4)
|
#if defined(DUAL_CORE) && defined(CORE_CM4)
|
||||||
/* Configure the Vector Table location add offset address for cortex-M4 ------------------*/
|
/* Configure the Vector Table location add offset address for cortex-M4 ------------------*/
|
||||||
#if defined(USER_VECT_TAB_ADDRESS)
|
#if defined(USER_VECT_TAB_ADDRESS)
|
||||||
SCB->VTOR = VECT_TAB_BASE_ADDRESS | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal D2 AXI-RAM or in Internal FLASH */
|
SCB->VTOR = VECT_TAB_BASE_ADDRESS | VECT_TAB_OFFSET;
|
||||||
|
/* Vector Table Relocation in Internal D2 AXI-RAM or in Internal FLASH */
|
||||||
#endif /* USER_VECT_TAB_ADDRESS */
|
#endif /* USER_VECT_TAB_ADDRESS */
|
||||||
|
|
||||||
#else
|
#else
|
||||||
if(READ_BIT(RCC->AHB3ENR, RCC_AHB3ENR_FMCEN) == 0U)
|
if (READ_BIT(RCC->AHB3ENR, RCC_AHB3ENR_FMCEN) == 0U)
|
||||||
{
|
{
|
||||||
/* Enable the FMC interface clock */
|
/* Enable the FMC interface clock */
|
||||||
SET_BIT(RCC->AHB3ENR, RCC_AHB3ENR_FMCEN);
|
SET_BIT(RCC->AHB3ENR, RCC_AHB3ENR_FMCEN);
|
||||||
@@ -308,9 +315,11 @@ void SystemInit (void)
|
|||||||
|
|
||||||
/* Configure the Vector Table location -------------------------------------*/
|
/* Configure the Vector Table location -------------------------------------*/
|
||||||
#if defined(USER_VECT_TAB_ADDRESS)
|
#if defined(USER_VECT_TAB_ADDRESS)
|
||||||
SCB->VTOR = VECT_TAB_BASE_ADDRESS | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal D1 AXI-RAM or in Internal FLASH */
|
SCB->VTOR = VECT_TAB_BASE_ADDRESS | VECT_TAB_OFFSET;
|
||||||
|
/* Vector Table Relocation in Internal D1 AXI-RAM or in Internal FLASH */
|
||||||
#endif /* USER_VECT_TAB_ADDRESS */
|
#endif /* USER_VECT_TAB_ADDRESS */
|
||||||
|
__HAL_RCC_D2SRAM1_CLK_ENABLE(); //添加如下代码使能D2域的RAM(之用的ram_1,顺便把ram_d2也使能了)
|
||||||
|
__HAL_RCC_D2SRAM2_CLK_ENABLE(); //ps.不使能的话会导致变量显式初始化无法赋值
|
||||||
#endif /*DUAL_CORE && CORE_CM4*/
|
#endif /*DUAL_CORE && CORE_CM4*/
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -351,7 +360,7 @@ void SystemInit (void)
|
|||||||
* @param None
|
* @param None
|
||||||
* @retval None
|
* @retval None
|
||||||
*/
|
*/
|
||||||
void SystemCoreClockUpdate (void)
|
void SystemCoreClockUpdate(void)
|
||||||
{
|
{
|
||||||
uint32_t pllp, pllsource, pllm, pllfracen, hsivalue, tmp;
|
uint32_t pllp, pllsource, pllm, pllfracen, hsivalue, tmp;
|
||||||
uint32_t common_system_clock;
|
uint32_t common_system_clock;
|
||||||
@@ -363,7 +372,7 @@ void SystemCoreClockUpdate (void)
|
|||||||
switch (RCC->CFGR & RCC_CFGR_SWS)
|
switch (RCC->CFGR & RCC_CFGR_SWS)
|
||||||
{
|
{
|
||||||
case RCC_CFGR_SWS_HSI: /* HSI used as system clock source */
|
case RCC_CFGR_SWS_HSI: /* HSI used as system clock source */
|
||||||
common_system_clock = (uint32_t) (HSI_VALUE >> ((RCC->CR & RCC_CR_HSIDIV)>> 3));
|
common_system_clock = (uint32_t) (HSI_VALUE >> ((RCC->CR & RCC_CR_HSIDIV) >> 3));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RCC_CFGR_SWS_CSI: /* CSI used as system clock source */
|
case RCC_CFGR_SWS_CSI: /* CSI used as system clock source */
|
||||||
@@ -380,9 +389,9 @@ void SystemCoreClockUpdate (void)
|
|||||||
SYSCLK = PLL_VCO / PLLR
|
SYSCLK = PLL_VCO / PLLR
|
||||||
*/
|
*/
|
||||||
pllsource = (RCC->PLLCKSELR & RCC_PLLCKSELR_PLLSRC);
|
pllsource = (RCC->PLLCKSELR & RCC_PLLCKSELR_PLLSRC);
|
||||||
pllm = ((RCC->PLLCKSELR & RCC_PLLCKSELR_DIVM1)>> 4) ;
|
pllm = ((RCC->PLLCKSELR & RCC_PLLCKSELR_DIVM1) >> 4);
|
||||||
pllfracen = ((RCC->PLLCFGR & RCC_PLLCFGR_PLL1FRACEN)>>RCC_PLLCFGR_PLL1FRACEN_Pos);
|
pllfracen = ((RCC->PLLCFGR & RCC_PLLCFGR_PLL1FRACEN) >> RCC_PLLCFGR_PLL1FRACEN_Pos);
|
||||||
fracn1 = (float_t)(uint32_t)(pllfracen* ((RCC->PLL1FRACR & RCC_PLL1FRACR_FRACN1)>> 3));
|
fracn1 = (float_t) (uint32_t) (pllfracen * ((RCC->PLL1FRACR & RCC_PLL1FRACR_FRACN1) >> 3));
|
||||||
|
|
||||||
if (pllm != 0U)
|
if (pllm != 0U)
|
||||||
{
|
{
|
||||||
@@ -390,26 +399,34 @@ void SystemCoreClockUpdate (void)
|
|||||||
{
|
{
|
||||||
case RCC_PLLCKSELR_PLLSRC_HSI: /* HSI used as PLL clock source */
|
case RCC_PLLCKSELR_PLLSRC_HSI: /* HSI used as PLL clock source */
|
||||||
|
|
||||||
hsivalue = (HSI_VALUE >> ((RCC->CR & RCC_CR_HSIDIV)>> 3)) ;
|
hsivalue = (HSI_VALUE >> ((RCC->CR & RCC_CR_HSIDIV) >> 3));
|
||||||
pllvco = ( (float_t)hsivalue / (float_t)pllm) * ((float_t)(uint32_t)(RCC->PLL1DIVR & RCC_PLL1DIVR_N1) + (fracn1/(float_t)0x2000) +(float_t)1 );
|
pllvco = ((float_t) hsivalue / (float_t) pllm) * (
|
||||||
|
(float_t) (uint32_t) (RCC->PLL1DIVR & RCC_PLL1DIVR_N1) + (
|
||||||
|
fracn1 / (float_t) 0x2000) + (float_t) 1);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RCC_PLLCKSELR_PLLSRC_CSI: /* CSI used as PLL clock source */
|
case RCC_PLLCKSELR_PLLSRC_CSI: /* CSI used as PLL clock source */
|
||||||
pllvco = ((float_t)CSI_VALUE / (float_t)pllm) * ((float_t)(uint32_t)(RCC->PLL1DIVR & RCC_PLL1DIVR_N1) + (fracn1/(float_t)0x2000) +(float_t)1 );
|
pllvco = ((float_t) CSI_VALUE / (float_t) pllm) * (
|
||||||
|
(float_t) (uint32_t) (RCC->PLL1DIVR & RCC_PLL1DIVR_N1) + (
|
||||||
|
fracn1 / (float_t) 0x2000) + (float_t) 1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RCC_PLLCKSELR_PLLSRC_HSE: /* HSE used as PLL clock source */
|
case RCC_PLLCKSELR_PLLSRC_HSE: /* HSE used as PLL clock source */
|
||||||
pllvco = ((float_t)HSE_VALUE / (float_t)pllm) * ((float_t)(uint32_t)(RCC->PLL1DIVR & RCC_PLL1DIVR_N1) + (fracn1/(float_t)0x2000) +(float_t)1 );
|
pllvco = ((float_t) HSE_VALUE / (float_t) pllm) * (
|
||||||
|
(float_t) (uint32_t) (RCC->PLL1DIVR & RCC_PLL1DIVR_N1) + (
|
||||||
|
fracn1 / (float_t) 0x2000) + (float_t) 1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
hsivalue = (HSI_VALUE >> ((RCC->CR & RCC_CR_HSIDIV)>> 3)) ;
|
hsivalue = (HSI_VALUE >> ((RCC->CR & RCC_CR_HSIDIV) >> 3));
|
||||||
pllvco = ((float_t)hsivalue / (float_t)pllm) * ((float_t)(uint32_t)(RCC->PLL1DIVR & RCC_PLL1DIVR_N1) + (fracn1/(float_t)0x2000) +(float_t)1 );
|
pllvco = ((float_t) hsivalue / (float_t) pllm) * (
|
||||||
|
(float_t) (uint32_t) (RCC->PLL1DIVR & RCC_PLL1DIVR_N1) + (
|
||||||
|
fracn1 / (float_t) 0x2000) + (float_t) 1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
pllp = (((RCC->PLL1DIVR & RCC_PLL1DIVR_P1) >>9) + 1U ) ;
|
pllp = (((RCC->PLL1DIVR & RCC_PLL1DIVR_P1) >> 9) + 1U);
|
||||||
common_system_clock = (uint32_t)(float_t)(pllvco/(float_t)pllp);
|
common_system_clock = (uint32_t) (float_t) (pllvco / (float_t) pllp);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -418,28 +435,30 @@ void SystemCoreClockUpdate (void)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
common_system_clock = (uint32_t) (HSI_VALUE >> ((RCC->CR & RCC_CR_HSIDIV)>> 3));
|
common_system_clock = (uint32_t) (HSI_VALUE >> ((RCC->CR & RCC_CR_HSIDIV) >> 3));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Compute SystemClock frequency --------------------------------------------------*/
|
/* Compute SystemClock frequency --------------------------------------------------*/
|
||||||
#if defined (RCC_D1CFGR_D1CPRE)
|
#if defined (RCC_D1CFGR_D1CPRE)
|
||||||
tmp = D1CorePrescTable[(RCC->D1CFGR & RCC_D1CFGR_D1CPRE)>> RCC_D1CFGR_D1CPRE_Pos];
|
tmp = D1CorePrescTable[(RCC->D1CFGR & RCC_D1CFGR_D1CPRE) >> RCC_D1CFGR_D1CPRE_Pos];
|
||||||
|
|
||||||
/* common_system_clock frequency : CM7 CPU frequency */
|
/* common_system_clock frequency : CM7 CPU frequency */
|
||||||
common_system_clock >>= tmp;
|
common_system_clock >>= tmp;
|
||||||
|
|
||||||
/* SystemD2Clock frequency : CM4 CPU, AXI and AHBs Clock frequency */
|
/* SystemD2Clock frequency : CM4 CPU, AXI and AHBs Clock frequency */
|
||||||
SystemD2Clock = (common_system_clock >> ((D1CorePrescTable[(RCC->D1CFGR & RCC_D1CFGR_HPRE)>> RCC_D1CFGR_HPRE_Pos]) & 0x1FU));
|
SystemD2Clock = (common_system_clock >> ((D1CorePrescTable[(RCC->D1CFGR & RCC_D1CFGR_HPRE) >> RCC_D1CFGR_HPRE_Pos])
|
||||||
|
& 0x1FU));
|
||||||
|
|
||||||
#else
|
#else
|
||||||
tmp = D1CorePrescTable[(RCC->CDCFGR1 & RCC_CDCFGR1_CDCPRE)>> RCC_CDCFGR1_CDCPRE_Pos];
|
tmp = D1CorePrescTable[(RCC->CDCFGR1 & RCC_CDCFGR1_CDCPRE) >> RCC_CDCFGR1_CDCPRE_Pos];
|
||||||
|
|
||||||
/* common_system_clock frequency : CM7 CPU frequency */
|
/* common_system_clock frequency : CM7 CPU frequency */
|
||||||
common_system_clock >>= tmp;
|
common_system_clock >>= tmp;
|
||||||
|
|
||||||
/* SystemD2Clock frequency : AXI and AHBs Clock frequency */
|
/* SystemD2Clock frequency : AXI and AHBs Clock frequency */
|
||||||
SystemD2Clock = (common_system_clock >> ((D1CorePrescTable[(RCC->CDCFGR1 & RCC_CDCFGR1_HPRE)>> RCC_CDCFGR1_HPRE_Pos]) & 0x1FU));
|
SystemD2Clock = (common_system_clock >> ((D1CorePrescTable[
|
||||||
|
(RCC->CDCFGR1 & RCC_CDCFGR1_HPRE) >> RCC_CDCFGR1_HPRE_Pos]) & 0x1FU));
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -476,68 +495,79 @@ void SystemCoreClockUpdate (void)
|
|||||||
void ExitRun0Mode(void)
|
void ExitRun0Mode(void)
|
||||||
{
|
{
|
||||||
#if defined(USE_PWR_LDO_SUPPLY)
|
#if defined(USE_PWR_LDO_SUPPLY)
|
||||||
#if defined(SMPS)
|
#if defined(SMPS)
|
||||||
/* Exit Run* mode by disabling SMPS and enabling LDO */
|
/* Exit Run* mode by disabling SMPS and enabling LDO */
|
||||||
PWR->CR3 = (PWR->CR3 & ~PWR_CR3_SMPSEN) | PWR_CR3_LDOEN;
|
PWR->CR3 = (PWR->CR3 & ~PWR_CR3_SMPSEN) | PWR_CR3_LDOEN;
|
||||||
#else
|
#else
|
||||||
/* Enable LDO mode */
|
/* Enable LDO mode */
|
||||||
PWR->CR3 |= PWR_CR3_LDOEN;
|
PWR->CR3 |= PWR_CR3_LDOEN;
|
||||||
#endif /* SMPS */
|
#endif /* SMPS */
|
||||||
/* Wait till voltage level flag is set */
|
/* Wait till voltage level flag is set */
|
||||||
while ((PWR->CSR1 & PWR_CSR1_ACTVOSRDY) == 0U)
|
while ((PWR->CSR1 & PWR_CSR1_ACTVOSRDY) == 0U)
|
||||||
{}
|
{
|
||||||
|
}
|
||||||
#elif defined(USE_PWR_EXTERNAL_SOURCE_SUPPLY)
|
#elif defined(USE_PWR_EXTERNAL_SOURCE_SUPPLY)
|
||||||
#if defined(SMPS)
|
#if defined(SMPS)
|
||||||
/* Exit Run* mode */
|
/* Exit Run* mode */
|
||||||
PWR->CR3 = (PWR->CR3 & ~(PWR_CR3_SMPSEN | PWR_CR3_LDOEN)) | PWR_CR3_BYPASS;
|
PWR->CR3 = (PWR->CR3 & ~(PWR_CR3_SMPSEN | PWR_CR3_LDOEN)) | PWR_CR3_BYPASS;
|
||||||
#else
|
#else
|
||||||
PWR->CR3 = (PWR->CR3 & ~(PWR_CR3_LDOEN)) | PWR_CR3_BYPASS;
|
PWR->CR3 = (PWR->CR3 & ~(PWR_CR3_LDOEN)) | PWR_CR3_BYPASS;
|
||||||
#endif /* SMPS */
|
#endif /* SMPS */
|
||||||
/* Wait till voltage level flag is set */
|
/* Wait till voltage level flag is set */
|
||||||
while ((PWR->CSR1 & PWR_CSR1_ACTVOSRDY) == 0U)
|
while ((PWR->CSR1 & PWR_CSR1_ACTVOSRDY) == 0U)
|
||||||
{}
|
{
|
||||||
|
}
|
||||||
#elif defined(USE_PWR_DIRECT_SMPS_SUPPLY) && defined(SMPS)
|
#elif defined(USE_PWR_DIRECT_SMPS_SUPPLY) && defined(SMPS)
|
||||||
/* Exit Run* mode */
|
/* Exit Run* mode */
|
||||||
PWR->CR3 &= ~(PWR_CR3_LDOEN);
|
PWR->CR3 &= ~(PWR_CR3_LDOEN);
|
||||||
/* Wait till voltage level flag is set */
|
/* Wait till voltage level flag is set */
|
||||||
while ((PWR->CSR1 & PWR_CSR1_ACTVOSRDY) == 0U)
|
while ((PWR->CSR1 & PWR_CSR1_ACTVOSRDY) == 0U)
|
||||||
{}
|
{
|
||||||
|
}
|
||||||
#elif defined(USE_PWR_SMPS_1V8_SUPPLIES_LDO) && defined(SMPS)
|
#elif defined(USE_PWR_SMPS_1V8_SUPPLIES_LDO) && defined(SMPS)
|
||||||
/* Exit Run* mode */
|
/* Exit Run* mode */
|
||||||
PWR->CR3 |= PWR_CR3_SMPSLEVEL_0 | PWR_CR3_SMPSEN | PWR_CR3_LDOEN;
|
PWR->CR3 |= PWR_CR3_SMPSLEVEL_0 | PWR_CR3_SMPSEN | PWR_CR3_LDOEN;
|
||||||
/* Wait till voltage level flag is set */
|
/* Wait till voltage level flag is set */
|
||||||
while ((PWR->CSR1 & PWR_CSR1_ACTVOSRDY) == 0U)
|
while ((PWR->CSR1 & PWR_CSR1_ACTVOSRDY) == 0U)
|
||||||
{}
|
{
|
||||||
|
}
|
||||||
#elif defined(USE_PWR_SMPS_2V5_SUPPLIES_LDO) && defined(SMPS)
|
#elif defined(USE_PWR_SMPS_2V5_SUPPLIES_LDO) && defined(SMPS)
|
||||||
/* Exit Run* mode */
|
/* Exit Run* mode */
|
||||||
PWR->CR3 |= PWR_CR3_SMPSLEVEL_1 | PWR_CR3_SMPSEN | PWR_CR3_LDOEN;
|
PWR->CR3 |= PWR_CR3_SMPSLEVEL_1 | PWR_CR3_SMPSEN | PWR_CR3_LDOEN;
|
||||||
/* Wait till voltage level flag is set */
|
/* Wait till voltage level flag is set */
|
||||||
while ((PWR->CSR1 & PWR_CSR1_ACTVOSRDY) == 0U)
|
while ((PWR->CSR1 & PWR_CSR1_ACTVOSRDY) == 0U)
|
||||||
{}
|
{
|
||||||
|
}
|
||||||
#elif defined(USE_PWR_SMPS_1V8_SUPPLIES_EXT_AND_LDO) && defined(SMPS)
|
#elif defined(USE_PWR_SMPS_1V8_SUPPLIES_EXT_AND_LDO) && defined(SMPS)
|
||||||
/* Exit Run* mode */
|
/* Exit Run* mode */
|
||||||
PWR->CR3 |= PWR_CR3_SMPSLEVEL_0 | PWR_CR3_SMPSEXTHP | PWR_CR3_SMPSEN | PWR_CR3_LDOEN;
|
PWR->CR3 |= PWR_CR3_SMPSLEVEL_0 | PWR_CR3_SMPSEXTHP | PWR_CR3_SMPSEN | PWR_CR3_LDOEN;
|
||||||
/* Wait till voltage level flag is set */
|
/* Wait till voltage level flag is set */
|
||||||
while ((PWR->CSR1 & PWR_CSR1_ACTVOSRDY) == 0U)
|
while ((PWR->CSR1 & PWR_CSR1_ACTVOSRDY) == 0U)
|
||||||
{}
|
{
|
||||||
|
}
|
||||||
#elif defined(USE_PWR_SMPS_2V5_SUPPLIES_EXT_AND_LDO) && defined(SMPS)
|
#elif defined(USE_PWR_SMPS_2V5_SUPPLIES_EXT_AND_LDO) && defined(SMPS)
|
||||||
/* Exit Run* mode */
|
/* Exit Run* mode */
|
||||||
PWR->CR3 |= PWR_CR3_SMPSLEVEL_1 | PWR_CR3_SMPSEXTHP | PWR_CR3_SMPSEN | PWR_CR3_LDOEN;
|
PWR->CR3 |= PWR_CR3_SMPSLEVEL_1 | PWR_CR3_SMPSEXTHP | PWR_CR3_SMPSEN | PWR_CR3_LDOEN;
|
||||||
/* Wait till voltage level flag is set */
|
/* Wait till voltage level flag is set */
|
||||||
while ((PWR->CSR1 & PWR_CSR1_ACTVOSRDY) == 0U)
|
while ((PWR->CSR1 & PWR_CSR1_ACTVOSRDY) == 0U)
|
||||||
{}
|
{
|
||||||
|
}
|
||||||
#elif defined(USE_PWR_SMPS_1V8_SUPPLIES_EXT) && defined(SMPS)
|
#elif defined(USE_PWR_SMPS_1V8_SUPPLIES_EXT) && defined(SMPS)
|
||||||
/* Exit Run* mode */
|
/* Exit Run* mode */
|
||||||
PWR->CR3 = (PWR->CR3 & ~(PWR_CR3_LDOEN)) | PWR_CR3_SMPSLEVEL_0 | PWR_CR3_SMPSEXTHP | PWR_CR3_SMPSEN | PWR_CR3_BYPASS;
|
PWR->CR3 = (PWR->CR3 & ~(PWR_CR3_LDOEN)) | PWR_CR3_SMPSLEVEL_0 | PWR_CR3_SMPSEXTHP | PWR_CR3_SMPSEN |
|
||||||
|
PWR_CR3_BYPASS;
|
||||||
/* Wait till voltage level flag is set */
|
/* Wait till voltage level flag is set */
|
||||||
while ((PWR->CSR1 & PWR_CSR1_ACTVOSRDY) == 0U)
|
while ((PWR->CSR1 & PWR_CSR1_ACTVOSRDY) == 0U)
|
||||||
{}
|
{
|
||||||
|
}
|
||||||
#elif defined(USE_PWR_SMPS_2V5_SUPPLIES_EXT) && defined(SMPS)
|
#elif defined(USE_PWR_SMPS_2V5_SUPPLIES_EXT) && defined(SMPS)
|
||||||
/* Exit Run* mode */
|
/* Exit Run* mode */
|
||||||
PWR->CR3 = (PWR->CR3 & ~(PWR_CR3_LDOEN)) | PWR_CR3_SMPSLEVEL_1 | PWR_CR3_SMPSEXTHP | PWR_CR3_SMPSEN | PWR_CR3_BYPASS;
|
PWR->CR3 = (PWR->CR3 & ~(PWR_CR3_LDOEN)) | PWR_CR3_SMPSLEVEL_1 | PWR_CR3_SMPSEXTHP | PWR_CR3_SMPSEN |
|
||||||
|
PWR_CR3_BYPASS;
|
||||||
/* Wait till voltage level flag is set */
|
/* Wait till voltage level flag is set */
|
||||||
while ((PWR->CSR1 & PWR_CSR1_ACTVOSRDY) == 0U)
|
while ((PWR->CSR1 & PWR_CSR1_ACTVOSRDY) == 0U)
|
||||||
{}
|
{
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
/* No system power supply configuration is selected at exit Run* mode */
|
/* No system power supply configuration is selected at exit Run* mode */
|
||||||
#endif /* USE_PWR_LDO_SUPPLY */
|
#endif /* USE_PWR_LDO_SUPPLY */
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ void MX_UART5_Init(void)
|
|||||||
huart5.Instance = UART5;
|
huart5.Instance = UART5;
|
||||||
huart5.Init.BaudRate = 100000;
|
huart5.Init.BaudRate = 100000;
|
||||||
huart5.Init.WordLength = UART_WORDLENGTH_9B;
|
huart5.Init.WordLength = UART_WORDLENGTH_9B;
|
||||||
huart5.Init.StopBits = UART_STOPBITS_1;
|
huart5.Init.StopBits = UART_STOPBITS_2;
|
||||||
huart5.Init.Parity = UART_PARITY_EVEN;
|
huart5.Init.Parity = UART_PARITY_EVEN;
|
||||||
huart5.Init.Mode = UART_MODE_RX;
|
huart5.Init.Mode = UART_MODE_RX;
|
||||||
huart5.Init.HwFlowCtl = UART_HWCONTROL_NONE;
|
huart5.Init.HwFlowCtl = UART_HWCONTROL_NONE;
|
||||||
@@ -241,7 +241,7 @@ void MX_USART3_UART_Init(void)
|
|||||||
huart3.Init.ClockPrescaler = UART_PRESCALER_DIV1;
|
huart3.Init.ClockPrescaler = UART_PRESCALER_DIV1;
|
||||||
huart3.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_RXOVERRUNDISABLE_INIT;
|
huart3.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_RXOVERRUNDISABLE_INIT;
|
||||||
huart3.AdvancedInit.OverrunDisable = UART_ADVFEATURE_OVERRUN_DISABLE;
|
huart3.AdvancedInit.OverrunDisable = UART_ADVFEATURE_OVERRUN_DISABLE;
|
||||||
if (HAL_RS485Ex_Init(&huart3, UART_DE_POLARITY_HIGH, 0, 0) != HAL_OK)
|
if (HAL_UART_Init(&huart3) != HAL_OK)
|
||||||
{
|
{
|
||||||
Error_Handler();
|
Error_Handler();
|
||||||
}
|
}
|
||||||
@@ -361,8 +361,8 @@ void HAL_UART_MspInit(UART_HandleTypeDef* uartHandle)
|
|||||||
hdma_uart5_rx.Init.MemInc = DMA_MINC_ENABLE;
|
hdma_uart5_rx.Init.MemInc = DMA_MINC_ENABLE;
|
||||||
hdma_uart5_rx.Init.PeriphDataAlignment = DMA_PDATAALIGN_BYTE;
|
hdma_uart5_rx.Init.PeriphDataAlignment = DMA_PDATAALIGN_BYTE;
|
||||||
hdma_uart5_rx.Init.MemDataAlignment = DMA_MDATAALIGN_BYTE;
|
hdma_uart5_rx.Init.MemDataAlignment = DMA_MDATAALIGN_BYTE;
|
||||||
hdma_uart5_rx.Init.Mode = DMA_CIRCULAR;
|
hdma_uart5_rx.Init.Mode = DMA_NORMAL;
|
||||||
hdma_uart5_rx.Init.Priority = DMA_PRIORITY_LOW;
|
hdma_uart5_rx.Init.Priority = DMA_PRIORITY_VERY_HIGH;
|
||||||
hdma_uart5_rx.Init.FIFOMode = DMA_FIFOMODE_DISABLE;
|
hdma_uart5_rx.Init.FIFOMode = DMA_FIFOMODE_DISABLE;
|
||||||
if (HAL_DMA_Init(&hdma_uart5_rx) != HAL_OK)
|
if (HAL_DMA_Init(&hdma_uart5_rx) != HAL_OK)
|
||||||
{
|
{
|
||||||
@@ -601,20 +601,11 @@ void HAL_UART_MspInit(UART_HandleTypeDef* uartHandle)
|
|||||||
/* USART3 clock enable */
|
/* USART3 clock enable */
|
||||||
__HAL_RCC_USART3_CLK_ENABLE();
|
__HAL_RCC_USART3_CLK_ENABLE();
|
||||||
|
|
||||||
__HAL_RCC_GPIOB_CLK_ENABLE();
|
|
||||||
__HAL_RCC_GPIOD_CLK_ENABLE();
|
__HAL_RCC_GPIOD_CLK_ENABLE();
|
||||||
/**USART3 GPIO Configuration
|
/**USART3 GPIO Configuration
|
||||||
PB14 ------> USART3_DE
|
|
||||||
PD8 ------> USART3_TX
|
PD8 ------> USART3_TX
|
||||||
PD9 ------> USART3_RX
|
PD9 ------> USART3_RX
|
||||||
*/
|
*/
|
||||||
GPIO_InitStruct.Pin = GPIO_PIN_14;
|
|
||||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
|
||||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
|
||||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
|
||||||
GPIO_InitStruct.Alternate = GPIO_AF7_USART3;
|
|
||||||
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
|
||||||
|
|
||||||
GPIO_InitStruct.Pin = GPIO_PIN_8|GPIO_PIN_9;
|
GPIO_InitStruct.Pin = GPIO_PIN_8|GPIO_PIN_9;
|
||||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
@@ -858,12 +849,9 @@ void HAL_UART_MspDeInit(UART_HandleTypeDef* uartHandle)
|
|||||||
__HAL_RCC_USART3_CLK_DISABLE();
|
__HAL_RCC_USART3_CLK_DISABLE();
|
||||||
|
|
||||||
/**USART3 GPIO Configuration
|
/**USART3 GPIO Configuration
|
||||||
PB14 ------> USART3_DE
|
|
||||||
PD8 ------> USART3_TX
|
PD8 ------> USART3_TX
|
||||||
PD9 ------> USART3_RX
|
PD9 ------> USART3_RX
|
||||||
*/
|
*/
|
||||||
HAL_GPIO_DeInit(GPIOB, GPIO_PIN_14);
|
|
||||||
|
|
||||||
HAL_GPIO_DeInit(GPIOD, GPIO_PIN_8|GPIO_PIN_9);
|
HAL_GPIO_DeInit(GPIOD, GPIO_PIN_8|GPIO_PIN_9);
|
||||||
|
|
||||||
/* USART3 DMA DeInit */
|
/* USART3 DMA DeInit */
|
||||||
|
|||||||
378
Drivers/CMSIS/DSP/Include/arm_common_tables.h
Normal file
378
Drivers/CMSIS/DSP/Include/arm_common_tables.h
Normal file
@@ -0,0 +1,378 @@
|
|||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
* Project: CMSIS DSP Library
|
||||||
|
* Title: arm_common_tables.h
|
||||||
|
* Description: Extern declaration for common tables
|
||||||
|
*
|
||||||
|
* $Date: 27. January 2017
|
||||||
|
* $Revision: V.1.5.1
|
||||||
|
*
|
||||||
|
* Target Processor: Cortex-M cores
|
||||||
|
* -------------------------------------------------------------------- */
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2010-2017 ARM Limited or its affiliates. All rights reserved.
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the License); you may
|
||||||
|
* not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _ARM_COMMON_TABLES_H
|
||||||
|
#define _ARM_COMMON_TABLES_H
|
||||||
|
|
||||||
|
#include "arm_math.h"
|
||||||
|
|
||||||
|
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_FFT_ALLOW_TABLES)
|
||||||
|
|
||||||
|
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_BITREV_1024)
|
||||||
|
extern const uint16_t armBitRevTable[1024];
|
||||||
|
#endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */
|
||||||
|
|
||||||
|
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_F32_16)
|
||||||
|
extern const float32_t twiddleCoef_16[32];
|
||||||
|
#endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */
|
||||||
|
|
||||||
|
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_F32_32)
|
||||||
|
extern const float32_t twiddleCoef_32[64];
|
||||||
|
#endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */
|
||||||
|
|
||||||
|
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_F32_64)
|
||||||
|
extern const float32_t twiddleCoef_64[128];
|
||||||
|
#endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */
|
||||||
|
|
||||||
|
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_F32_128)
|
||||||
|
extern const float32_t twiddleCoef_128[256];
|
||||||
|
#endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */
|
||||||
|
|
||||||
|
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_F32_256)
|
||||||
|
extern const float32_t twiddleCoef_256[512];
|
||||||
|
#endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */
|
||||||
|
|
||||||
|
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_F32_512)
|
||||||
|
extern const float32_t twiddleCoef_512[1024];
|
||||||
|
#endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */
|
||||||
|
|
||||||
|
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_F32_1024)
|
||||||
|
extern const float32_t twiddleCoef_1024[2048];
|
||||||
|
#endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */
|
||||||
|
|
||||||
|
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_F32_2048)
|
||||||
|
extern const float32_t twiddleCoef_2048[4096];
|
||||||
|
#endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */
|
||||||
|
|
||||||
|
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_F32_4096)
|
||||||
|
extern const float32_t twiddleCoef_4096[8192];
|
||||||
|
#define twiddleCoef twiddleCoef_4096
|
||||||
|
#endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */
|
||||||
|
|
||||||
|
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_Q31_16)
|
||||||
|
extern const q31_t twiddleCoef_16_q31[24];
|
||||||
|
#endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */
|
||||||
|
|
||||||
|
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_Q31_32)
|
||||||
|
extern const q31_t twiddleCoef_32_q31[48];
|
||||||
|
#endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */
|
||||||
|
|
||||||
|
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_Q31_64)
|
||||||
|
extern const q31_t twiddleCoef_64_q31[96];
|
||||||
|
#endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */
|
||||||
|
|
||||||
|
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_Q31_128)
|
||||||
|
extern const q31_t twiddleCoef_128_q31[192];
|
||||||
|
#endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */
|
||||||
|
|
||||||
|
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_Q31_256)
|
||||||
|
extern const q31_t twiddleCoef_256_q31[384];
|
||||||
|
#endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */
|
||||||
|
|
||||||
|
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_Q31_512)
|
||||||
|
extern const q31_t twiddleCoef_512_q31[768];
|
||||||
|
#endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */
|
||||||
|
|
||||||
|
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_Q31_1024)
|
||||||
|
extern const q31_t twiddleCoef_1024_q31[1536];
|
||||||
|
#endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */
|
||||||
|
|
||||||
|
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_Q31_2048)
|
||||||
|
extern const q31_t twiddleCoef_2048_q31[3072];
|
||||||
|
#endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */
|
||||||
|
|
||||||
|
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_Q31_4096)
|
||||||
|
extern const q31_t twiddleCoef_4096_q31[6144];
|
||||||
|
#endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */
|
||||||
|
|
||||||
|
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_Q15_16)
|
||||||
|
extern const q15_t twiddleCoef_16_q15[24];
|
||||||
|
#endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */
|
||||||
|
|
||||||
|
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_Q15_32)
|
||||||
|
extern const q15_t twiddleCoef_32_q15[48];
|
||||||
|
#endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */
|
||||||
|
|
||||||
|
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_Q15_64)
|
||||||
|
extern const q15_t twiddleCoef_64_q15[96];
|
||||||
|
#endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */
|
||||||
|
|
||||||
|
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_Q15_128)
|
||||||
|
extern const q15_t twiddleCoef_128_q15[192];
|
||||||
|
#endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */
|
||||||
|
|
||||||
|
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_Q15_256)
|
||||||
|
extern const q15_t twiddleCoef_256_q15[384];
|
||||||
|
#endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */
|
||||||
|
|
||||||
|
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_Q15_512)
|
||||||
|
extern const q15_t twiddleCoef_512_q15[768];
|
||||||
|
#endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */
|
||||||
|
|
||||||
|
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_Q15_1024)
|
||||||
|
extern const q15_t twiddleCoef_1024_q15[1536];
|
||||||
|
#endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */
|
||||||
|
|
||||||
|
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_Q15_2048)
|
||||||
|
extern const q15_t twiddleCoef_2048_q15[3072];
|
||||||
|
#endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */
|
||||||
|
|
||||||
|
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_Q15_4096)
|
||||||
|
extern const q15_t twiddleCoef_4096_q15[6144];
|
||||||
|
#endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */
|
||||||
|
|
||||||
|
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_RFFT_F32_32)
|
||||||
|
extern const float32_t twiddleCoef_rfft_32[32];
|
||||||
|
#endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */
|
||||||
|
|
||||||
|
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_RFFT_F32_64)
|
||||||
|
extern const float32_t twiddleCoef_rfft_64[64];
|
||||||
|
#endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */
|
||||||
|
|
||||||
|
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_RFFT_F32_128)
|
||||||
|
extern const float32_t twiddleCoef_rfft_128[128];
|
||||||
|
#endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */
|
||||||
|
|
||||||
|
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_RFFT_F32_256)
|
||||||
|
extern const float32_t twiddleCoef_rfft_256[256];
|
||||||
|
#endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */
|
||||||
|
|
||||||
|
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_RFFT_F32_512)
|
||||||
|
extern const float32_t twiddleCoef_rfft_512[512];
|
||||||
|
#endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */
|
||||||
|
|
||||||
|
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_RFFT_F32_1024)
|
||||||
|
extern const float32_t twiddleCoef_rfft_1024[1024];
|
||||||
|
#endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */
|
||||||
|
|
||||||
|
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_RFFT_F32_2048)
|
||||||
|
extern const float32_t twiddleCoef_rfft_2048[2048];
|
||||||
|
#endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */
|
||||||
|
|
||||||
|
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_RFFT_F32_4096)
|
||||||
|
extern const float32_t twiddleCoef_rfft_4096[4096];
|
||||||
|
#endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */
|
||||||
|
|
||||||
|
/* floating-point bit reversal tables */
|
||||||
|
|
||||||
|
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_BITREVIDX_FLT_16)
|
||||||
|
#define ARMBITREVINDEXTABLE_16_TABLE_LENGTH ((uint16_t)20)
|
||||||
|
extern const uint16_t armBitRevIndexTable16[ARMBITREVINDEXTABLE_16_TABLE_LENGTH];
|
||||||
|
#endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */
|
||||||
|
|
||||||
|
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_BITREVIDX_FLT_32)
|
||||||
|
#define ARMBITREVINDEXTABLE_32_TABLE_LENGTH ((uint16_t)48)
|
||||||
|
extern const uint16_t armBitRevIndexTable32[ARMBITREVINDEXTABLE_32_TABLE_LENGTH];
|
||||||
|
#endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */
|
||||||
|
|
||||||
|
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_BITREVIDX_FLT_64)
|
||||||
|
#define ARMBITREVINDEXTABLE_64_TABLE_LENGTH ((uint16_t)56)
|
||||||
|
extern const uint16_t armBitRevIndexTable64[ARMBITREVINDEXTABLE_64_TABLE_LENGTH];
|
||||||
|
#endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */
|
||||||
|
|
||||||
|
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_BITREVIDX_FLT_128)
|
||||||
|
#define ARMBITREVINDEXTABLE_128_TABLE_LENGTH ((uint16_t)208)
|
||||||
|
extern const uint16_t armBitRevIndexTable128[ARMBITREVINDEXTABLE_128_TABLE_LENGTH];
|
||||||
|
#endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */
|
||||||
|
|
||||||
|
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_BITREVIDX_FLT_256)
|
||||||
|
#define ARMBITREVINDEXTABLE_256_TABLE_LENGTH ((uint16_t)440)
|
||||||
|
extern const uint16_t armBitRevIndexTable256[ARMBITREVINDEXTABLE_256_TABLE_LENGTH];
|
||||||
|
#endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */
|
||||||
|
|
||||||
|
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_BITREVIDX_FLT_512)
|
||||||
|
#define ARMBITREVINDEXTABLE_512_TABLE_LENGTH ((uint16_t)448)
|
||||||
|
extern const uint16_t armBitRevIndexTable512[ARMBITREVINDEXTABLE_512_TABLE_LENGTH];
|
||||||
|
#endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */
|
||||||
|
|
||||||
|
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_BITREVIDX_FLT_1024)
|
||||||
|
#define ARMBITREVINDEXTABLE_1024_TABLE_LENGTH ((uint16_t)1800)
|
||||||
|
extern const uint16_t armBitRevIndexTable1024[ARMBITREVINDEXTABLE_1024_TABLE_LENGTH];
|
||||||
|
#endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */
|
||||||
|
|
||||||
|
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_BITREVIDX_FLT_2048)
|
||||||
|
#define ARMBITREVINDEXTABLE_2048_TABLE_LENGTH ((uint16_t)3808)
|
||||||
|
extern const uint16_t armBitRevIndexTable2048[ARMBITREVINDEXTABLE_2048_TABLE_LENGTH];
|
||||||
|
#endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */
|
||||||
|
|
||||||
|
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_BITREVIDX_FLT_4096)
|
||||||
|
#define ARMBITREVINDEXTABLE_4096_TABLE_LENGTH ((uint16_t)4032)
|
||||||
|
extern const uint16_t armBitRevIndexTable4096[ARMBITREVINDEXTABLE_4096_TABLE_LENGTH];
|
||||||
|
#endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */
|
||||||
|
|
||||||
|
|
||||||
|
/* fixed-point bit reversal tables */
|
||||||
|
|
||||||
|
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_BITREVIDX_FXT_16)
|
||||||
|
#define ARMBITREVINDEXTABLE_FIXED_16_TABLE_LENGTH ((uint16_t)12)
|
||||||
|
extern const uint16_t armBitRevIndexTable_fixed_16[ARMBITREVINDEXTABLE_FIXED_16_TABLE_LENGTH];
|
||||||
|
#endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */
|
||||||
|
|
||||||
|
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_BITREVIDX_FXT_32)
|
||||||
|
#define ARMBITREVINDEXTABLE_FIXED_32_TABLE_LENGTH ((uint16_t)24)
|
||||||
|
extern const uint16_t armBitRevIndexTable_fixed_32[ARMBITREVINDEXTABLE_FIXED_32_TABLE_LENGTH];
|
||||||
|
#endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */
|
||||||
|
|
||||||
|
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_BITREVIDX_FXT_64)
|
||||||
|
#define ARMBITREVINDEXTABLE_FIXED_64_TABLE_LENGTH ((uint16_t)56)
|
||||||
|
extern const uint16_t armBitRevIndexTable_fixed_64[ARMBITREVINDEXTABLE_FIXED_64_TABLE_LENGTH];
|
||||||
|
#endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */
|
||||||
|
|
||||||
|
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_BITREVIDX_FXT_128)
|
||||||
|
#define ARMBITREVINDEXTABLE_FIXED_128_TABLE_LENGTH ((uint16_t)112)
|
||||||
|
extern const uint16_t armBitRevIndexTable_fixed_128[ARMBITREVINDEXTABLE_FIXED_128_TABLE_LENGTH];
|
||||||
|
#endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */
|
||||||
|
|
||||||
|
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_BITREVIDX_FXT_256)
|
||||||
|
#define ARMBITREVINDEXTABLE_FIXED_256_TABLE_LENGTH ((uint16_t)240)
|
||||||
|
extern const uint16_t armBitRevIndexTable_fixed_256[ARMBITREVINDEXTABLE_FIXED_256_TABLE_LENGTH];
|
||||||
|
#endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */
|
||||||
|
|
||||||
|
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_BITREVIDX_FXT_512)
|
||||||
|
#define ARMBITREVINDEXTABLE_FIXED_512_TABLE_LENGTH ((uint16_t)480)
|
||||||
|
extern const uint16_t armBitRevIndexTable_fixed_512[ARMBITREVINDEXTABLE_FIXED_512_TABLE_LENGTH];
|
||||||
|
#endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */
|
||||||
|
|
||||||
|
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_BITREVIDX_FXT_1024)
|
||||||
|
#define ARMBITREVINDEXTABLE_FIXED_1024_TABLE_LENGTH ((uint16_t)992)
|
||||||
|
extern const uint16_t armBitRevIndexTable_fixed_1024[ARMBITREVINDEXTABLE_FIXED_1024_TABLE_LENGTH];
|
||||||
|
#endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */
|
||||||
|
|
||||||
|
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_BITREVIDX_FXT_2048)
|
||||||
|
#define ARMBITREVINDEXTABLE_FIXED_2048_TABLE_LENGTH ((uint16_t)1984)
|
||||||
|
extern const uint16_t armBitRevIndexTable_fixed_2048[ARMBITREVINDEXTABLE_FIXED_2048_TABLE_LENGTH];
|
||||||
|
#endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */
|
||||||
|
|
||||||
|
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_BITREVIDX_FXT_4096)
|
||||||
|
#define ARMBITREVINDEXTABLE_FIXED_4096_TABLE_LENGTH ((uint16_t)4032)
|
||||||
|
extern const uint16_t armBitRevIndexTable_fixed_4096[ARMBITREVINDEXTABLE_FIXED_4096_TABLE_LENGTH];
|
||||||
|
#endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */
|
||||||
|
|
||||||
|
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_REALCOEF_F32)
|
||||||
|
extern const float32_t realCoefA[8192];
|
||||||
|
extern const float32_t realCoefB[8192];
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_REALCOEF_Q31)
|
||||||
|
extern const q31_t realCoefAQ31[8192];
|
||||||
|
extern const q31_t realCoefBQ31[8192];
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_REALCOEF_Q15)
|
||||||
|
extern const q15_t realCoefAQ15[8192];
|
||||||
|
extern const q15_t realCoefBQ15[8192];
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_DCT4_F32_128)
|
||||||
|
extern const float32_t Weights_128[256];
|
||||||
|
extern const float32_t cos_factors_128[128];
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_DCT4_F32_512)
|
||||||
|
extern const float32_t Weights_512[1024];
|
||||||
|
extern const float32_t cos_factors_512[512];
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_DCT4_F32_2048)
|
||||||
|
extern const float32_t Weights_2048[4096];
|
||||||
|
extern const float32_t cos_factors_2048[2048];
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_DCT4_F32_8192)
|
||||||
|
extern const float32_t Weights_8192[16384];
|
||||||
|
extern const float32_t cos_factors_8192[8192];
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_DCT4_Q15_128)
|
||||||
|
extern const q15_t WeightsQ15_128[256];
|
||||||
|
extern const q15_t cos_factorsQ15_128[128];
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_DCT4_Q15_512)
|
||||||
|
extern const q15_t WeightsQ15_512[1024];
|
||||||
|
extern const q15_t cos_factorsQ15_512[512];
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_DCT4_Q15_2048)
|
||||||
|
extern const q15_t WeightsQ15_2048[4096];
|
||||||
|
extern const q15_t cos_factorsQ15_2048[2048];
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_DCT4_Q15_8192)
|
||||||
|
extern const q15_t WeightsQ15_8192[16384];
|
||||||
|
extern const q15_t cos_factorsQ15_8192[8192];
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_DCT4_Q31_128)
|
||||||
|
extern const q31_t WeightsQ31_128[256];
|
||||||
|
extern const q31_t cos_factorsQ31_128[128];
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_DCT4_Q31_512)
|
||||||
|
extern const q31_t WeightsQ31_512[1024];
|
||||||
|
extern const q31_t cos_factorsQ31_512[512];
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_DCT4_Q31_2048)
|
||||||
|
extern const q31_t WeightsQ31_2048[4096];
|
||||||
|
extern const q31_t cos_factorsQ31_2048[2048];
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_DCT4_Q31_8192)
|
||||||
|
extern const q31_t WeightsQ31_8192[16384];
|
||||||
|
extern const q31_t cos_factorsQ31_8192[8192];
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_FFT_TABLES) */
|
||||||
|
|
||||||
|
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_FAST_ALLOW_TABLES)
|
||||||
|
|
||||||
|
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FAST_TABLES) || defined(ARM_TABLE_RECIP_Q15)
|
||||||
|
extern const q15_t armRecipTableQ15[64];
|
||||||
|
#endif /* !defined(ARM_DSP_CONFIG_TABLES) defined(ARM_ALL_FAST_TABLES) */
|
||||||
|
|
||||||
|
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FAST_TABLES) || defined(ARM_TABLE_RECIP_Q31)
|
||||||
|
extern const q31_t armRecipTableQ31[64];
|
||||||
|
#endif /* !defined(ARM_DSP_CONFIG_TABLES) defined(ARM_ALL_FAST_TABLES) */
|
||||||
|
|
||||||
|
/* Tables for Fast Math Sine and Cosine */
|
||||||
|
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FAST_TABLES) || defined(ARM_TABLE_SIN_F32)
|
||||||
|
extern const float32_t sinTable_f32[FAST_MATH_TABLE_SIZE + 1];
|
||||||
|
#endif /* !defined(ARM_DSP_CONFIG_TABLES) defined(ARM_ALL_FAST_TABLES) */
|
||||||
|
|
||||||
|
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FAST_TABLES) || defined(ARM_TABLE_SIN_Q31)
|
||||||
|
extern const q31_t sinTable_q31[FAST_MATH_TABLE_SIZE + 1];
|
||||||
|
#endif /* !defined(ARM_DSP_CONFIG_TABLES) defined(ARM_ALL_FAST_TABLES) */
|
||||||
|
|
||||||
|
#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FAST_TABLES) || defined(ARM_TABLE_SIN_Q15)
|
||||||
|
extern const q15_t sinTable_q15[FAST_MATH_TABLE_SIZE + 1];
|
||||||
|
#endif /* !defined(ARM_DSP_CONFIG_TABLES) defined(ARM_ALL_FAST_TABLES) */
|
||||||
|
|
||||||
|
#endif /* if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_FAST_TABLES) */
|
||||||
|
|
||||||
|
#endif /* ARM_COMMON_TABLES_H */
|
||||||
66
Drivers/CMSIS/DSP/Include/arm_const_structs.h
Normal file
66
Drivers/CMSIS/DSP/Include/arm_const_structs.h
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
* Project: CMSIS DSP Library
|
||||||
|
* Title: arm_const_structs.h
|
||||||
|
* Description: Constant structs that are initialized for user convenience.
|
||||||
|
* For example, some can be given as arguments to the arm_cfft_f32() function.
|
||||||
|
*
|
||||||
|
* $Date: 27. January 2017
|
||||||
|
* $Revision: V.1.5.1
|
||||||
|
*
|
||||||
|
* Target Processor: Cortex-M cores
|
||||||
|
* -------------------------------------------------------------------- */
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2010-2017 ARM Limited or its affiliates. All rights reserved.
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the License); you may
|
||||||
|
* not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _ARM_CONST_STRUCTS_H
|
||||||
|
#define _ARM_CONST_STRUCTS_H
|
||||||
|
|
||||||
|
#include "arm_math.h"
|
||||||
|
#include "arm_common_tables.h"
|
||||||
|
|
||||||
|
extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len16;
|
||||||
|
extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len32;
|
||||||
|
extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len64;
|
||||||
|
extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len128;
|
||||||
|
extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len256;
|
||||||
|
extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len512;
|
||||||
|
extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len1024;
|
||||||
|
extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len2048;
|
||||||
|
extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len4096;
|
||||||
|
|
||||||
|
extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len16;
|
||||||
|
extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len32;
|
||||||
|
extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len64;
|
||||||
|
extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len128;
|
||||||
|
extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len256;
|
||||||
|
extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len512;
|
||||||
|
extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len1024;
|
||||||
|
extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len2048;
|
||||||
|
extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len4096;
|
||||||
|
|
||||||
|
extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len16;
|
||||||
|
extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len32;
|
||||||
|
extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len64;
|
||||||
|
extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len128;
|
||||||
|
extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len256;
|
||||||
|
extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len512;
|
||||||
|
extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len1024;
|
||||||
|
extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len2048;
|
||||||
|
extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len4096;
|
||||||
|
|
||||||
|
#endif
|
||||||
7361
Drivers/CMSIS/DSP/Include/arm_math.h
Normal file
7361
Drivers/CMSIS/DSP/Include/arm_math.h
Normal file
File diff suppressed because it is too large
Load Diff
BIN
Drivers/CMSIS/DSP/Lib/GCC/libarm_cortexM7l_math.a
Normal file
BIN
Drivers/CMSIS/DSP/Lib/GCC/libarm_cortexM7l_math.a
Normal file
Binary file not shown.
BIN
Drivers/CMSIS/DSP/Lib/GCC/libarm_cortexM7lfdp_math.a
Normal file
BIN
Drivers/CMSIS/DSP/Lib/GCC/libarm_cortexM7lfdp_math.a
Normal file
Binary file not shown.
BIN
Drivers/CMSIS/DSP/Lib/GCC/libarm_cortexM7lfsp_math.a
Normal file
BIN
Drivers/CMSIS/DSP/Lib/GCC/libarm_cortexM7lfsp_math.a
Normal file
Binary file not shown.
@@ -1,237 +0,0 @@
|
|||||||
/**
|
|
||||||
******************************************************************************
|
|
||||||
* @file stm32h7xx_hal_iwdg.h
|
|
||||||
* @author MCD Application Team
|
|
||||||
* @brief Header file of IWDG HAL module.
|
|
||||||
******************************************************************************
|
|
||||||
* @attention
|
|
||||||
*
|
|
||||||
* Copyright (c) 2017 STMicroelectronics.
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* This software is licensed under terms that can be found in the LICENSE file
|
|
||||||
* in the root directory of this software component.
|
|
||||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
|
||||||
*
|
|
||||||
******************************************************************************
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
|
||||||
#ifndef STM32H7xx_HAL_IWDG_H
|
|
||||||
#define STM32H7xx_HAL_IWDG_H
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Includes ------------------------------------------------------------------*/
|
|
||||||
#include "stm32h7xx_hal_def.h"
|
|
||||||
|
|
||||||
/** @addtogroup STM32H7xx_HAL_Driver
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup IWDG IWDG
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Exported types ------------------------------------------------------------*/
|
|
||||||
/** @defgroup IWDG_Exported_Types IWDG Exported Types
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief IWDG Init structure definition
|
|
||||||
*/
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
uint32_t Prescaler; /*!< Select the prescaler of the IWDG.
|
|
||||||
This parameter can be a value of @ref IWDG_Prescaler */
|
|
||||||
|
|
||||||
uint32_t Reload; /*!< Specifies the IWDG down-counter reload value.
|
|
||||||
This parameter must be a number between Min_Data = 0 and Max_Data = 0x0FFF */
|
|
||||||
|
|
||||||
uint32_t Window; /*!< Specifies the window value to be compared to the down-counter.
|
|
||||||
This parameter must be a number between Min_Data = 0 and Max_Data = 0x0FFF */
|
|
||||||
|
|
||||||
} IWDG_InitTypeDef;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief IWDG Handle Structure definition
|
|
||||||
*/
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
IWDG_TypeDef *Instance; /*!< Register base address */
|
|
||||||
|
|
||||||
IWDG_InitTypeDef Init; /*!< IWDG required parameters */
|
|
||||||
} IWDG_HandleTypeDef;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Exported constants --------------------------------------------------------*/
|
|
||||||
/** @defgroup IWDG_Exported_Constants IWDG Exported Constants
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup IWDG_Prescaler IWDG Prescaler
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define IWDG_PRESCALER_4 0x00000000u /*!< IWDG prescaler set to 4 */
|
|
||||||
#define IWDG_PRESCALER_8 IWDG_PR_PR_0 /*!< IWDG prescaler set to 8 */
|
|
||||||
#define IWDG_PRESCALER_16 IWDG_PR_PR_1 /*!< IWDG prescaler set to 16 */
|
|
||||||
#define IWDG_PRESCALER_32 (IWDG_PR_PR_1 | IWDG_PR_PR_0) /*!< IWDG prescaler set to 32 */
|
|
||||||
#define IWDG_PRESCALER_64 IWDG_PR_PR_2 /*!< IWDG prescaler set to 64 */
|
|
||||||
#define IWDG_PRESCALER_128 (IWDG_PR_PR_2 | IWDG_PR_PR_0) /*!< IWDG prescaler set to 128 */
|
|
||||||
#define IWDG_PRESCALER_256 (IWDG_PR_PR_2 | IWDG_PR_PR_1) /*!< IWDG prescaler set to 256 */
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup IWDG_Window_option IWDG Window option
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define IWDG_WINDOW_DISABLE IWDG_WINR_WIN
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Exported macros -----------------------------------------------------------*/
|
|
||||||
/** @defgroup IWDG_Exported_Macros IWDG Exported Macros
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Enable the IWDG peripheral.
|
|
||||||
* @param __HANDLE__ IWDG handle
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
#define __HAL_IWDG_START(__HANDLE__) WRITE_REG((__HANDLE__)->Instance->KR, IWDG_KEY_ENABLE)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Reload IWDG counter with value defined in the reload register
|
|
||||||
* (write access to IWDG_PR, IWDG_RLR and IWDG_WINR registers disabled).
|
|
||||||
* @param __HANDLE__ IWDG handle
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
#define __HAL_IWDG_RELOAD_COUNTER(__HANDLE__) WRITE_REG((__HANDLE__)->Instance->KR, IWDG_KEY_RELOAD)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Exported functions --------------------------------------------------------*/
|
|
||||||
/** @defgroup IWDG_Exported_Functions IWDG Exported Functions
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup IWDG_Exported_Functions_Group1 Initialization and Start functions
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
/* Initialization/Start functions ********************************************/
|
|
||||||
HAL_StatusTypeDef HAL_IWDG_Init(IWDG_HandleTypeDef *hiwdg);
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup IWDG_Exported_Functions_Group2 IO operation functions
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
/* I/O operation functions ****************************************************/
|
|
||||||
HAL_StatusTypeDef HAL_IWDG_Refresh(IWDG_HandleTypeDef *hiwdg);
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Private constants ---------------------------------------------------------*/
|
|
||||||
/** @defgroup IWDG_Private_Constants IWDG Private Constants
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief IWDG Key Register BitMask
|
|
||||||
*/
|
|
||||||
#define IWDG_KEY_RELOAD 0x0000AAAAu /*!< IWDG Reload Counter Enable */
|
|
||||||
#define IWDG_KEY_ENABLE 0x0000CCCCu /*!< IWDG Peripheral Enable */
|
|
||||||
#define IWDG_KEY_WRITE_ACCESS_ENABLE 0x00005555u /*!< IWDG KR Write Access Enable */
|
|
||||||
#define IWDG_KEY_WRITE_ACCESS_DISABLE 0x00000000u /*!< IWDG KR Write Access Disable */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Private macros ------------------------------------------------------------*/
|
|
||||||
/** @defgroup IWDG_Private_Macros IWDG Private Macros
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Enable write access to IWDG_PR, IWDG_RLR and IWDG_WINR registers.
|
|
||||||
* @param __HANDLE__ IWDG handle
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
#define IWDG_ENABLE_WRITE_ACCESS(__HANDLE__) WRITE_REG((__HANDLE__)->Instance->KR, IWDG_KEY_WRITE_ACCESS_ENABLE)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Disable write access to IWDG_PR, IWDG_RLR and IWDG_WINR registers.
|
|
||||||
* @param __HANDLE__ IWDG handle
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
#define IWDG_DISABLE_WRITE_ACCESS(__HANDLE__) WRITE_REG((__HANDLE__)->Instance->KR, IWDG_KEY_WRITE_ACCESS_DISABLE)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Check IWDG prescaler value.
|
|
||||||
* @param __PRESCALER__ IWDG prescaler value
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
#define IS_IWDG_PRESCALER(__PRESCALER__) (((__PRESCALER__) == IWDG_PRESCALER_4) || \
|
|
||||||
((__PRESCALER__) == IWDG_PRESCALER_8) || \
|
|
||||||
((__PRESCALER__) == IWDG_PRESCALER_16) || \
|
|
||||||
((__PRESCALER__) == IWDG_PRESCALER_32) || \
|
|
||||||
((__PRESCALER__) == IWDG_PRESCALER_64) || \
|
|
||||||
((__PRESCALER__) == IWDG_PRESCALER_128)|| \
|
|
||||||
((__PRESCALER__) == IWDG_PRESCALER_256))
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Check IWDG reload value.
|
|
||||||
* @param __RELOAD__ IWDG reload value
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
#define IS_IWDG_RELOAD(__RELOAD__) ((__RELOAD__) <= IWDG_RLR_RL)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Check IWDG window value.
|
|
||||||
* @param __WINDOW__ IWDG window value
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
#define IS_IWDG_WINDOW(__WINDOW__) ((__WINDOW__) <= IWDG_WINR_WIN)
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* STM32H7xx_HAL_IWDG_H */
|
|
||||||
@@ -1,338 +0,0 @@
|
|||||||
/**
|
|
||||||
******************************************************************************
|
|
||||||
* @file stm32h7xx_ll_iwdg.h
|
|
||||||
* @author MCD Application Team
|
|
||||||
* @brief Header file of IWDG LL module.
|
|
||||||
******************************************************************************
|
|
||||||
* @attention
|
|
||||||
*
|
|
||||||
* Copyright (c) 2017 STMicroelectronics.
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* This software is licensed under terms that can be found in the LICENSE file
|
|
||||||
* in the root directory of this software component.
|
|
||||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
|
||||||
*
|
|
||||||
******************************************************************************
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
|
||||||
#ifndef STM32H7xx_LL_IWDG_H
|
|
||||||
#define STM32H7xx_LL_IWDG_H
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Includes ------------------------------------------------------------------*/
|
|
||||||
#include "stm32h7xx.h"
|
|
||||||
|
|
||||||
/** @addtogroup STM32H7xx_LL_Driver
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if defined(IWDG1) || defined(IWDG2)
|
|
||||||
|
|
||||||
/** @defgroup IWDG_LL IWDG
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Private types -------------------------------------------------------------*/
|
|
||||||
/* Private variables ---------------------------------------------------------*/
|
|
||||||
|
|
||||||
/* Private constants ---------------------------------------------------------*/
|
|
||||||
/** @defgroup IWDG_LL_Private_Constants IWDG Private Constants
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define LL_IWDG_KEY_RELOAD 0x0000AAAAU /*!< IWDG Reload Counter Enable */
|
|
||||||
#define LL_IWDG_KEY_ENABLE 0x0000CCCCU /*!< IWDG Peripheral Enable */
|
|
||||||
#define LL_IWDG_KEY_WR_ACCESS_ENABLE 0x00005555U /*!< IWDG KR Write Access Enable */
|
|
||||||
#define LL_IWDG_KEY_WR_ACCESS_DISABLE 0x00000000U /*!< IWDG KR Write Access Disable */
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Private macros ------------------------------------------------------------*/
|
|
||||||
|
|
||||||
/* Exported types ------------------------------------------------------------*/
|
|
||||||
/* Exported constants --------------------------------------------------------*/
|
|
||||||
/** @defgroup IWDG_LL_Exported_Constants IWDG Exported Constants
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup IWDG_LL_EC_GET_FLAG Get Flags Defines
|
|
||||||
* @brief Flags defines which can be used with LL_IWDG_ReadReg function
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define LL_IWDG_SR_PVU IWDG_SR_PVU /*!< Watchdog prescaler value update */
|
|
||||||
#define LL_IWDG_SR_RVU IWDG_SR_RVU /*!< Watchdog counter reload value update */
|
|
||||||
#define LL_IWDG_SR_WVU IWDG_SR_WVU /*!< Watchdog counter window value update */
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup IWDG_LL_EC_PRESCALER Prescaler Divider
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define LL_IWDG_PRESCALER_4 0x00000000U /*!< Divider by 4 */
|
|
||||||
#define LL_IWDG_PRESCALER_8 (IWDG_PR_PR_0) /*!< Divider by 8 */
|
|
||||||
#define LL_IWDG_PRESCALER_16 (IWDG_PR_PR_1) /*!< Divider by 16 */
|
|
||||||
#define LL_IWDG_PRESCALER_32 (IWDG_PR_PR_1 | IWDG_PR_PR_0) /*!< Divider by 32 */
|
|
||||||
#define LL_IWDG_PRESCALER_64 (IWDG_PR_PR_2) /*!< Divider by 64 */
|
|
||||||
#define LL_IWDG_PRESCALER_128 (IWDG_PR_PR_2 | IWDG_PR_PR_0) /*!< Divider by 128 */
|
|
||||||
#define LL_IWDG_PRESCALER_256 (IWDG_PR_PR_2 | IWDG_PR_PR_1) /*!< Divider by 256 */
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Exported macro ------------------------------------------------------------*/
|
|
||||||
/** @defgroup IWDG_LL_Exported_Macros IWDG Exported Macros
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup IWDG_LL_EM_WRITE_READ Common Write and read registers Macros
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Write a value in IWDG register
|
|
||||||
* @param __INSTANCE__ IWDG Instance
|
|
||||||
* @param __REG__ Register to be written
|
|
||||||
* @param __VALUE__ Value to be written in the register
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
#define LL_IWDG_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__))
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Read a value in IWDG register
|
|
||||||
* @param __INSTANCE__ IWDG Instance
|
|
||||||
* @param __REG__ Register to be read
|
|
||||||
* @retval Register value
|
|
||||||
*/
|
|
||||||
#define LL_IWDG_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__)
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/* Exported functions --------------------------------------------------------*/
|
|
||||||
/** @defgroup IWDG_LL_Exported_Functions IWDG Exported Functions
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
/** @defgroup IWDG_LL_EF_Configuration Configuration
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Start the Independent Watchdog
|
|
||||||
* @note Except if the hardware watchdog option is selected
|
|
||||||
* @rmtoll KR KEY LL_IWDG_Enable
|
|
||||||
* @param IWDGx IWDG Instance
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
__STATIC_INLINE void LL_IWDG_Enable(IWDG_TypeDef *IWDGx)
|
|
||||||
{
|
|
||||||
WRITE_REG(IWDGx->KR, LL_IWDG_KEY_ENABLE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Reloads IWDG counter with value defined in the reload register
|
|
||||||
* @rmtoll KR KEY LL_IWDG_ReloadCounter
|
|
||||||
* @param IWDGx IWDG Instance
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
__STATIC_INLINE void LL_IWDG_ReloadCounter(IWDG_TypeDef *IWDGx)
|
|
||||||
{
|
|
||||||
WRITE_REG(IWDGx->KR, LL_IWDG_KEY_RELOAD);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Enable write access to IWDG_PR, IWDG_RLR and IWDG_WINR registers
|
|
||||||
* @rmtoll KR KEY LL_IWDG_EnableWriteAccess
|
|
||||||
* @param IWDGx IWDG Instance
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
__STATIC_INLINE void LL_IWDG_EnableWriteAccess(IWDG_TypeDef *IWDGx)
|
|
||||||
{
|
|
||||||
WRITE_REG(IWDGx->KR, LL_IWDG_KEY_WR_ACCESS_ENABLE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Disable write access to IWDG_PR, IWDG_RLR and IWDG_WINR registers
|
|
||||||
* @rmtoll KR KEY LL_IWDG_DisableWriteAccess
|
|
||||||
* @param IWDGx IWDG Instance
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
__STATIC_INLINE void LL_IWDG_DisableWriteAccess(IWDG_TypeDef *IWDGx)
|
|
||||||
{
|
|
||||||
WRITE_REG(IWDGx->KR, LL_IWDG_KEY_WR_ACCESS_DISABLE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Select the prescaler of the IWDG
|
|
||||||
* @rmtoll PR PR LL_IWDG_SetPrescaler
|
|
||||||
* @param IWDGx IWDG Instance
|
|
||||||
* @param Prescaler This parameter can be one of the following values:
|
|
||||||
* @arg @ref LL_IWDG_PRESCALER_4
|
|
||||||
* @arg @ref LL_IWDG_PRESCALER_8
|
|
||||||
* @arg @ref LL_IWDG_PRESCALER_16
|
|
||||||
* @arg @ref LL_IWDG_PRESCALER_32
|
|
||||||
* @arg @ref LL_IWDG_PRESCALER_64
|
|
||||||
* @arg @ref LL_IWDG_PRESCALER_128
|
|
||||||
* @arg @ref LL_IWDG_PRESCALER_256
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
__STATIC_INLINE void LL_IWDG_SetPrescaler(IWDG_TypeDef *IWDGx, uint32_t Prescaler)
|
|
||||||
{
|
|
||||||
WRITE_REG(IWDGx->PR, IWDG_PR_PR & Prescaler);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Get the selected prescaler of the IWDG
|
|
||||||
* @rmtoll PR PR LL_IWDG_GetPrescaler
|
|
||||||
* @param IWDGx IWDG Instance
|
|
||||||
* @retval Returned value can be one of the following values:
|
|
||||||
* @arg @ref LL_IWDG_PRESCALER_4
|
|
||||||
* @arg @ref LL_IWDG_PRESCALER_8
|
|
||||||
* @arg @ref LL_IWDG_PRESCALER_16
|
|
||||||
* @arg @ref LL_IWDG_PRESCALER_32
|
|
||||||
* @arg @ref LL_IWDG_PRESCALER_64
|
|
||||||
* @arg @ref LL_IWDG_PRESCALER_128
|
|
||||||
* @arg @ref LL_IWDG_PRESCALER_256
|
|
||||||
*/
|
|
||||||
__STATIC_INLINE uint32_t LL_IWDG_GetPrescaler(const IWDG_TypeDef *IWDGx)
|
|
||||||
{
|
|
||||||
return (READ_REG(IWDGx->PR));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Specify the IWDG down-counter reload value
|
|
||||||
* @rmtoll RLR RL LL_IWDG_SetReloadCounter
|
|
||||||
* @param IWDGx IWDG Instance
|
|
||||||
* @param Counter Value between Min_Data=0 and Max_Data=0x0FFF
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
__STATIC_INLINE void LL_IWDG_SetReloadCounter(IWDG_TypeDef *IWDGx, uint32_t Counter)
|
|
||||||
{
|
|
||||||
WRITE_REG(IWDGx->RLR, IWDG_RLR_RL & Counter);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Get the specified IWDG down-counter reload value
|
|
||||||
* @rmtoll RLR RL LL_IWDG_GetReloadCounter
|
|
||||||
* @param IWDGx IWDG Instance
|
|
||||||
* @retval Value between Min_Data=0 and Max_Data=0x0FFF
|
|
||||||
*/
|
|
||||||
__STATIC_INLINE uint32_t LL_IWDG_GetReloadCounter(const IWDG_TypeDef *IWDGx)
|
|
||||||
{
|
|
||||||
return (READ_REG(IWDGx->RLR));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Specify high limit of the window value to be compared to the down-counter.
|
|
||||||
* @rmtoll WINR WIN LL_IWDG_SetWindow
|
|
||||||
* @param IWDGx IWDG Instance
|
|
||||||
* @param Window Value between Min_Data=0 and Max_Data=0x0FFF
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
__STATIC_INLINE void LL_IWDG_SetWindow(IWDG_TypeDef *IWDGx, uint32_t Window)
|
|
||||||
{
|
|
||||||
WRITE_REG(IWDGx->WINR, IWDG_WINR_WIN & Window);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Get the high limit of the window value specified.
|
|
||||||
* @rmtoll WINR WIN LL_IWDG_GetWindow
|
|
||||||
* @param IWDGx IWDG Instance
|
|
||||||
* @retval Value between Min_Data=0 and Max_Data=0x0FFF
|
|
||||||
*/
|
|
||||||
__STATIC_INLINE uint32_t LL_IWDG_GetWindow(const IWDG_TypeDef *IWDGx)
|
|
||||||
{
|
|
||||||
return (READ_REG(IWDGx->WINR));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup IWDG_LL_EF_FLAG_Management FLAG_Management
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Check if flag Prescaler Value Update is set or not
|
|
||||||
* @rmtoll SR PVU LL_IWDG_IsActiveFlag_PVU
|
|
||||||
* @param IWDGx IWDG Instance
|
|
||||||
* @retval State of bit (1 or 0).
|
|
||||||
*/
|
|
||||||
__STATIC_INLINE uint32_t LL_IWDG_IsActiveFlag_PVU(const IWDG_TypeDef *IWDGx)
|
|
||||||
{
|
|
||||||
return ((READ_BIT(IWDGx->SR, IWDG_SR_PVU) == (IWDG_SR_PVU)) ? 1UL : 0UL);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Check if flag Reload Value Update is set or not
|
|
||||||
* @rmtoll SR RVU LL_IWDG_IsActiveFlag_RVU
|
|
||||||
* @param IWDGx IWDG Instance
|
|
||||||
* @retval State of bit (1 or 0).
|
|
||||||
*/
|
|
||||||
__STATIC_INLINE uint32_t LL_IWDG_IsActiveFlag_RVU(const IWDG_TypeDef *IWDGx)
|
|
||||||
{
|
|
||||||
return ((READ_BIT(IWDGx->SR, IWDG_SR_RVU) == (IWDG_SR_RVU)) ? 1UL : 0UL);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Check if flag Window Value Update is set or not
|
|
||||||
* @rmtoll SR WVU LL_IWDG_IsActiveFlag_WVU
|
|
||||||
* @param IWDGx IWDG Instance
|
|
||||||
* @retval State of bit (1 or 0).
|
|
||||||
*/
|
|
||||||
__STATIC_INLINE uint32_t LL_IWDG_IsActiveFlag_WVU(const IWDG_TypeDef *IWDGx)
|
|
||||||
{
|
|
||||||
return ((READ_BIT(IWDGx->SR, IWDG_SR_WVU) == (IWDG_SR_WVU)) ? 1UL : 0UL);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Check if all flags Prescaler, Reload & Window Value Update are reset or not
|
|
||||||
* @rmtoll SR PVU LL_IWDG_IsReady\n
|
|
||||||
* SR RVU LL_IWDG_IsReady\n
|
|
||||||
* SR WVU LL_IWDG_IsReady
|
|
||||||
* @param IWDGx IWDG Instance
|
|
||||||
* @retval State of bits (1 or 0).
|
|
||||||
*/
|
|
||||||
__STATIC_INLINE uint32_t LL_IWDG_IsReady(const IWDG_TypeDef *IWDGx)
|
|
||||||
{
|
|
||||||
return ((READ_BIT(IWDGx->SR, IWDG_SR_PVU | IWDG_SR_RVU | IWDG_SR_WVU) == 0U) ? 1UL : 0UL);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
#endif /* IWDG1 || IWDG2 */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* STM32H7xx_LL_IWDG_H */
|
|
||||||
@@ -1,284 +0,0 @@
|
|||||||
/**
|
|
||||||
******************************************************************************
|
|
||||||
* @file stm32h7xx_hal_iwdg.c
|
|
||||||
* @author MCD Application Team
|
|
||||||
* @brief IWDG HAL module driver.
|
|
||||||
* This file provides firmware functions to manage the following
|
|
||||||
* functionalities of the Independent Watchdog (IWDG) peripheral:
|
|
||||||
* + Initialization and Start functions
|
|
||||||
* + IO operation functions
|
|
||||||
*
|
|
||||||
******************************************************************************
|
|
||||||
* @attention
|
|
||||||
*
|
|
||||||
* Copyright (c) 2017 STMicroelectronics.
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* This software is licensed under terms that can be found in the LICENSE file
|
|
||||||
* in the root directory of this software component.
|
|
||||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
|
||||||
*
|
|
||||||
******************************************************************************
|
|
||||||
@verbatim
|
|
||||||
==============================================================================
|
|
||||||
##### IWDG Generic features #####
|
|
||||||
==============================================================================
|
|
||||||
[..]
|
|
||||||
(+) The IWDG can be started by either software or hardware (configurable
|
|
||||||
through option byte).
|
|
||||||
|
|
||||||
(+) The IWDG is clocked by the Low-Speed Internal clock (LSI) and thus stays
|
|
||||||
active even if the main clock fails.
|
|
||||||
|
|
||||||
(+) Once the IWDG is started, the LSI is forced ON and both cannot be
|
|
||||||
disabled. The counter starts counting down from the reset value (0xFFF).
|
|
||||||
When it reaches the end of count value (0x000) a reset signal is
|
|
||||||
generated (IWDG reset).
|
|
||||||
|
|
||||||
(+) Whenever the key value 0x0000 AAAA is written in the IWDG_KR register,
|
|
||||||
the IWDG_RLR value is reloaded into the counter and the watchdog reset
|
|
||||||
is prevented.
|
|
||||||
|
|
||||||
(+) The IWDG is implemented in the VDD voltage domain that is still functional
|
|
||||||
in STOP and STANDBY mode (IWDG reset can wake up the CPU from STANDBY).
|
|
||||||
IWDGRST flag in RCC_CSR register can be used to inform when an IWDG
|
|
||||||
reset occurs.
|
|
||||||
|
|
||||||
(+) Debug mode: When the microcontroller enters debug mode (core halted),
|
|
||||||
the IWDG counter either continues to work normally or stops, depending
|
|
||||||
on DBG_IWDG_STOP configuration bit in DBG module, accessible through
|
|
||||||
__HAL_DBGMCU_FREEZE_IWDG1() or __HAL_DBGMCU_FREEZE2_IWDG2() and
|
|
||||||
__HAL_DBGMCU_UnFreeze_IWDG1 or __HAL_DBGMCU_UnFreeze2_IWDG2() macros.
|
|
||||||
|
|
||||||
[..] Min-max timeout value @32KHz (LSI): ~125us / ~32.7s
|
|
||||||
The IWDG timeout may vary due to LSI clock frequency dispersion.
|
|
||||||
STM32H7xx devices provide the capability to measure the LSI clock
|
|
||||||
frequency (LSI clock is internally connected to TIM16 CH1 input capture).
|
|
||||||
The measured value can be used to have an IWDG timeout with an
|
|
||||||
acceptable accuracy.
|
|
||||||
|
|
||||||
[..] Default timeout value (necessary for IWDG_SR status register update):
|
|
||||||
Constant LSI_VALUE is defined based on the nominal LSI clock frequency.
|
|
||||||
This frequency being subject to variations as mentioned above, the
|
|
||||||
default timeout value (defined through constant HAL_IWDG_DEFAULT_TIMEOUT
|
|
||||||
below) may become too short or too long.
|
|
||||||
In such cases, this default timeout value can be tuned by redefining
|
|
||||||
the constant LSI_VALUE at user-application level (based, for instance,
|
|
||||||
on the measured LSI clock frequency as explained above).
|
|
||||||
|
|
||||||
##### How to use this driver #####
|
|
||||||
==============================================================================
|
|
||||||
[..]
|
|
||||||
(#) Use IWDG using HAL_IWDG_Init() function to :
|
|
||||||
(++) Enable instance by writing Start keyword in IWDG_KEY register. LSI
|
|
||||||
clock is forced ON and IWDG counter starts counting down.
|
|
||||||
(++) Enable write access to configuration registers:
|
|
||||||
IWDG_PR, IWDG_RLR and IWDG_WINR.
|
|
||||||
(++) Configure the IWDG prescaler and counter reload value. This reload
|
|
||||||
value will be loaded in the IWDG counter each time the watchdog is
|
|
||||||
reloaded, then the IWDG will start counting down from this value.
|
|
||||||
(++) Depending on window parameter:
|
|
||||||
(+++) If Window Init parameter is same as Window register value,
|
|
||||||
nothing more is done but reload counter value in order to exit
|
|
||||||
function with exact time base.
|
|
||||||
(+++) Else modify Window register. This will automatically reload
|
|
||||||
watchdog counter.
|
|
||||||
(++) Wait for status flags to be reset.
|
|
||||||
|
|
||||||
(#) Then the application program must refresh the IWDG counter at regular
|
|
||||||
intervals during normal operation to prevent an MCU reset, using
|
|
||||||
HAL_IWDG_Refresh() function.
|
|
||||||
|
|
||||||
*** IWDG HAL driver macros list ***
|
|
||||||
====================================
|
|
||||||
[..]
|
|
||||||
Below the list of most used macros in IWDG HAL driver:
|
|
||||||
(+) __HAL_IWDG_START: Enable the IWDG peripheral
|
|
||||||
(+) __HAL_IWDG_RELOAD_COUNTER: Reloads IWDG counter with value defined in
|
|
||||||
the reload register
|
|
||||||
|
|
||||||
@endverbatim
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Includes ------------------------------------------------------------------*/
|
|
||||||
#include "stm32h7xx_hal.h"
|
|
||||||
|
|
||||||
/** @addtogroup STM32H7xx_HAL_Driver
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef HAL_IWDG_MODULE_ENABLED
|
|
||||||
/** @addtogroup IWDG
|
|
||||||
* @brief IWDG HAL module driver.
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Private typedef -----------------------------------------------------------*/
|
|
||||||
/* Private define ------------------------------------------------------------*/
|
|
||||||
/** @defgroup IWDG_Private_Defines IWDG Private Defines
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
/* Status register needs up to 5 LSI clock periods divided by the clock
|
|
||||||
prescaler to be updated. The number of LSI clock periods is upper-rounded to
|
|
||||||
6 for the timeout value calculation.
|
|
||||||
The timeout value is calculated using the highest prescaler (256) and
|
|
||||||
the LSI_VALUE constant. The value of this constant can be changed by the user
|
|
||||||
to take into account possible LSI clock period variations.
|
|
||||||
The timeout value is multiplied by 1000 to be converted in milliseconds.
|
|
||||||
LSI startup time is also considered here by adding LSI_STARTUP_TIME
|
|
||||||
converted in milliseconds. */
|
|
||||||
#define HAL_IWDG_DEFAULT_TIMEOUT (((6UL * 256UL * 1000UL) / (LSI_VALUE / 128U)) + \
|
|
||||||
((LSI_STARTUP_TIME / 1000UL) + 1UL))
|
|
||||||
#define IWDG_KERNEL_UPDATE_FLAGS (IWDG_SR_WVU | IWDG_SR_RVU | IWDG_SR_PVU)
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Private macro -------------------------------------------------------------*/
|
|
||||||
/* Private variables ---------------------------------------------------------*/
|
|
||||||
/* Private function prototypes -----------------------------------------------*/
|
|
||||||
/* Exported functions --------------------------------------------------------*/
|
|
||||||
|
|
||||||
/** @addtogroup IWDG_Exported_Functions
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @addtogroup IWDG_Exported_Functions_Group1
|
|
||||||
* @brief Initialization and Start functions.
|
|
||||||
*
|
|
||||||
@verbatim
|
|
||||||
===============================================================================
|
|
||||||
##### Initialization and Start functions #####
|
|
||||||
===============================================================================
|
|
||||||
[..] This section provides functions allowing to:
|
|
||||||
(+) Initialize the IWDG according to the specified parameters in the
|
|
||||||
IWDG_InitTypeDef of associated handle.
|
|
||||||
(+) Manage Window option.
|
|
||||||
(+) Once initialization is performed in HAL_IWDG_Init function, Watchdog
|
|
||||||
is reloaded in order to exit function with correct time base.
|
|
||||||
|
|
||||||
@endverbatim
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Initialize the IWDG according to the specified parameters in the
|
|
||||||
* IWDG_InitTypeDef and start watchdog. Before exiting function,
|
|
||||||
* watchdog is refreshed in order to have correct time base.
|
|
||||||
* @param hiwdg pointer to a IWDG_HandleTypeDef structure that contains
|
|
||||||
* the configuration information for the specified IWDG module.
|
|
||||||
* @retval HAL status
|
|
||||||
*/
|
|
||||||
HAL_StatusTypeDef HAL_IWDG_Init(IWDG_HandleTypeDef *hiwdg)
|
|
||||||
{
|
|
||||||
uint32_t tickstart;
|
|
||||||
|
|
||||||
/* Check the IWDG handle allocation */
|
|
||||||
if (hiwdg == NULL)
|
|
||||||
{
|
|
||||||
return HAL_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Check the parameters */
|
|
||||||
assert_param(IS_IWDG_ALL_INSTANCE(hiwdg->Instance));
|
|
||||||
assert_param(IS_IWDG_PRESCALER(hiwdg->Init.Prescaler));
|
|
||||||
assert_param(IS_IWDG_RELOAD(hiwdg->Init.Reload));
|
|
||||||
assert_param(IS_IWDG_WINDOW(hiwdg->Init.Window));
|
|
||||||
|
|
||||||
/* Enable IWDG. LSI is turned on automatically */
|
|
||||||
__HAL_IWDG_START(hiwdg);
|
|
||||||
|
|
||||||
/* Enable write access to IWDG_PR, IWDG_RLR and IWDG_WINR registers by writing
|
|
||||||
0x5555 in KR */
|
|
||||||
IWDG_ENABLE_WRITE_ACCESS(hiwdg);
|
|
||||||
|
|
||||||
/* Write to IWDG registers the Prescaler & Reload values to work with */
|
|
||||||
hiwdg->Instance->PR = hiwdg->Init.Prescaler;
|
|
||||||
hiwdg->Instance->RLR = hiwdg->Init.Reload;
|
|
||||||
|
|
||||||
/* Check pending flag, if previous update not done, return timeout */
|
|
||||||
tickstart = HAL_GetTick();
|
|
||||||
|
|
||||||
/* Wait for register to be updated */
|
|
||||||
while ((hiwdg->Instance->SR & IWDG_KERNEL_UPDATE_FLAGS) != 0x00u)
|
|
||||||
{
|
|
||||||
if ((HAL_GetTick() - tickstart) > HAL_IWDG_DEFAULT_TIMEOUT)
|
|
||||||
{
|
|
||||||
if ((hiwdg->Instance->SR & IWDG_KERNEL_UPDATE_FLAGS) != 0x00u)
|
|
||||||
{
|
|
||||||
return HAL_TIMEOUT;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* If window parameter is different than current value, modify window
|
|
||||||
register */
|
|
||||||
if (hiwdg->Instance->WINR != hiwdg->Init.Window)
|
|
||||||
{
|
|
||||||
/* Write to IWDG WINR the IWDG_Window value to compare with. In any case,
|
|
||||||
even if window feature is disabled, Watchdog will be reloaded by writing
|
|
||||||
windows register */
|
|
||||||
hiwdg->Instance->WINR = hiwdg->Init.Window;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* Reload IWDG counter with value defined in the reload register */
|
|
||||||
__HAL_IWDG_RELOAD_COUNTER(hiwdg);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Return function status */
|
|
||||||
return HAL_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/** @addtogroup IWDG_Exported_Functions_Group2
|
|
||||||
* @brief IO operation functions
|
|
||||||
*
|
|
||||||
@verbatim
|
|
||||||
===============================================================================
|
|
||||||
##### IO operation functions #####
|
|
||||||
===============================================================================
|
|
||||||
[..] This section provides functions allowing to:
|
|
||||||
(+) Refresh the IWDG.
|
|
||||||
|
|
||||||
@endverbatim
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Refresh the IWDG.
|
|
||||||
* @param hiwdg pointer to a IWDG_HandleTypeDef structure that contains
|
|
||||||
* the configuration information for the specified IWDG module.
|
|
||||||
* @retval HAL status
|
|
||||||
*/
|
|
||||||
HAL_StatusTypeDef HAL_IWDG_Refresh(IWDG_HandleTypeDef *hiwdg)
|
|
||||||
{
|
|
||||||
/* Reload IWDG counter with value defined in the reload register */
|
|
||||||
__HAL_IWDG_RELOAD_COUNTER(hiwdg);
|
|
||||||
|
|
||||||
/* Return function status */
|
|
||||||
return HAL_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
#endif /* HAL_IWDG_MODULE_ENABLED */
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
201
LICENSE
Normal file
201
LICENSE
Normal file
@@ -0,0 +1,201 @@
|
|||||||
|
Apache License
|
||||||
|
Version 2.0, January 2004
|
||||||
|
http://www.apache.org/licenses/
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||||
|
|
||||||
|
1. Definitions.
|
||||||
|
|
||||||
|
"License" shall mean the terms and conditions for use, reproduction,
|
||||||
|
and distribution as defined by Sections 1 through 9 of this document.
|
||||||
|
|
||||||
|
"Licensor" shall mean the copyright owner or entity authorized by
|
||||||
|
the copyright owner that is granting the License.
|
||||||
|
|
||||||
|
"Legal Entity" shall mean the union of the acting entity and all
|
||||||
|
other entities that control, are controlled by, or are under common
|
||||||
|
control with that entity. For the purposes of this definition,
|
||||||
|
"control" means (i) the power, direct or indirect, to cause the
|
||||||
|
direction or management of such entity, whether by contract or
|
||||||
|
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||||
|
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||||
|
|
||||||
|
"You" (or "Your") shall mean an individual or Legal Entity
|
||||||
|
exercising permissions granted by this License.
|
||||||
|
|
||||||
|
"Source" form shall mean the preferred form for making modifications,
|
||||||
|
including but not limited to software source code, documentation
|
||||||
|
source, and configuration files.
|
||||||
|
|
||||||
|
"Object" form shall mean any form resulting from mechanical
|
||||||
|
transformation or translation of a Source form, including but
|
||||||
|
not limited to compiled object code, generated documentation,
|
||||||
|
and conversions to other media types.
|
||||||
|
|
||||||
|
"Work" shall mean the work of authorship, whether in Source or
|
||||||
|
Object form, made available under the License, as indicated by a
|
||||||
|
copyright notice that is included in or attached to the work
|
||||||
|
(an example is provided in the Appendix below).
|
||||||
|
|
||||||
|
"Derivative Works" shall mean any work, whether in Source or Object
|
||||||
|
form, that is based on (or derived from) the Work and for which the
|
||||||
|
editorial revisions, annotations, elaborations, or other modifications
|
||||||
|
represent, as a whole, an original work of authorship. For the purposes
|
||||||
|
of this License, Derivative Works shall not include works that remain
|
||||||
|
separable from, or merely link (or bind by name) to the interfaces of,
|
||||||
|
the Work and Derivative Works thereof.
|
||||||
|
|
||||||
|
"Contribution" shall mean any work of authorship, including
|
||||||
|
the original version of the Work and any modifications or additions
|
||||||
|
to that Work or Derivative Works thereof, that is intentionally
|
||||||
|
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||||
|
or by an individual or Legal Entity authorized to submit on behalf of
|
||||||
|
the copyright owner. For the purposes of this definition, "submitted"
|
||||||
|
means any form of electronic, verbal, or written communication sent
|
||||||
|
to the Licensor or its representatives, including but not limited to
|
||||||
|
communication on electronic mailing lists, source code control systems,
|
||||||
|
and issue tracking systems that are managed by, or on behalf of, the
|
||||||
|
Licensor for the purpose of discussing and improving the Work, but
|
||||||
|
excluding communication that is conspicuously marked or otherwise
|
||||||
|
designated in writing by the copyright owner as "Not a Contribution."
|
||||||
|
|
||||||
|
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||||
|
on behalf of whom a Contribution has been received by Licensor and
|
||||||
|
subsequently incorporated within the Work.
|
||||||
|
|
||||||
|
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
copyright license to reproduce, prepare Derivative Works of,
|
||||||
|
publicly display, publicly perform, sublicense, and distribute the
|
||||||
|
Work and such Derivative Works in Source or Object form.
|
||||||
|
|
||||||
|
3. Grant of Patent License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
(except as stated in this section) patent license to make, have made,
|
||||||
|
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||||
|
where such license applies only to those patent claims licensable
|
||||||
|
by such Contributor that are necessarily infringed by their
|
||||||
|
Contribution(s) alone or by combination of their Contribution(s)
|
||||||
|
with the Work to which such Contribution(s) was submitted. If You
|
||||||
|
institute patent litigation against any entity (including a
|
||||||
|
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||||
|
or a Contribution incorporated within the Work constitutes direct
|
||||||
|
or contributory patent infringement, then any patent licenses
|
||||||
|
granted to You under this License for that Work shall terminate
|
||||||
|
as of the date such litigation is filed.
|
||||||
|
|
||||||
|
4. Redistribution. You may reproduce and distribute copies of the
|
||||||
|
Work or Derivative Works thereof in any medium, with or without
|
||||||
|
modifications, and in Source or Object form, provided that You
|
||||||
|
meet the following conditions:
|
||||||
|
|
||||||
|
(a) You must give any other recipients of the Work or
|
||||||
|
Derivative Works a copy of this License; and
|
||||||
|
|
||||||
|
(b) You must cause any modified files to carry prominent notices
|
||||||
|
stating that You changed the files; and
|
||||||
|
|
||||||
|
(c) You must retain, in the Source form of any Derivative Works
|
||||||
|
that You distribute, all copyright, patent, trademark, and
|
||||||
|
attribution notices from the Source form of the Work,
|
||||||
|
excluding those notices that do not pertain to any part of
|
||||||
|
the Derivative Works; and
|
||||||
|
|
||||||
|
(d) If the Work includes a "NOTICE" text file as part of its
|
||||||
|
distribution, then any Derivative Works that You distribute must
|
||||||
|
include a readable copy of the attribution notices contained
|
||||||
|
within such NOTICE file, excluding those notices that do not
|
||||||
|
pertain to any part of the Derivative Works, in at least one
|
||||||
|
of the following places: within a NOTICE text file distributed
|
||||||
|
as part of the Derivative Works; within the Source form or
|
||||||
|
documentation, if provided along with the Derivative Works; or,
|
||||||
|
within a display generated by the Derivative Works, if and
|
||||||
|
wherever such third-party notices normally appear. The contents
|
||||||
|
of the NOTICE file are for informational purposes only and
|
||||||
|
do not modify the License. You may add Your own attribution
|
||||||
|
notices within Derivative Works that You distribute, alongside
|
||||||
|
or as an addendum to the NOTICE text from the Work, provided
|
||||||
|
that such additional attribution notices cannot be construed
|
||||||
|
as modifying the License.
|
||||||
|
|
||||||
|
You may add Your own copyright statement to Your modifications and
|
||||||
|
may provide additional or different license terms and conditions
|
||||||
|
for use, reproduction, or distribution of Your modifications, or
|
||||||
|
for any such Derivative Works as a whole, provided Your use,
|
||||||
|
reproduction, and distribution of the Work otherwise complies with
|
||||||
|
the conditions stated in this License.
|
||||||
|
|
||||||
|
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||||
|
any Contribution intentionally submitted for inclusion in the Work
|
||||||
|
by You to the Licensor shall be under the terms and conditions of
|
||||||
|
this License, without any additional terms or conditions.
|
||||||
|
Notwithstanding the above, nothing herein shall supersede or modify
|
||||||
|
the terms of any separate license agreement you may have executed
|
||||||
|
with Licensor regarding such Contributions.
|
||||||
|
|
||||||
|
6. Trademarks. This License does not grant permission to use the trade
|
||||||
|
names, trademarks, service marks, or product names of the Licensor,
|
||||||
|
except as required for reasonable and customary use in describing the
|
||||||
|
origin of the Work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||||
|
agreed to in writing, Licensor provides the Work (and each
|
||||||
|
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
implied, including, without limitation, any warranties or conditions
|
||||||
|
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||||
|
appropriateness of using or redistributing the Work and assume any
|
||||||
|
risks associated with Your exercise of permissions under this License.
|
||||||
|
|
||||||
|
8. Limitation of Liability. In no event and under no legal theory,
|
||||||
|
whether in tort (including negligence), contract, or otherwise,
|
||||||
|
unless required by applicable law (such as deliberate and grossly
|
||||||
|
negligent acts) or agreed to in writing, shall any Contributor be
|
||||||
|
liable to You for damages, including any direct, indirect, special,
|
||||||
|
incidental, or consequential damages of any character arising as a
|
||||||
|
result of this License or out of the use or inability to use the
|
||||||
|
Work (including but not limited to damages for loss of goodwill,
|
||||||
|
work stoppage, computer failure or malfunction, or any and all
|
||||||
|
other commercial damages or losses), even if such Contributor
|
||||||
|
has been advised of the possibility of such damages.
|
||||||
|
|
||||||
|
9. Accepting Warranty or Additional Liability. While redistributing
|
||||||
|
the Work or Derivative Works thereof, You may choose to offer,
|
||||||
|
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||||
|
or other liability obligations and/or rights consistent with this
|
||||||
|
License. However, in accepting such obligations, You may act only
|
||||||
|
on Your own behalf and on Your sole responsibility, not on behalf
|
||||||
|
of any other Contributor, and only if You agree to indemnify,
|
||||||
|
defend, and hold each Contributor harmless for any liability
|
||||||
|
incurred by, or claims asserted against, such Contributor by reason
|
||||||
|
of your accepting any such warranty or additional liability.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
APPENDIX: How to apply the Apache License to your work.
|
||||||
|
|
||||||
|
To apply the Apache License to your work, attach the following
|
||||||
|
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||||
|
replaced with your own identifying information. (Don't include
|
||||||
|
the brackets!) The text should be enclosed in the appropriate
|
||||||
|
comment syntax for the file format. We also recommend that a
|
||||||
|
file or class name and description of purpose be included on the
|
||||||
|
same "printed page" as the copyright notice for easier
|
||||||
|
identification within third-party archives.
|
||||||
|
|
||||||
|
Copyright [yyyy] [name of copyright owner]
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
212
MY_FLASH.ld
Normal file
212
MY_FLASH.ld
Normal file
@@ -0,0 +1,212 @@
|
|||||||
|
/*
|
||||||
|
******************************************************************************
|
||||||
|
**
|
||||||
|
|
||||||
|
** File : LinkerScript.ld
|
||||||
|
**
|
||||||
|
** Author : STM32CubeMX
|
||||||
|
**
|
||||||
|
** Abstract : Linker script for STM32H723VGTx series
|
||||||
|
** 1024Kbytes FLASH and 368Kbytes RAM
|
||||||
|
**
|
||||||
|
** Set heap size, stack size and stack location according
|
||||||
|
** to application requirements.
|
||||||
|
**
|
||||||
|
** Set memory bank area and size if external memory is used.
|
||||||
|
**
|
||||||
|
** Target : STMicroelectronics STM32
|
||||||
|
**
|
||||||
|
** Distribution: The file is distributed “as is,” without any warranty
|
||||||
|
** of any kind.
|
||||||
|
**
|
||||||
|
*****************************************************************************
|
||||||
|
** @attention
|
||||||
|
**
|
||||||
|
** <h2><center>© COPYRIGHT(c) 2019 STMicroelectronics</center></h2>
|
||||||
|
**
|
||||||
|
** Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
** are permitted provided that the following conditions are met:
|
||||||
|
** 1. Redistributions of source code must retain the above copyright notice,
|
||||||
|
** this list of conditions and the following disclaimer.
|
||||||
|
** 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
** this list of conditions and the following disclaimer in the documentation
|
||||||
|
** and/or other materials provided with the distribution.
|
||||||
|
** 3. Neither the name of STMicroelectronics nor the names of its contributors
|
||||||
|
** may be used to endorse or promote products derived from this software
|
||||||
|
** without specific prior written permission.
|
||||||
|
**
|
||||||
|
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||||
|
** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
** SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||||
|
** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
** OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
**
|
||||||
|
*****************************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Entry Point */
|
||||||
|
ENTRY(Reset_Handler)
|
||||||
|
|
||||||
|
/* Highest address of the user mode stack */
|
||||||
|
_estack = ORIGIN(DTCMRAM) + LENGTH(DTCMRAM); /* end of RAM */
|
||||||
|
/* Generate a link error if heap and stack don't fit into RAM */
|
||||||
|
_Min_Heap_Size = 0x5000; /* required amount of heap */
|
||||||
|
_Min_Stack_Size = 0x5000; /* required amount of stack */
|
||||||
|
|
||||||
|
/* Specify the memory areas */
|
||||||
|
MEMORY
|
||||||
|
{
|
||||||
|
ITCMRAM (xrw) : ORIGIN = 0x00000008, LENGTH = 64K
|
||||||
|
DTCMRAM (xrw) : ORIGIN = 0x20000400, LENGTH = 128K
|
||||||
|
RAM (xrw) : ORIGIN = 0x24000000, LENGTH = 128K
|
||||||
|
RAM_D2 (xrw) : ORIGIN = 0x30000000, LENGTH = 32K
|
||||||
|
RAM_D3 (xrw) : ORIGIN = 0x38000000, LENGTH = 16K
|
||||||
|
FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 1024K
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Define output sections */
|
||||||
|
SECTIONS
|
||||||
|
{
|
||||||
|
/* The startup code goes first into FLASH */
|
||||||
|
.isr_vector :
|
||||||
|
{
|
||||||
|
. = ALIGN(4);
|
||||||
|
KEEP(*(.isr_vector)) /* Startup code */
|
||||||
|
. = ALIGN(4);
|
||||||
|
} >FLASH
|
||||||
|
|
||||||
|
.ITCM :
|
||||||
|
{
|
||||||
|
. = ALIGN(4);
|
||||||
|
__itcm_start = .;
|
||||||
|
*(.ITCM)
|
||||||
|
. = ALIGN(4);
|
||||||
|
__itcm_end = .;
|
||||||
|
} > ITCMRAM AT>FLASH
|
||||||
|
__itcm_rom_start = LOADADDR(.ITCM);
|
||||||
|
__itcm_size = SIZEOF(.ITCM);
|
||||||
|
|
||||||
|
/* The program code and other data goes into FLASH */
|
||||||
|
.text :
|
||||||
|
{
|
||||||
|
_stext = .; /* create a global symbol at text start */
|
||||||
|
. = ALIGN(4);
|
||||||
|
*(.text) /* .text sections (code) */
|
||||||
|
*(.text*) /* .text* sections (code) */
|
||||||
|
*(.glue_7) /* glue arm to thumb code */
|
||||||
|
*(.glue_7t) /* glue thumb to arm code */
|
||||||
|
*(.eh_frame)
|
||||||
|
|
||||||
|
KEEP (*(.init))
|
||||||
|
KEEP (*(.fini))
|
||||||
|
|
||||||
|
. = ALIGN(4);
|
||||||
|
_etext = .; /* define a global symbols at end of code */
|
||||||
|
} >FLASH
|
||||||
|
|
||||||
|
/* Constant data goes into FLASH */
|
||||||
|
.rodata :
|
||||||
|
{
|
||||||
|
. = ALIGN(4);
|
||||||
|
*(.rodata) /* .rodata sections (constants, strings, etc.) */
|
||||||
|
*(.rodata*) /* .rodata* sections (constants, strings, etc.) */
|
||||||
|
. = ALIGN(4);
|
||||||
|
} >FLASH
|
||||||
|
|
||||||
|
.ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
|
||||||
|
.ARM : {
|
||||||
|
__exidx_start = .;
|
||||||
|
*(.ARM.exidx*)
|
||||||
|
__exidx_end = .;
|
||||||
|
} >FLASH
|
||||||
|
|
||||||
|
.preinit_array :
|
||||||
|
{
|
||||||
|
PROVIDE_HIDDEN (__preinit_array_start = .);
|
||||||
|
KEEP (*(.preinit_array*))
|
||||||
|
PROVIDE_HIDDEN (__preinit_array_end = .);
|
||||||
|
} >FLASH
|
||||||
|
.init_array :
|
||||||
|
{
|
||||||
|
PROVIDE_HIDDEN (__init_array_start = .);
|
||||||
|
KEEP (*(SORT(.init_array.*)))
|
||||||
|
KEEP (*(.init_array*))
|
||||||
|
PROVIDE_HIDDEN (__init_array_end = .);
|
||||||
|
} >FLASH
|
||||||
|
.fini_array :
|
||||||
|
{
|
||||||
|
PROVIDE_HIDDEN (__fini_array_start = .);
|
||||||
|
KEEP (*(SORT(.fini_array.*)))
|
||||||
|
KEEP (*(.fini_array*))
|
||||||
|
PROVIDE_HIDDEN (__fini_array_end = .);
|
||||||
|
} >FLASH
|
||||||
|
|
||||||
|
/* used by the startup to initialize data */
|
||||||
|
_sidata = LOADADDR(.data);
|
||||||
|
|
||||||
|
/* Initialized data sections goes into RAM, load LMA copy after code */
|
||||||
|
.data :
|
||||||
|
{
|
||||||
|
. = ALIGN(4);
|
||||||
|
_sdata = .; /* create a global symbol at data start */
|
||||||
|
*(.data) /* .data sections */
|
||||||
|
*(.data*) /* .data* sections */
|
||||||
|
|
||||||
|
. = ALIGN(4);
|
||||||
|
_edata = .; /* define a global symbol at data end */
|
||||||
|
} >DTCMRAM AT> FLASH
|
||||||
|
|
||||||
|
|
||||||
|
/* Uninitialized data section */
|
||||||
|
. = ALIGN(4);
|
||||||
|
.bss :
|
||||||
|
{
|
||||||
|
/* This is used by the startup in order to initialize the .bss secion */
|
||||||
|
_sbss = .; /* define a global symbol at bss start */
|
||||||
|
__bss_start__ = _sbss;
|
||||||
|
*(.bss)
|
||||||
|
*(.bss*)
|
||||||
|
*(COMMON)
|
||||||
|
|
||||||
|
. = ALIGN(4);
|
||||||
|
_ebss = .; /* define a global symbol at bss end */
|
||||||
|
__bss_end__ = _ebss;
|
||||||
|
} >DTCMRAM
|
||||||
|
|
||||||
|
/* User_heap_stack section, used to check that there is enough RAM left */
|
||||||
|
._user_heap_stack :
|
||||||
|
{
|
||||||
|
. = ALIGN(8);
|
||||||
|
_sstack = .;
|
||||||
|
PROVIDE ( end = . );
|
||||||
|
PROVIDE ( _end = . );
|
||||||
|
. = . + _Min_Heap_Size;
|
||||||
|
. = . + _Min_Stack_Size;
|
||||||
|
. = ALIGN(8);
|
||||||
|
_estack = .;
|
||||||
|
} >DTCMRAM
|
||||||
|
|
||||||
|
/*在RAM_D1中开辟DMA缓存区域*/
|
||||||
|
._DMA_RAM :
|
||||||
|
{
|
||||||
|
. = ALIGN(4);
|
||||||
|
*(_DMA_RAM)
|
||||||
|
. = ALIGN(4);
|
||||||
|
} >RAM
|
||||||
|
|
||||||
|
/* Remove information from the standard libraries */
|
||||||
|
/DISCARD/ :
|
||||||
|
{
|
||||||
|
libc.a ( * )
|
||||||
|
libm.a ( * )
|
||||||
|
libgcc.a ( * )
|
||||||
|
}
|
||||||
|
|
||||||
|
.ARM.attributes 0 : { *(.ARM.attributes) }
|
||||||
|
}
|
||||||
|
|
||||||
8970
Middlewares/ST/ARM/DSP/Inc/arm_math.h
Normal file
8970
Middlewares/ST/ARM/DSP/Inc/arm_math.h
Normal file
File diff suppressed because it is too large
Load Diff
201
Middlewares/Third_Party/ARM/DSP/LICENSE.txt
vendored
Normal file
201
Middlewares/Third_Party/ARM/DSP/LICENSE.txt
vendored
Normal file
@@ -0,0 +1,201 @@
|
|||||||
|
Apache License
|
||||||
|
Version 2.0, January 2004
|
||||||
|
http://www.apache.org/licenses/
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||||
|
|
||||||
|
1. Definitions.
|
||||||
|
|
||||||
|
"License" shall mean the terms and conditions for use, reproduction,
|
||||||
|
and distribution as defined by Sections 1 through 9 of this document.
|
||||||
|
|
||||||
|
"Licensor" shall mean the copyright owner or entity authorized by
|
||||||
|
the copyright owner that is granting the License.
|
||||||
|
|
||||||
|
"Legal Entity" shall mean the union of the acting entity and all
|
||||||
|
other entities that control, are controlled by, or are under common
|
||||||
|
control with that entity. For the purposes of this definition,
|
||||||
|
"control" means (i) the power, direct or indirect, to cause the
|
||||||
|
direction or management of such entity, whether by contract or
|
||||||
|
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||||
|
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||||
|
|
||||||
|
"You" (or "Your") shall mean an individual or Legal Entity
|
||||||
|
exercising permissions granted by this License.
|
||||||
|
|
||||||
|
"Source" form shall mean the preferred form for making modifications,
|
||||||
|
including but not limited to software source code, documentation
|
||||||
|
source, and configuration files.
|
||||||
|
|
||||||
|
"Object" form shall mean any form resulting from mechanical
|
||||||
|
transformation or translation of a Source form, including but
|
||||||
|
not limited to compiled object code, generated documentation,
|
||||||
|
and conversions to other media types.
|
||||||
|
|
||||||
|
"Work" shall mean the work of authorship, whether in Source or
|
||||||
|
Object form, made available under the License, as indicated by a
|
||||||
|
copyright notice that is included in or attached to the work
|
||||||
|
(an example is provided in the Appendix below).
|
||||||
|
|
||||||
|
"Derivative Works" shall mean any work, whether in Source or Object
|
||||||
|
form, that is based on (or derived from) the Work and for which the
|
||||||
|
editorial revisions, annotations, elaborations, or other modifications
|
||||||
|
represent, as a whole, an original work of authorship. For the purposes
|
||||||
|
of this License, Derivative Works shall not include works that remain
|
||||||
|
separable from, or merely link (or bind by name) to the interfaces of,
|
||||||
|
the Work and Derivative Works thereof.
|
||||||
|
|
||||||
|
"Contribution" shall mean any work of authorship, including
|
||||||
|
the original version of the Work and any modifications or additions
|
||||||
|
to that Work or Derivative Works thereof, that is intentionally
|
||||||
|
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||||
|
or by an individual or Legal Entity authorized to submit on behalf of
|
||||||
|
the copyright owner. For the purposes of this definition, "submitted"
|
||||||
|
means any form of electronic, verbal, or written communication sent
|
||||||
|
to the Licensor or its representatives, including but not limited to
|
||||||
|
communication on electronic mailing lists, source code control systems,
|
||||||
|
and issue tracking systems that are managed by, or on behalf of, the
|
||||||
|
Licensor for the purpose of discussing and improving the Work, but
|
||||||
|
excluding communication that is conspicuously marked or otherwise
|
||||||
|
designated in writing by the copyright owner as "Not a Contribution."
|
||||||
|
|
||||||
|
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||||
|
on behalf of whom a Contribution has been received by Licensor and
|
||||||
|
subsequently incorporated within the Work.
|
||||||
|
|
||||||
|
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
copyright license to reproduce, prepare Derivative Works of,
|
||||||
|
publicly display, publicly perform, sublicense, and distribute the
|
||||||
|
Work and such Derivative Works in Source or Object form.
|
||||||
|
|
||||||
|
3. Grant of Patent License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
(except as stated in this section) patent license to make, have made,
|
||||||
|
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||||
|
where such license applies only to those patent claims licensable
|
||||||
|
by such Contributor that are necessarily infringed by their
|
||||||
|
Contribution(s) alone or by combination of their Contribution(s)
|
||||||
|
with the Work to which such Contribution(s) was submitted. If You
|
||||||
|
institute patent litigation against any entity (including a
|
||||||
|
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||||
|
or a Contribution incorporated within the Work constitutes direct
|
||||||
|
or contributory patent infringement, then any patent licenses
|
||||||
|
granted to You under this License for that Work shall terminate
|
||||||
|
as of the date such litigation is filed.
|
||||||
|
|
||||||
|
4. Redistribution. You may reproduce and distribute copies of the
|
||||||
|
Work or Derivative Works thereof in any medium, with or without
|
||||||
|
modifications, and in Source or Object form, provided that You
|
||||||
|
meet the following conditions:
|
||||||
|
|
||||||
|
(a) You must give any other recipients of the Work or
|
||||||
|
Derivative Works a copy of this License; and
|
||||||
|
|
||||||
|
(b) You must cause any modified files to carry prominent notices
|
||||||
|
stating that You changed the files; and
|
||||||
|
|
||||||
|
(c) You must retain, in the Source form of any Derivative Works
|
||||||
|
that You distribute, all copyright, patent, trademark, and
|
||||||
|
attribution notices from the Source form of the Work,
|
||||||
|
excluding those notices that do not pertain to any part of
|
||||||
|
the Derivative Works; and
|
||||||
|
|
||||||
|
(d) If the Work includes a "NOTICE" text file as part of its
|
||||||
|
distribution, then any Derivative Works that You distribute must
|
||||||
|
include a readable copy of the attribution notices contained
|
||||||
|
within such NOTICE file, excluding those notices that do not
|
||||||
|
pertain to any part of the Derivative Works, in at least one
|
||||||
|
of the following places: within a NOTICE text file distributed
|
||||||
|
as part of the Derivative Works; within the Source form or
|
||||||
|
documentation, if provided along with the Derivative Works; or,
|
||||||
|
within a display generated by the Derivative Works, if and
|
||||||
|
wherever such third-party notices normally appear. The contents
|
||||||
|
of the NOTICE file are for informational purposes only and
|
||||||
|
do not modify the License. You may add Your own attribution
|
||||||
|
notices within Derivative Works that You distribute, alongside
|
||||||
|
or as an addendum to the NOTICE text from the Work, provided
|
||||||
|
that such additional attribution notices cannot be construed
|
||||||
|
as modifying the License.
|
||||||
|
|
||||||
|
You may add Your own copyright statement to Your modifications and
|
||||||
|
may provide additional or different license terms and conditions
|
||||||
|
for use, reproduction, or distribution of Your modifications, or
|
||||||
|
for any such Derivative Works as a whole, provided Your use,
|
||||||
|
reproduction, and distribution of the Work otherwise complies with
|
||||||
|
the conditions stated in this License.
|
||||||
|
|
||||||
|
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||||
|
any Contribution intentionally submitted for inclusion in the Work
|
||||||
|
by You to the Licensor shall be under the terms and conditions of
|
||||||
|
this License, without any additional terms or conditions.
|
||||||
|
Notwithstanding the above, nothing herein shall supersede or modify
|
||||||
|
the terms of any separate license agreement you may have executed
|
||||||
|
with Licensor regarding such Contributions.
|
||||||
|
|
||||||
|
6. Trademarks. This License does not grant permission to use the trade
|
||||||
|
names, trademarks, service marks, or product names of the Licensor,
|
||||||
|
except as required for reasonable and customary use in describing the
|
||||||
|
origin of the Work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||||
|
agreed to in writing, Licensor provides the Work (and each
|
||||||
|
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
implied, including, without limitation, any warranties or conditions
|
||||||
|
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||||
|
appropriateness of using or redistributing the Work and assume any
|
||||||
|
risks associated with Your exercise of permissions under this License.
|
||||||
|
|
||||||
|
8. Limitation of Liability. In no event and under no legal theory,
|
||||||
|
whether in tort (including negligence), contract, or otherwise,
|
||||||
|
unless required by applicable law (such as deliberate and grossly
|
||||||
|
negligent acts) or agreed to in writing, shall any Contributor be
|
||||||
|
liable to You for damages, including any direct, indirect, special,
|
||||||
|
incidental, or consequential damages of any character arising as a
|
||||||
|
result of this License or out of the use or inability to use the
|
||||||
|
Work (including but not limited to damages for loss of goodwill,
|
||||||
|
work stoppage, computer failure or malfunction, or any and all
|
||||||
|
other commercial damages or losses), even if such Contributor
|
||||||
|
has been advised of the possibility of such damages.
|
||||||
|
|
||||||
|
9. Accepting Warranty or Additional Liability. While redistributing
|
||||||
|
the Work or Derivative Works thereof, You may choose to offer,
|
||||||
|
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||||
|
or other liability obligations and/or rights consistent with this
|
||||||
|
License. However, in accepting such obligations, You may act only
|
||||||
|
on Your own behalf and on Your sole responsibility, not on behalf
|
||||||
|
of any other Contributor, and only if You agree to indemnify,
|
||||||
|
defend, and hold each Contributor harmless for any liability
|
||||||
|
incurred by, or claims asserted against, such Contributor by reason
|
||||||
|
of your accepting any such warranty or additional liability.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
APPENDIX: How to apply the Apache License to your work.
|
||||||
|
|
||||||
|
To apply the Apache License to your work, attach the following
|
||||||
|
boilerplate notice, with the fields enclosed by brackets "{}"
|
||||||
|
replaced with your own identifying information. (Don't include
|
||||||
|
the brackets!) The text should be enclosed in the appropriate
|
||||||
|
comment syntax for the file format. We also recommend that a
|
||||||
|
file or class name and description of purpose be included on the
|
||||||
|
same "printed page" as the copyright notice for easier
|
||||||
|
identification within third-party archives.
|
||||||
|
|
||||||
|
Copyright {yyyy} {name of copyright owner}
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
144
REMOTE_CONTROL_SBUS_FIX_NOTE.md
Normal file
144
REMOTE_CONTROL_SBUS_FIX_NOTE.md
Normal file
@@ -0,0 +1,144 @@
|
|||||||
|
# SBUS 遥控接收修复说明
|
||||||
|
|
||||||
|
这份记录用来说明这次从“遥控器收不到数据 / `rc_ctrl` 不变化”一路排查到当前稳定版本的主要修改点。写得偏简略,重点放在为什么改、DMA 怎么配、哪些文件动过,以及最后对当前 `git diff` 的复核结论。
|
||||||
|
|
||||||
|
## 1. 一开始的问题和定位思路
|
||||||
|
|
||||||
|
最开始的现象是:遥控器链路没有让 `rc_ctrl` 更新,后面又观察到 `rc_debug.rx_event_count` 也不增长,说明问题不只是协议解析,而是 UART/DMA 接收事件本身没有稳定进入。
|
||||||
|
|
||||||
|
排查时按链路分层看:
|
||||||
|
|
||||||
|
1. **初始化链路**:发现遥控器模块没有在 `RobotInit()` 里真正初始化,所以补了 `RemoteControlInit(&huart5)`。
|
||||||
|
2. **UART 协议配置**:用户确认 SBUS 硬件已经做了反向,所以保持 UART5 为 `100000 / 8E2`,也就是 HAL 里的 `UART_WORDLENGTH_9B + UART_PARITY_EVEN + UART_STOPBITS_2`。当前没有启用软件 `RXINV`。
|
||||||
|
3. **GPIO 电平配置**:UART5 RX 是 PD2,当前保持 `GPIO_NOPULL`,没有继续保留“内部上拉”的实验配置。
|
||||||
|
4. **DMA 内存可访问性**:H7 上 DMA1/DMA2 不能访问 DTCM。原来接收对象如果落到 DTCM,就可能导致 DMA 没法真正写入数据。现在把 USART 实例池和接收 buffer 放进 `.dma_buffer` 段,并链接到 RAM_D1。
|
||||||
|
5. **DMA 接收方式**:原来的 UART5 RX DMA 是 `DMA_CIRCULAR`,但这里使用的是 `HAL_UARTEx_ReceiveToIdle_DMA()`,为了按实际一帧 25 字节触发并重启,改成 `DMA_NORMAL + ReceiveToIdle`。
|
||||||
|
6. **异常恢复**:如果 UART/DMA 出错或重启失败,不能只在中断里死等。现在加了 `USARTServiceTask()`,在 daemon 任务上下文里做 stream 级恢复。
|
||||||
|
7. **SBUS 解析**:只接受完整 25 字节帧,检查帧头 `0x0F`,尾字节允许 `0x00/0x04/0x14/0x24/0x34`,并处理 failsafe/offline。
|
||||||
|
|
||||||
|
后面临时试过的 `RXINV`、PD2 上拉、50 字节接收、滑动同步、`rc_debug` 等实验代码已经撤掉,当前版本回到“硬件反相 + 正常 SBUS 帧解析”的方案。
|
||||||
|
|
||||||
|
## 2. DMA 当前怎么配置
|
||||||
|
|
||||||
|
UART5 RX 的 DMA 配置在 `Core/Src/usart.c` 和 `TronOneH7_Scaffold.ioc` 中保持一致:
|
||||||
|
|
||||||
|
- UART:`UART5`
|
||||||
|
- RX 引脚:`PD2`
|
||||||
|
- DMA stream:`DMA1_Stream5`
|
||||||
|
- Request:`DMA_REQUEST_UART5_RX`
|
||||||
|
- 方向:`DMA_PERIPH_TO_MEMORY`
|
||||||
|
- 外设地址不自增:`DMA_PINC_DISABLE`
|
||||||
|
- 内存地址自增:`DMA_MINC_ENABLE`
|
||||||
|
- 外设/内存数据宽度:`BYTE`
|
||||||
|
- 模式:`DMA_NORMAL`
|
||||||
|
- 优先级:`DMA_PRIORITY_VERY_HIGH`
|
||||||
|
- FIFO:关闭
|
||||||
|
|
||||||
|
接收 buffer 的关键点:
|
||||||
|
|
||||||
|
- `USART_Instance usart_instance_pool[DEVICE_USART_CNT]` 放在 `User_Code/bsp/usart/bsp_usart.c`。
|
||||||
|
- 这个池加了 `__attribute__((section(".dma_buffer"), aligned(32)))`。
|
||||||
|
- `STM32H723XG_FLASH.ld` 新增 `.dma_buffer (NOLOAD)` 段,并放到 `RAM_D1`,避免 DMA 访问 DTCM 失败。
|
||||||
|
- `USART_Instance.recv_buff` 也做了 32 字节对齐。
|
||||||
|
|
||||||
|
启动和重启方式:
|
||||||
|
|
||||||
|
- `USARTServiceInit()` 调用 `HAL_UARTEx_ReceiveToIdle_DMA()` 启动接收。
|
||||||
|
- 启动成功后关闭 DMA 半传输中断 `DMA_IT_HT`,避免半包回调干扰。
|
||||||
|
- `HAL_UARTEx_RxEventCallback()` 中记录 `rx_event_count`、`last_rx_size`,把实际收到的 `Size` 传给遥控器解析回调,然后重新启动接收。
|
||||||
|
- `HAL_UART_ErrorCallback()` 中记录 `uart_error_count`、`last_uart_error`,并尝试重启接收。
|
||||||
|
- 如果中断里重启失败,会置位/累计错误,后续由 `USARTServiceTask()` 在任务上下文里恢复 UART/DMA。
|
||||||
|
|
||||||
|
## 3. 主要加了什么,在哪里
|
||||||
|
|
||||||
|
- `User_Code/application/robot.c`
|
||||||
|
- 定义全局 `volatile RobotMode_t RobotMode`。
|
||||||
|
- 在 `RobotInit()` 中调用 `RemoteControlInit(&huart5)`。
|
||||||
|
|
||||||
|
- `Core/Src/usart.c`
|
||||||
|
- UART5 保持 `100000 / 8E2`。
|
||||||
|
- UART5 `AdvancedInit` 保持 `UART_ADVFEATURE_NO_INIT`,没有软件 RXINV。
|
||||||
|
- PD2 保持 `GPIO_NOPULL`。
|
||||||
|
- UART5 RX DMA 从 `DMA_CIRCULAR` 改为 `DMA_NORMAL`。
|
||||||
|
|
||||||
|
- `TronOneH7_Scaffold.ioc`
|
||||||
|
- 同步把 `Dma.UART5_RX.13.Mode` 改为 `DMA_NORMAL`。
|
||||||
|
|
||||||
|
- `STM32H723XG_FLASH.ld`
|
||||||
|
- 新增 `.dma_buffer` 段,放入 `RAM_D1`。
|
||||||
|
|
||||||
|
- `User_Code/bsp/usart/bsp_usart.c/.h`
|
||||||
|
- USART 实例不再 `malloc`,改用静态实例池,并放入 `.dma_buffer`。
|
||||||
|
- 模块回调改为携带 `(USART_Instance *instance, const uint8_t *recv_data, uint16_t recv_size)`。
|
||||||
|
- 加入 `rx_event_count`、`last_rx_size`、`uart_error_count`、`last_uart_error`、`rx_restart_error_count` 等接收状态字段。
|
||||||
|
- 加入 `USARTServiceTask()` 做 UART/DMA 恢复。
|
||||||
|
- `USARTServiceInit()` 改为返回 `HAL_StatusTypeDef`。
|
||||||
|
|
||||||
|
- `User_Code/module/periph/remote_control/rc.c/.h`
|
||||||
|
- `RemoteControlInit()` 注册 UART5,并显式启动 USART 接收服务。
|
||||||
|
- SBUS 解析只接受完整 25 字节帧。
|
||||||
|
- 加入帧头、尾字节、failsafe 校验。
|
||||||
|
- 加入 `RemoteControlReadSnapshot()`,用于原子读取当前遥控器快照。
|
||||||
|
- 修复 `RemoteControlIsOnline()` 和失控清零的竞态。
|
||||||
|
- 修复 SWB/SWC 通道、开关边沿标志。
|
||||||
|
|
||||||
|
- `Core/Src/freertos.c`
|
||||||
|
- daemon task 中调用 `USARTServiceTask()`,让 UART/DMA 异常恢复发生在任务上下文。
|
||||||
|
|
||||||
|
- `User_Code/module/software/daemon/daemon.c/.h`
|
||||||
|
- 修正 `temp_count/init_count` 初始化逻辑。
|
||||||
|
- `DaemonReload()`、`DaemonIsOnline()`、`Daemon_Update()` 加了简单临界区保护。
|
||||||
|
- `temp_count` 改为 `volatile`。
|
||||||
|
|
||||||
|
- `User_Code/application/indicator_app/ws2812status.c`
|
||||||
|
- 不再用局部 `RobotMode` 遮蔽全局状态。
|
||||||
|
- LED 显示时结合 `RemoteControlIsOnline()` 判断遥控器离线。
|
||||||
|
|
||||||
|
- `User_Code/module/paramdef/robot_def.h`
|
||||||
|
- `RobotMode` 声明改为 `extern volatile RobotMode_t RobotMode`。
|
||||||
|
|
||||||
|
## 4. 当前建议上板观察项
|
||||||
|
|
||||||
|
上板后重点看这些量:
|
||||||
|
|
||||||
|
- `rx_event_count` 是否持续增长。
|
||||||
|
- `last_rx_size` 是否稳定为 `25`。
|
||||||
|
- `rc_valid_frame_count` 是否持续增长。
|
||||||
|
- `uart_error_count`、`rx_restart_error_count` 是否不持续增长。
|
||||||
|
- 原始帧是否类似 `0F ... 00/04/14/24/34`。
|
||||||
|
|
||||||
|
注意:当前稳定版本已经没有 `rc_debug` 这个临时调试结构。`rx_event_count` 和 `last_rx_size` 在 `USART_Instance` 里,`rc_valid_frame_count` 等在 `rc.c` 内部是 `static volatile`。如果后续想长期在调试器里直接 watch 一个固定结构,可以再专门加一个轻量 getter 或 debug struct;当前为了回到干净版本,没有保留那套临时代码。
|
||||||
|
|
||||||
|
## 5. Git 变更复核和可疑点
|
||||||
|
|
||||||
|
已读取当前 `git status --short`、`git diff --stat`、`git diff --check` 和关键文件 diff。当前工作区共有 16 个已修改文件,其中 SBUS 接收链路相关的是:
|
||||||
|
|
||||||
|
- `Core/Src/freertos.c`
|
||||||
|
- `Core/Src/usart.c`
|
||||||
|
- `STM32H723XG_FLASH.ld`
|
||||||
|
- `TronOneH7_Scaffold.ioc`
|
||||||
|
- `User_Code/application/indicator_app/ws2812status.c`
|
||||||
|
- `User_Code/application/robot.c`
|
||||||
|
- `User_Code/bsp/usart/bsp_usart.c`
|
||||||
|
- `User_Code/bsp/usart/bsp_usart.h`
|
||||||
|
- `User_Code/module/paramdef/robot_def.h`
|
||||||
|
- `User_Code/module/periph/remote_control/rc.c`
|
||||||
|
- `User_Code/module/periph/remote_control/rc.h`
|
||||||
|
- `User_Code/module/software/daemon/daemon.c`
|
||||||
|
- `User_Code/module/software/daemon/daemon.h`
|
||||||
|
|
||||||
|
复核结论:
|
||||||
|
|
||||||
|
- `git diff --check` 没有发现空白错误,只提示这些文件下次被 Git 处理时 LF 可能转 CRLF。
|
||||||
|
- 没有发现 `rc_debug`、`rc_ctrl_debug`、`RemoteControlDebugPoll`、`RXINV`、`RxPinLevelInvert`、50 字节 buffer、滑动同步等实验代码残留。
|
||||||
|
- UART5 当前确实是 `100000 / 8E2`,没有软件 RXINV;PD2 也是 `GPIO_NOPULL`。
|
||||||
|
- UART5 RX DMA 在 `.ioc` 和生成代码里都已经是 `DMA_NORMAL`,没有一边改一边没同步的问题。
|
||||||
|
- `RobotMode` 目前只有一个定义,在 `robot.c`;其它地方通过 `extern volatile` 使用,没看到重复定义。
|
||||||
|
|
||||||
|
需要特别注意的可疑/无关变更:
|
||||||
|
|
||||||
|
- `User_Code/module/periph/buzzer/buzzer.cpp` 只改了两行注释空格,和 SBUS 修复无关,建议不要混进本次提交。
|
||||||
|
- `ozonedeb/windebnewestux.jdebug` 和 `ozonedeb/windebnewestux.jdebug.user` 是 Ozone/J-Link 调试器本地状态变化,包括探针序列号、打开窗口、布局、打开文件等,和代码逻辑无关,建议不要混进本次提交。
|
||||||
|
- `rc_valid_frame_count` 等计数是 `static volatile`,调试符号里一般能看到,但 C 代码外部不能直接引用;这不是接收链路问题,只是“是否方便 watch”的问题。
|
||||||
|
|
||||||
|
总体看,SBUS 主链路相关 diff 没看到明显可疑残留;最需要清理的是 `buzzer.cpp` 和 `ozonedeb/*.jdebug*` 这些无关 dirty 文件。
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
**
|
**
|
||||||
|
|
||||||
** File : LinkerScript.ld
|
** File : LinkerScript.ld
|
||||||
**
|
**
|
||||||
** Author : STM32CubeMX
|
** Author : STM32CubeMX
|
||||||
@@ -16,7 +15,7 @@
|
|||||||
**
|
**
|
||||||
** Target : STMicroelectronics STM32
|
** Target : STMicroelectronics STM32
|
||||||
**
|
**
|
||||||
** Distribution: The file is distributed “as is,” without any warranty
|
** Distribution: The file is distributed "as is," without any warranty
|
||||||
** of any kind.
|
** of any kind.
|
||||||
**
|
**
|
||||||
*****************************************************************************
|
*****************************************************************************
|
||||||
@@ -24,105 +23,95 @@
|
|||||||
**
|
**
|
||||||
** <h2><center>© COPYRIGHT(c) 2025 STMicroelectronics</center></h2>
|
** <h2><center>© COPYRIGHT(c) 2025 STMicroelectronics</center></h2>
|
||||||
**
|
**
|
||||||
** Redistribution and use in source and binary forms, with or without modification,
|
** 版权声明和许可条款
|
||||||
** are permitted provided that the following conditions are met:
|
|
||||||
** 1. Redistributions of source code must retain the above copyright notice,
|
|
||||||
** this list of conditions and the following disclaimer.
|
|
||||||
** 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
** this list of conditions and the following disclaimer in the documentation
|
|
||||||
** and/or other materials provided with the distribution.
|
|
||||||
** 3. Neither the name of STMicroelectronics nor the names of its contributors
|
|
||||||
** may be used to endorse or promote products derived from this software
|
|
||||||
** without specific prior written permission.
|
|
||||||
**
|
|
||||||
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
||||||
** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
||||||
** SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
||||||
** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
||||||
** OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
**
|
**
|
||||||
*****************************************************************************
|
*****************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Entry Point */
|
/* 程序入口点 - 指定复位处理程序为程序的起始执行点 */
|
||||||
ENTRY(Reset_Handler)
|
ENTRY(Reset_Handler)
|
||||||
|
|
||||||
/* Specify the memory areas */
|
/* 定义内存区域 */
|
||||||
MEMORY
|
MEMORY
|
||||||
{
|
{
|
||||||
|
/* 数据紧耦合内存 (Data TCM) - 128KB,零等待周期,用于高性能数据访问 */
|
||||||
DTCMRAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K
|
DTCMRAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K
|
||||||
RAM_D1 (xrw) : ORIGIN = 0x24000000, LENGTH = 320K
|
/* D1域RAM (AXI SRAM) - 320KB,主系统内存 */
|
||||||
|
RAM_D1 (xrw) : ORIGIN = 0x24000000, LENGTH = 128K
|
||||||
|
/* D2域RAM (AHB SRAM) - 32KB,用于外设数据缓冲 */
|
||||||
RAM_D2 (xrw) : ORIGIN = 0x30000000, LENGTH = 32K
|
RAM_D2 (xrw) : ORIGIN = 0x30000000, LENGTH = 32K
|
||||||
|
/* D3域RAM (备份域RAM) - 16KB,在低功耗模式下保持数据 */
|
||||||
RAM_D3 (xrw) : ORIGIN = 0x38000000, LENGTH = 16K
|
RAM_D3 (xrw) : ORIGIN = 0x38000000, LENGTH = 16K
|
||||||
|
/* 指令紧耦合内存 (Instruction TCM) - 64KB,零等待周期,用于高性能代码执行 */
|
||||||
ITCMRAM (xrw) : ORIGIN = 0x00000000, LENGTH = 64K
|
ITCMRAM (xrw) : ORIGIN = 0x00000000, LENGTH = 64K
|
||||||
|
/* 主闪存 - 1024KB,存储程序代码和常量数据 */
|
||||||
FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 1024K
|
FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 1024K
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Highest address of the user mode stack */
|
/* 定义用户模式栈的最高地址(栈向低地址增长) */
|
||||||
_estack = ORIGIN(DTCMRAM) + LENGTH(DTCMRAM); /* end of RAM */
|
_estack = ORIGIN(DTCMRAM) + LENGTH(DTCMRAM); /* RAM的末尾作为栈起始位置 */
|
||||||
/* Generate a link error if heap and stack don't fit into RAM */
|
|
||||||
|
/* 如果堆和栈不能放入RAM则生成链接错误 */
|
||||||
_Min_Heap_Size = 0x4000; /* required amount of heap */
|
_Min_Heap_Size = 0x4000; /* required amount of heap */
|
||||||
_Min_Stack_Size = 0x4000; /* required amount of stack */
|
_Min_Stack_Size = 0x4000; /* required amount of stack */
|
||||||
|
|
||||||
/* Define output sections */
|
/* 定义输出段 */
|
||||||
SECTIONS
|
SECTIONS
|
||||||
{
|
{
|
||||||
/* The startup code goes first into FLASH */
|
/* 启动代码首先放入FLASH */
|
||||||
.isr_vector :
|
.isr_vector :
|
||||||
{
|
{
|
||||||
. = ALIGN(4);
|
. = ALIGN(4); /* 4字节对齐 */
|
||||||
KEEP(*(.isr_vector)) /* Startup code */
|
KEEP(*(.isr_vector)) /* 保留中断向量表(启动代码) */
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
} >FLASH
|
} >FLASH
|
||||||
|
|
||||||
/* The program code and other data goes into FLASH */
|
/* 程序代码和其他数据放入FLASH */
|
||||||
.text :
|
.text :
|
||||||
{
|
{
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
*(.text) /* .text sections (code) */
|
*(.text) /* 所有.text段(代码) */
|
||||||
*(.text*) /* .text* sections (code) */
|
*(.text*) /* 所有.text*段(代码) */
|
||||||
*(.glue_7) /* glue arm to thumb code */
|
*(.glue_7) /* ARM和Thumb代码粘合段 */
|
||||||
*(.glue_7t) /* glue thumb to arm code */
|
*(.glue_7t) /* Thumb和ARM代码粘合段 */
|
||||||
*(.eh_frame)
|
*(.eh_frame) /* 异常处理帧信息 */
|
||||||
|
|
||||||
KEEP (*(.init))
|
KEEP (*(.init)) /* 保留初始化代码 */
|
||||||
KEEP (*(.fini))
|
KEEP (*(.fini)) /* 保留终止化代码 */
|
||||||
|
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
_etext = .; /* define a global symbols at end of code */
|
_etext = .; /* 定义代码结束的全局符号 */
|
||||||
} >FLASH
|
} >FLASH
|
||||||
|
|
||||||
/* Constant data goes into FLASH */
|
/* 常量数据放入FLASH */
|
||||||
.rodata :
|
.rodata :
|
||||||
{
|
{
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
*(.rodata) /* .rodata sections (constants, strings, etc.) */
|
*(.rodata) /* .rodata段(常量、字符串等) */
|
||||||
*(.rodata*) /* .rodata* sections (constants, strings, etc.) */
|
*(.rodata*) /* .rodata*段(常量、字符串等) */
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
} >FLASH
|
} >FLASH
|
||||||
|
|
||||||
.ARM.extab (READONLY) : /* The "READONLY" keyword is only supported in GCC11 and later, remove it if using GCC10 or earlier. */
|
/* ARM异常处理表段 */
|
||||||
|
.ARM.extab (READONLY) : /* "READONLY"关键字仅在GCC11及以后版本支持,如果使用GCC10或更早版本请移除 */
|
||||||
{
|
{
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
*(.ARM.extab* .gnu.linkonce.armextab.*)
|
*(.ARM.extab* .gnu.linkonce.armextab.*)
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
} >FLASH
|
} >FLASH
|
||||||
|
|
||||||
.ARM (READONLY) : /* The "READONLY" keyword is only supported in GCC11 and later, remove it if using GCC10 or earlier. */
|
/* ARM异常索引表段 */
|
||||||
|
.ARM (READONLY) : /* "READONLY"关键字仅在GCC11及以后版本支持,如果使用GCC10或更早版本请移除 */
|
||||||
{
|
{
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
__exidx_start = .;
|
__exidx_start = .; /* 异常索引表开始 */
|
||||||
*(.ARM.exidx*)
|
*(.ARM.exidx*)
|
||||||
__exidx_end = .;
|
__exidx_end = .; /* 异常索引表结束 */
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
} >FLASH
|
} >FLASH
|
||||||
|
|
||||||
.preinit_array (READONLY) : /* The "READONLY" keyword is only supported in GCC11 and later, remove it if using GCC10 or earlier. */
|
/* 预初始化数组段 */
|
||||||
|
.preinit_array (READONLY) : /* "READONLY"关键字仅在GCC11及以后版本支持,如果使用GCC10或更早版本请移除 */
|
||||||
{
|
{
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
PROVIDE_HIDDEN (__preinit_array_start = .);
|
PROVIDE_HIDDEN (__preinit_array_start = .);
|
||||||
@@ -131,56 +120,59 @@ SECTIONS
|
|||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
} >FLASH
|
} >FLASH
|
||||||
|
|
||||||
.init_array (READONLY) : /* The "READONLY" keyword is only supported in GCC11 and later, remove it if using GCC10 or earlier. */
|
/* 初始化数组段 */
|
||||||
|
.init_array (READONLY) : /* "READONLY"关键字仅在GCC11及以后版本支持,如果使用GCC10或更早版本请移除 */
|
||||||
{
|
{
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
PROVIDE_HIDDEN (__init_array_start = .);
|
PROVIDE_HIDDEN (__init_array_start = .);
|
||||||
KEEP (*(SORT(.init_array.*)))
|
KEEP (*(SORT(.init_array.*))) /* 排序的初始化数组 */
|
||||||
KEEP (*(.init_array*))
|
KEEP (*(.init_array*))
|
||||||
PROVIDE_HIDDEN (__init_array_end = .);
|
PROVIDE_HIDDEN (__init_array_end = .);
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
} >FLASH
|
} >FLASH
|
||||||
|
|
||||||
.fini_array (READONLY) : /* The "READONLY" keyword is only supported in GCC11 and later, remove it if using GCC10 or earlier. */
|
/* 终止化数组段 */
|
||||||
|
.fini_array (READONLY) : /* "READONLY"关键字仅在GCC11及以后版本支持,如果使用GCC10或更早版本请移除 */
|
||||||
{
|
{
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
PROVIDE_HIDDEN (__fini_array_start = .);
|
PROVIDE_HIDDEN (__fini_array_start = .);
|
||||||
KEEP (*(SORT(.fini_array.*)))
|
KEEP (*(SORT(.fini_array.*))) /* 排序的终止化数组 */
|
||||||
KEEP (*(.fini_array*))
|
KEEP (*(.fini_array*))
|
||||||
PROVIDE_HIDDEN (__fini_array_end = .);
|
PROVIDE_HIDDEN (__fini_array_end = .);
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
} >FLASH
|
} >FLASH
|
||||||
|
|
||||||
/* used by the startup to initialize data */
|
/* 用于启动时初始化数据的加载地址 */
|
||||||
_sidata = LOADADDR(.data);
|
_sidata = LOADADDR(.data);
|
||||||
|
|
||||||
/* Initialized data sections goes into RAM, load LMA copy after code */
|
/* 已初始化数据段放入RAM,但在FLASH中保留加载镜像 */
|
||||||
.data :
|
.data :
|
||||||
{
|
{
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
_sdata = .; /* create a global symbol at data start */
|
_sdata = .; /* 在数据开始处创建全局符号 */
|
||||||
*(.data) /* .data sections */
|
*(.data) /* .data段 */
|
||||||
*(.data*) /* .data* sections */
|
*(.data*) /* .data*段 */
|
||||||
*(.RamFunc) /* .RamFunc sections */
|
*(.RamFunc) /* 在RAM中执行的函数段 */
|
||||||
*(.RamFunc*) /* .RamFunc* sections */
|
*(.RamFunc*) /* 在RAM中执行的函数段 */
|
||||||
|
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
} >DTCMRAM AT> FLASH
|
_edata = .; /* 在数据结束处定义全局符号 */
|
||||||
|
} >DTCMRAM AT> FLASH /* VMA在DTCMRAM,LMA在FLASH */
|
||||||
|
|
||||||
/* Initialized TLS data section */
|
/* 已初始化TLS(线程局部存储)数据段 */
|
||||||
.tdata : ALIGN(4)
|
.tdata : ALIGN(4)
|
||||||
{
|
{
|
||||||
*(.tdata .tdata.* .gnu.linkonce.td.*)
|
*(.tdata .tdata.* .gnu.linkonce.td.*)
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
_edata = .; /* define a global symbol at data end */
|
|
||||||
PROVIDE(__data_end = .);
|
|
||||||
PROVIDE(__tdata_end = .);
|
PROVIDE(__tdata_end = .);
|
||||||
} >DTCMRAM AT> FLASH
|
} >DTCMRAM AT> FLASH
|
||||||
|
|
||||||
|
/* 提供TLS相关符号供启动代码和运行时使用 */
|
||||||
PROVIDE( __tdata_start = ADDR(.tdata) );
|
PROVIDE( __tdata_start = ADDR(.tdata) );
|
||||||
PROVIDE( __tdata_size = __tdata_end - __tdata_start );
|
PROVIDE( __tdata_size = __tdata_end - __tdata_start );
|
||||||
|
|
||||||
PROVIDE( __data_start = ADDR(.data) );
|
PROVIDE( __data_start = ADDR(.data) );
|
||||||
|
PROVIDE( __data_end = _edata );
|
||||||
PROVIDE( __data_size = __data_end - __data_start );
|
PROVIDE( __data_size = __data_end - __data_start );
|
||||||
|
|
||||||
PROVIDE( __tdata_source = LOADADDR(.tdata) );
|
PROVIDE( __tdata_source = LOADADDR(.tdata) );
|
||||||
@@ -188,23 +180,26 @@ SECTIONS
|
|||||||
PROVIDE( __tdata_source_size = __tdata_source_end - __tdata_source );
|
PROVIDE( __tdata_source_size = __tdata_source_end - __tdata_source );
|
||||||
|
|
||||||
PROVIDE( __data_source = LOADADDR(.data) );
|
PROVIDE( __data_source = LOADADDR(.data) );
|
||||||
PROVIDE( __data_source_end = __tdata_source_end );
|
PROVIDE( __data_source_end = LOADADDR(.data) + SIZEOF(.data) );
|
||||||
PROVIDE( __data_source_size = __data_source_end - __data_source );
|
PROVIDE( __data_source_size = __data_source_end - __data_source );
|
||||||
/* Uninitialized data section */
|
|
||||||
|
/* 未初始化的TLS BSS段 */
|
||||||
.tbss (NOLOAD) : ALIGN(4)
|
.tbss (NOLOAD) : ALIGN(4)
|
||||||
{
|
{
|
||||||
/* This is used by the startup in order to initialize the .bss secion */
|
/* 启动代码使用此符号来初始化.bss段 */
|
||||||
_sbss = .; /* define a global symbol at bss start */
|
_sbss = .; /* 在bss开始处定义全局符号 */
|
||||||
__bss_start__ = _sbss;
|
__bss_start__ = _sbss;
|
||||||
*(.tbss .tbss.*)
|
*(.tbss .tbss.*)
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
PROVIDE( __tbss_end = . );
|
PROVIDE( __tbss_end = . );
|
||||||
} >DTCMRAM
|
} >DTCMRAM
|
||||||
|
|
||||||
|
/* 提供TLS BSS相关符号 */
|
||||||
PROVIDE( __tbss_start = ADDR(.tbss) );
|
PROVIDE( __tbss_start = ADDR(.tbss) );
|
||||||
PROVIDE( __tbss_size = __tbss_end - __tbss_start );
|
PROVIDE( __tbss_size = __tbss_end - __tbss_start );
|
||||||
PROVIDE( __tbss_offset = ADDR(.tbss) - ADDR(.tdata) );
|
PROVIDE( __tbss_offset = ADDR(.tbss) - ADDR(.tdata) );
|
||||||
|
|
||||||
|
/* 提供TLS基础信息 */
|
||||||
PROVIDE( __tls_base = __tdata_start );
|
PROVIDE( __tls_base = __tdata_start );
|
||||||
PROVIDE( __tls_end = __tbss_end );
|
PROVIDE( __tls_end = __tbss_end );
|
||||||
PROVIDE( __tls_size = __tls_end - __tls_base );
|
PROVIDE( __tls_size = __tls_end - __tls_base );
|
||||||
@@ -213,41 +208,52 @@ SECTIONS
|
|||||||
PROVIDE( __arm32_tls_tcb_offset = MAX(8, __tls_align) );
|
PROVIDE( __arm32_tls_tcb_offset = MAX(8, __tls_align) );
|
||||||
PROVIDE( __arm64_tls_tcb_offset = MAX(16, __tls_align) );
|
PROVIDE( __arm64_tls_tcb_offset = MAX(16, __tls_align) );
|
||||||
|
|
||||||
|
/* 常规BSS段(未初始化数据) */
|
||||||
.bss (NOLOAD) : ALIGN(4)
|
.bss (NOLOAD) : ALIGN(4)
|
||||||
{
|
{
|
||||||
*(.bss)
|
*(.bss)
|
||||||
*(.bss*)
|
*(.bss*)
|
||||||
*(COMMON)
|
*(COMMON) /* 未初始化的全局变量 */
|
||||||
|
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
_ebss = .; /* define a global symbol at bss end */
|
_ebss = .; /* 在bss结束处定义全局符号 */
|
||||||
__bss_end__ = _ebss;
|
__bss_end__ = _ebss;
|
||||||
PROVIDE( __bss_end = .);
|
PROVIDE( __bss_end = .);
|
||||||
} >DTCMRAM
|
} >DTCMRAM
|
||||||
|
|
||||||
PROVIDE( __non_tls_bss_start = ADDR(.bss) );
|
PROVIDE( __non_tls_bss_start = ADDR(.bss) );
|
||||||
|
|
||||||
PROVIDE( __bss_start = __tbss_start );
|
/* 提供完整的BSS信息(包含TLS和非TLS) */
|
||||||
|
PROVIDE( __bss_start = _sbss );
|
||||||
PROVIDE( __bss_size = __bss_end - __bss_start );
|
PROVIDE( __bss_size = __bss_end - __bss_start );
|
||||||
|
|
||||||
/* User_heap_stack section, used to check that there is enough RAM left */
|
/* DMA1/DMA2 cannot access DTCM. The MPU config makes RAM_D1 non-cacheable. */
|
||||||
|
.dma_buffer (NOLOAD) :
|
||||||
|
{
|
||||||
|
. = ALIGN(32);
|
||||||
|
__dma_buffer_start__ = .;
|
||||||
|
KEEP(*(.dma_buffer))
|
||||||
|
KEEP(*(.dma_buffer.*))
|
||||||
|
. = ALIGN(32);
|
||||||
|
__dma_buffer_end__ = .;
|
||||||
|
} >RAM_D1
|
||||||
|
|
||||||
|
/* 用户堆栈段,用于检查剩余RAM是否足够 */
|
||||||
._user_heap_stack (NOLOAD) :
|
._user_heap_stack (NOLOAD) :
|
||||||
{
|
{
|
||||||
. = ALIGN(8);
|
. = ALIGN(8);
|
||||||
PROVIDE ( end = . );
|
PROVIDE ( end = . ); /* 堆起始位置 */
|
||||||
PROVIDE ( _end = . );
|
PROVIDE ( _end = . );
|
||||||
. = . + _Min_Heap_Size;
|
. = . + _Min_Heap_Size; /* 分配堆空间 */
|
||||||
. = . + _Min_Stack_Size;
|
. = . + _Min_Stack_Size; /* 分配栈空间 */
|
||||||
. = ALIGN(8);
|
. = ALIGN(8);
|
||||||
} >DTCMRAM
|
} >DTCMRAM
|
||||||
|
|
||||||
|
/* 从标准库中移除调试信息 */
|
||||||
|
|
||||||
/* Remove information from the standard libraries */
|
|
||||||
/DISCARD/ :
|
/DISCARD/ :
|
||||||
{
|
{
|
||||||
libc.a:* ( * )
|
libc.a:* ( * ) /* 丢弃C库的调试信息 */
|
||||||
libm.a:* ( * )
|
libm.a:* ( * ) /* 丢弃数学库的调试信息 */
|
||||||
libgcc.a:* ( * )
|
libgcc.a:* ( * ) /* 丢弃GCC库的调试信息 */
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,24 @@
|
|||||||
#MicroXplorer Configuration settings - do not modify
|
#MicroXplorer Configuration settings - do not modify
|
||||||
|
ADC1.Channel-0\#ChannelRegularConversion=ADC_CHANNEL_4
|
||||||
|
ADC1.Channel-1\#ChannelRegularConversion=ADC_CHANNEL_19
|
||||||
|
ADC1.ClockPrescaler=ADC_CLOCK_ASYNC_DIV64
|
||||||
|
ADC1.ContinuousConvMode=ENABLE
|
||||||
|
ADC1.ConversionDataManagement=ADC_CONVERSIONDATA_DMA_CIRCULAR
|
||||||
|
ADC1.IPParameters=Rank-0\#ChannelRegularConversion,master,Channel-0\#ChannelRegularConversion,SamplingTime-0\#ChannelRegularConversion,OffsetNumber-0\#ChannelRegularConversion,OffsetSignedSaturation-0\#ChannelRegularConversion,NbrOfConversionFlag,ClockPrescaler,ConversionDataManagement,ContinuousConvMode,Rank-1\#ChannelRegularConversion,Channel-1\#ChannelRegularConversion,SamplingTime-1\#ChannelRegularConversion,OffsetNumber-1\#ChannelRegularConversion,OffsetSignedSaturation-1\#ChannelRegularConversion,NbrOfConversion
|
||||||
|
ADC1.NbrOfConversion=2
|
||||||
|
ADC1.NbrOfConversionFlag=1
|
||||||
|
ADC1.OffsetNumber-0\#ChannelRegularConversion=ADC_OFFSET_NONE
|
||||||
|
ADC1.OffsetNumber-1\#ChannelRegularConversion=ADC_OFFSET_NONE
|
||||||
|
ADC1.OffsetSignedSaturation-0\#ChannelRegularConversion=DISABLE
|
||||||
|
ADC1.OffsetSignedSaturation-1\#ChannelRegularConversion=DISABLE
|
||||||
|
ADC1.Rank-0\#ChannelRegularConversion=1
|
||||||
|
ADC1.Rank-1\#ChannelRegularConversion=2
|
||||||
|
ADC1.SamplingTime-0\#ChannelRegularConversion=ADC_SAMPLETIME_64CYCLES_5
|
||||||
|
ADC1.SamplingTime-1\#ChannelRegularConversion=ADC_SAMPLETIME_64CYCLES_5
|
||||||
|
ADC1.master=1
|
||||||
ADC3.Channel-0\#ChannelRegularConversion=ADC_CHANNEL_TEMPSENSOR
|
ADC3.Channel-0\#ChannelRegularConversion=ADC_CHANNEL_TEMPSENSOR
|
||||||
ADC3.IPParameters=Rank-0\#ChannelRegularConversion,Channel-0\#ChannelRegularConversion,SamplingTime-0\#ChannelRegularConversion,OffsetNumber-0\#ChannelRegularConversion,OffsetSign-0\#ChannelRegularConversion,NbrOfConversionFlag
|
ADC3.ClockPrescaler=ADC_CLOCK_ASYNC_DIV64
|
||||||
|
ADC3.IPParameters=Rank-0\#ChannelRegularConversion,Channel-0\#ChannelRegularConversion,SamplingTime-0\#ChannelRegularConversion,OffsetNumber-0\#ChannelRegularConversion,OffsetSign-0\#ChannelRegularConversion,NbrOfConversionFlag,ClockPrescaler
|
||||||
ADC3.NbrOfConversionFlag=1
|
ADC3.NbrOfConversionFlag=1
|
||||||
ADC3.OffsetNumber-0\#ChannelRegularConversion=ADC_OFFSET_NONE
|
ADC3.OffsetNumber-0\#ChannelRegularConversion=ADC_OFFSET_NONE
|
||||||
ADC3.OffsetSign-0\#ChannelRegularConversion=ADC3_OFFSET_SIGN_NEGATIVE
|
ADC3.OffsetSign-0\#ChannelRegularConversion=ADC3_OFFSET_SIGN_NEGATIVE
|
||||||
@@ -26,12 +44,31 @@ CRC.DefaultInitValueUse=DEFAULT_INIT_VALUE_DISABLE
|
|||||||
CRC.DefaultPolynomialUse=DEFAULT_POLYNOMIAL_DISABLE
|
CRC.DefaultPolynomialUse=DEFAULT_POLYNOMIAL_DISABLE
|
||||||
CRC.IPParameters=InputDataInversionMode,DefaultInitValueUse,DefaultPolynomialUse,CRCLength
|
CRC.IPParameters=InputDataInversionMode,DefaultInitValueUse,DefaultPolynomialUse,CRCLength
|
||||||
CRC.InputDataInversionMode=CRC_INPUTDATA_INVERSION_BYTE
|
CRC.InputDataInversionMode=CRC_INPUTDATA_INVERSION_BYTE
|
||||||
|
Dma.ADC1.14.Direction=DMA_PERIPH_TO_MEMORY
|
||||||
|
Dma.ADC1.14.EventEnable=DISABLE
|
||||||
|
Dma.ADC1.14.FIFOMode=DMA_FIFOMODE_DISABLE
|
||||||
|
Dma.ADC1.14.Instance=DMA1_Stream2
|
||||||
|
Dma.ADC1.14.MemDataAlignment=DMA_MDATAALIGN_HALFWORD
|
||||||
|
Dma.ADC1.14.MemInc=DMA_MINC_ENABLE
|
||||||
|
Dma.ADC1.14.Mode=DMA_CIRCULAR
|
||||||
|
Dma.ADC1.14.PeriphDataAlignment=DMA_PDATAALIGN_HALFWORD
|
||||||
|
Dma.ADC1.14.PeriphInc=DMA_PINC_DISABLE
|
||||||
|
Dma.ADC1.14.Polarity=HAL_DMAMUX_REQ_GEN_RISING
|
||||||
|
Dma.ADC1.14.Priority=DMA_PRIORITY_LOW
|
||||||
|
Dma.ADC1.14.RequestNumber=1
|
||||||
|
Dma.ADC1.14.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority,FIFOMode,SignalID,Polarity,RequestNumber,SyncSignalID,SyncPolarity,SyncEnable,EventEnable,SyncRequestNumber
|
||||||
|
Dma.ADC1.14.SignalID=NONE
|
||||||
|
Dma.ADC1.14.SyncEnable=DISABLE
|
||||||
|
Dma.ADC1.14.SyncPolarity=HAL_DMAMUX_SYNC_NO_EVENT
|
||||||
|
Dma.ADC1.14.SyncRequestNumber=1
|
||||||
|
Dma.ADC1.14.SyncSignalID=NONE
|
||||||
Dma.Request0=USART10_RX
|
Dma.Request0=USART10_RX
|
||||||
Dma.Request1=USART10_TX
|
Dma.Request1=USART10_TX
|
||||||
Dma.Request10=USART3_TX
|
Dma.Request10=USART3_TX
|
||||||
Dma.Request11=SPI1_RX
|
Dma.Request11=SPI1_RX
|
||||||
Dma.Request12=SPI1_TX
|
Dma.Request12=SPI1_TX
|
||||||
Dma.Request13=UART5_RX
|
Dma.Request13=UART5_RX
|
||||||
|
Dma.Request14=ADC1
|
||||||
Dma.Request2=SPI2_RX
|
Dma.Request2=SPI2_RX
|
||||||
Dma.Request3=SPI2_TX
|
Dma.Request3=SPI2_TX
|
||||||
Dma.Request4=UART7_RX
|
Dma.Request4=UART7_RX
|
||||||
@@ -40,15 +77,15 @@ Dma.Request6=USART1_TX
|
|||||||
Dma.Request7=USART2_RX
|
Dma.Request7=USART2_RX
|
||||||
Dma.Request8=USART2_TX
|
Dma.Request8=USART2_TX
|
||||||
Dma.Request9=USART3_RX
|
Dma.Request9=USART3_RX
|
||||||
Dma.RequestsNb=14
|
Dma.RequestsNb=15
|
||||||
Dma.SPI1_RX.11.Direction=DMA_PERIPH_TO_MEMORY
|
Dma.SPI1_RX.11.Direction=DMA_PERIPH_TO_MEMORY
|
||||||
Dma.SPI1_RX.11.EventEnable=DISABLE
|
Dma.SPI1_RX.11.EventEnable=DISABLE
|
||||||
Dma.SPI1_RX.11.FIFOMode=DMA_FIFOMODE_DISABLE
|
Dma.SPI1_RX.11.FIFOMode=DMA_FIFOMODE_DISABLE
|
||||||
Dma.SPI1_RX.11.Instance=DMA2_Stream7
|
Dma.SPI1_RX.11.Instance=DMA2_Stream7
|
||||||
Dma.SPI1_RX.11.MemDataAlignment=DMA_MDATAALIGN_HALFWORD
|
Dma.SPI1_RX.11.MemDataAlignment=DMA_MDATAALIGN_BYTE
|
||||||
Dma.SPI1_RX.11.MemInc=DMA_MINC_ENABLE
|
Dma.SPI1_RX.11.MemInc=DMA_MINC_ENABLE
|
||||||
Dma.SPI1_RX.11.Mode=DMA_NORMAL
|
Dma.SPI1_RX.11.Mode=DMA_NORMAL
|
||||||
Dma.SPI1_RX.11.PeriphDataAlignment=DMA_PDATAALIGN_HALFWORD
|
Dma.SPI1_RX.11.PeriphDataAlignment=DMA_PDATAALIGN_BYTE
|
||||||
Dma.SPI1_RX.11.PeriphInc=DMA_PINC_DISABLE
|
Dma.SPI1_RX.11.PeriphInc=DMA_PINC_DISABLE
|
||||||
Dma.SPI1_RX.11.Polarity=HAL_DMAMUX_REQ_GEN_RISING
|
Dma.SPI1_RX.11.Polarity=HAL_DMAMUX_REQ_GEN_RISING
|
||||||
Dma.SPI1_RX.11.Priority=DMA_PRIORITY_VERY_HIGH
|
Dma.SPI1_RX.11.Priority=DMA_PRIORITY_VERY_HIGH
|
||||||
@@ -62,11 +99,11 @@ Dma.SPI1_RX.11.SyncSignalID=NONE
|
|||||||
Dma.SPI1_TX.12.Direction=DMA_MEMORY_TO_PERIPH
|
Dma.SPI1_TX.12.Direction=DMA_MEMORY_TO_PERIPH
|
||||||
Dma.SPI1_TX.12.EventEnable=DISABLE
|
Dma.SPI1_TX.12.EventEnable=DISABLE
|
||||||
Dma.SPI1_TX.12.FIFOMode=DMA_FIFOMODE_DISABLE
|
Dma.SPI1_TX.12.FIFOMode=DMA_FIFOMODE_DISABLE
|
||||||
Dma.SPI1_TX.12.Instance=DMA1_Stream2
|
Dma.SPI1_TX.12.Instance=DMA1_Stream3
|
||||||
Dma.SPI1_TX.12.MemDataAlignment=DMA_MDATAALIGN_HALFWORD
|
Dma.SPI1_TX.12.MemDataAlignment=DMA_MDATAALIGN_BYTE
|
||||||
Dma.SPI1_TX.12.MemInc=DMA_MINC_ENABLE
|
Dma.SPI1_TX.12.MemInc=DMA_MINC_ENABLE
|
||||||
Dma.SPI1_TX.12.Mode=DMA_NORMAL
|
Dma.SPI1_TX.12.Mode=DMA_NORMAL
|
||||||
Dma.SPI1_TX.12.PeriphDataAlignment=DMA_PDATAALIGN_HALFWORD
|
Dma.SPI1_TX.12.PeriphDataAlignment=DMA_PDATAALIGN_BYTE
|
||||||
Dma.SPI1_TX.12.PeriphInc=DMA_PINC_DISABLE
|
Dma.SPI1_TX.12.PeriphInc=DMA_PINC_DISABLE
|
||||||
Dma.SPI1_TX.12.Polarity=HAL_DMAMUX_REQ_GEN_RISING
|
Dma.SPI1_TX.12.Polarity=HAL_DMAMUX_REQ_GEN_RISING
|
||||||
Dma.SPI1_TX.12.Priority=DMA_PRIORITY_VERY_HIGH
|
Dma.SPI1_TX.12.Priority=DMA_PRIORITY_VERY_HIGH
|
||||||
@@ -80,7 +117,7 @@ Dma.SPI1_TX.12.SyncSignalID=NONE
|
|||||||
Dma.SPI2_RX.2.Direction=DMA_PERIPH_TO_MEMORY
|
Dma.SPI2_RX.2.Direction=DMA_PERIPH_TO_MEMORY
|
||||||
Dma.SPI2_RX.2.EventEnable=DISABLE
|
Dma.SPI2_RX.2.EventEnable=DISABLE
|
||||||
Dma.SPI2_RX.2.FIFOMode=DMA_FIFOMODE_DISABLE
|
Dma.SPI2_RX.2.FIFOMode=DMA_FIFOMODE_DISABLE
|
||||||
Dma.SPI2_RX.2.Instance=DMA1_Stream3
|
Dma.SPI2_RX.2.Instance=DMA1_Stream0
|
||||||
Dma.SPI2_RX.2.MemDataAlignment=DMA_MDATAALIGN_BYTE
|
Dma.SPI2_RX.2.MemDataAlignment=DMA_MDATAALIGN_BYTE
|
||||||
Dma.SPI2_RX.2.MemInc=DMA_MINC_ENABLE
|
Dma.SPI2_RX.2.MemInc=DMA_MINC_ENABLE
|
||||||
Dma.SPI2_RX.2.Mode=DMA_NORMAL
|
Dma.SPI2_RX.2.Mode=DMA_NORMAL
|
||||||
@@ -119,11 +156,11 @@ Dma.UART5_RX.13.FIFOMode=DMA_FIFOMODE_DISABLE
|
|||||||
Dma.UART5_RX.13.Instance=DMA1_Stream5
|
Dma.UART5_RX.13.Instance=DMA1_Stream5
|
||||||
Dma.UART5_RX.13.MemDataAlignment=DMA_MDATAALIGN_BYTE
|
Dma.UART5_RX.13.MemDataAlignment=DMA_MDATAALIGN_BYTE
|
||||||
Dma.UART5_RX.13.MemInc=DMA_MINC_ENABLE
|
Dma.UART5_RX.13.MemInc=DMA_MINC_ENABLE
|
||||||
Dma.UART5_RX.13.Mode=DMA_CIRCULAR
|
Dma.UART5_RX.13.Mode=DMA_NORMAL
|
||||||
Dma.UART5_RX.13.PeriphDataAlignment=DMA_PDATAALIGN_BYTE
|
Dma.UART5_RX.13.PeriphDataAlignment=DMA_PDATAALIGN_BYTE
|
||||||
Dma.UART5_RX.13.PeriphInc=DMA_PINC_DISABLE
|
Dma.UART5_RX.13.PeriphInc=DMA_PINC_DISABLE
|
||||||
Dma.UART5_RX.13.Polarity=HAL_DMAMUX_REQ_GEN_RISING
|
Dma.UART5_RX.13.Polarity=HAL_DMAMUX_REQ_GEN_RISING
|
||||||
Dma.UART5_RX.13.Priority=DMA_PRIORITY_LOW
|
Dma.UART5_RX.13.Priority=DMA_PRIORITY_VERY_HIGH
|
||||||
Dma.UART5_RX.13.RequestNumber=1
|
Dma.UART5_RX.13.RequestNumber=1
|
||||||
Dma.UART5_RX.13.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority,FIFOMode,SignalID,Polarity,RequestNumber,SyncSignalID,SyncPolarity,SyncEnable,EventEnable,SyncRequestNumber
|
Dma.UART5_RX.13.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority,FIFOMode,SignalID,Polarity,RequestNumber,SyncSignalID,SyncPolarity,SyncEnable,EventEnable,SyncRequestNumber
|
||||||
Dma.UART5_RX.13.SignalID=NONE
|
Dma.UART5_RX.13.SignalID=NONE
|
||||||
@@ -293,7 +330,7 @@ Dma.USART3_TX.10.SyncEnable=DISABLE
|
|||||||
Dma.USART3_TX.10.SyncPolarity=HAL_DMAMUX_SYNC_NO_EVENT
|
Dma.USART3_TX.10.SyncPolarity=HAL_DMAMUX_SYNC_NO_EVENT
|
||||||
Dma.USART3_TX.10.SyncRequestNumber=1
|
Dma.USART3_TX.10.SyncRequestNumber=1
|
||||||
Dma.USART3_TX.10.SyncSignalID=NONE
|
Dma.USART3_TX.10.SyncSignalID=NONE
|
||||||
FDCAN1.AutoRetransmission=ENABLE
|
FDCAN1.AutoRetransmission=DISABLE
|
||||||
FDCAN1.CalculateBaudRateNominal=1000000
|
FDCAN1.CalculateBaudRateNominal=1000000
|
||||||
FDCAN1.CalculateTimeBitNominal=1000
|
FDCAN1.CalculateTimeBitNominal=1000
|
||||||
FDCAN1.CalculateTimeQuantumNominal=25.0
|
FDCAN1.CalculateTimeQuantumNominal=25.0
|
||||||
@@ -301,17 +338,18 @@ FDCAN1.DataPrescaler=3
|
|||||||
FDCAN1.DataSyncJumpWidth=10
|
FDCAN1.DataSyncJumpWidth=10
|
||||||
FDCAN1.DataTimeSeg1=29
|
FDCAN1.DataTimeSeg1=29
|
||||||
FDCAN1.DataTimeSeg2=10
|
FDCAN1.DataTimeSeg2=10
|
||||||
FDCAN1.IPParameters=CalculateTimeQuantumNominal,CalculateTimeBitNominal,CalculateBaudRateNominal,NominalPrescaler,NominalTimeSeg1,NominalTimeSeg2,DataPrescaler,DataTimeSeg1,DataTimeSeg2,TxFifoQueueMode,RxFifo0ElmtsNbr,TxFifoQueueElmtsNbr,StdFiltersNbr,AutoRetransmission,ProtocolException,NominalSyncJumpWidth,DataSyncJumpWidth
|
FDCAN1.IPParameters=CalculateTimeQuantumNominal,CalculateTimeBitNominal,CalculateBaudRateNominal,NominalPrescaler,NominalTimeSeg1,NominalTimeSeg2,DataPrescaler,DataTimeSeg1,DataTimeSeg2,TxFifoQueueMode,RxFifo0ElmtsNbr,TxFifoQueueElmtsNbr,StdFiltersNbr,AutoRetransmission,ProtocolException,NominalSyncJumpWidth,DataSyncJumpWidth,RxFifo1ElmtsNbr
|
||||||
FDCAN1.NominalPrescaler=3
|
FDCAN1.NominalPrescaler=3
|
||||||
FDCAN1.NominalSyncJumpWidth=10
|
FDCAN1.NominalSyncJumpWidth=10
|
||||||
FDCAN1.NominalTimeSeg1=29
|
FDCAN1.NominalTimeSeg1=29
|
||||||
FDCAN1.NominalTimeSeg2=10
|
FDCAN1.NominalTimeSeg2=10
|
||||||
FDCAN1.ProtocolException=ENABLE
|
FDCAN1.ProtocolException=DISABLE
|
||||||
FDCAN1.RxFifo0ElmtsNbr=32
|
FDCAN1.RxFifo0ElmtsNbr=4
|
||||||
FDCAN1.StdFiltersNbr=1
|
FDCAN1.RxFifo1ElmtsNbr=4
|
||||||
|
FDCAN1.StdFiltersNbr=14
|
||||||
FDCAN1.TxFifoQueueElmtsNbr=32
|
FDCAN1.TxFifoQueueElmtsNbr=32
|
||||||
FDCAN1.TxFifoQueueMode=FDCAN_TX_FIFO_OPERATION
|
FDCAN1.TxFifoQueueMode=FDCAN_TX_FIFO_OPERATION
|
||||||
FDCAN2.AutoRetransmission=ENABLE
|
FDCAN2.AutoRetransmission=DISABLE
|
||||||
FDCAN2.CalculateBaudRateNominal=1000000
|
FDCAN2.CalculateBaudRateNominal=1000000
|
||||||
FDCAN2.CalculateTimeBitNominal=1000
|
FDCAN2.CalculateTimeBitNominal=1000
|
||||||
FDCAN2.CalculateTimeQuantumNominal=25.0
|
FDCAN2.CalculateTimeQuantumNominal=25.0
|
||||||
@@ -319,40 +357,44 @@ FDCAN2.DataPrescaler=3
|
|||||||
FDCAN2.DataSyncJumpWidth=10
|
FDCAN2.DataSyncJumpWidth=10
|
||||||
FDCAN2.DataTimeSeg1=29
|
FDCAN2.DataTimeSeg1=29
|
||||||
FDCAN2.DataTimeSeg2=10
|
FDCAN2.DataTimeSeg2=10
|
||||||
FDCAN2.IPParameters=CalculateTimeQuantumNominal,CalculateTimeBitNominal,CalculateBaudRateNominal,DataPrescaler,DataTimeSeg1,DataTimeSeg2,NominalPrescaler,NominalTimeSeg1,NominalTimeSeg2,RxFifo1ElmtsNbr,TxFifoQueueElmtsNbr,MessageRAMOffset,StdFiltersNbr,AutoRetransmission,ProtocolException,NominalSyncJumpWidth,DataSyncJumpWidth
|
FDCAN2.IPParameters=CalculateTimeQuantumNominal,CalculateTimeBitNominal,CalculateBaudRateNominal,DataPrescaler,DataTimeSeg1,DataTimeSeg2,NominalPrescaler,NominalTimeSeg1,NominalTimeSeg2,RxFifo1ElmtsNbr,TxFifoQueueElmtsNbr,MessageRAMOffset,StdFiltersNbr,AutoRetransmission,ProtocolException,NominalSyncJumpWidth,DataSyncJumpWidth,RxFifo0ElmtsNbr
|
||||||
FDCAN2.MessageRAMOffset=853
|
FDCAN2.MessageRAMOffset=853
|
||||||
FDCAN2.NominalPrescaler=3
|
FDCAN2.NominalPrescaler=3
|
||||||
FDCAN2.NominalSyncJumpWidth=10
|
FDCAN2.NominalSyncJumpWidth=10
|
||||||
FDCAN2.NominalTimeSeg1=29
|
FDCAN2.NominalTimeSeg1=29
|
||||||
FDCAN2.NominalTimeSeg2=10
|
FDCAN2.NominalTimeSeg2=10
|
||||||
FDCAN2.ProtocolException=ENABLE
|
FDCAN2.ProtocolException=DISABLE
|
||||||
FDCAN2.RxFifo1ElmtsNbr=32
|
FDCAN2.RxFifo0ElmtsNbr=4
|
||||||
FDCAN2.StdFiltersNbr=1
|
FDCAN2.RxFifo1ElmtsNbr=4
|
||||||
|
FDCAN2.StdFiltersNbr=14
|
||||||
FDCAN2.TxFifoQueueElmtsNbr=32
|
FDCAN2.TxFifoQueueElmtsNbr=32
|
||||||
FDCAN3.AutoRetransmission=ENABLE
|
FDCAN3.AutoRetransmission=DISABLE
|
||||||
FDCAN3.CalculateBaudRateNominal=1000000
|
FDCAN3.CalculateBaudRateNominal=1000000
|
||||||
FDCAN3.CalculateTimeBitNominal=1000
|
FDCAN3.CalculateTimeBitNominal=1000
|
||||||
FDCAN3.CalculateTimeQuantumNominal=200.0
|
FDCAN3.CalculateTimeQuantumNominal=25.0
|
||||||
FDCAN3.ClockCalibrationCCU=DISABLE
|
FDCAN3.ClockCalibrationCCU=DISABLE
|
||||||
FDCAN3.DataPrescaler=3
|
FDCAN3.DataPrescaler=3
|
||||||
FDCAN3.DataSyncJumpWidth=10
|
FDCAN3.DataSyncJumpWidth=10
|
||||||
FDCAN3.DataTimeSeg1=29
|
FDCAN3.DataTimeSeg1=29
|
||||||
FDCAN3.DataTimeSeg2=10
|
FDCAN3.DataTimeSeg2=10
|
||||||
FDCAN3.IPParameters=CalculateTimeQuantumNominal,CalculateTimeBitNominal,CalculateBaudRateNominal,DataPrescaler,DataTimeSeg1,DataTimeSeg2,NominalPrescaler,NominalTimeSeg1,NominalTimeSeg2,RxFifo1ElmtsNbr,TxFifoQueueElmtsNbr,MessageRAMOffset,StdFiltersNbr,AutoRetransmission,ProtocolException,NominalSyncJumpWidth,DataSyncJumpWidth,ClockCalibrationCCU
|
FDCAN3.IPParameters=CalculateTimeQuantumNominal,CalculateTimeBitNominal,CalculateBaudRateNominal,DataPrescaler,DataTimeSeg1,DataTimeSeg2,NominalPrescaler,NominalTimeSeg1,NominalTimeSeg2,RxFifo1ElmtsNbr,TxFifoQueueElmtsNbr,MessageRAMOffset,StdFiltersNbr,AutoRetransmission,ProtocolException,NominalSyncJumpWidth,DataSyncJumpWidth,ClockCalibrationCCU,RxFifo0ElmtsNbr
|
||||||
FDCAN3.MessageRAMOffset=1706
|
FDCAN3.MessageRAMOffset=1706
|
||||||
FDCAN3.NominalPrescaler=24
|
FDCAN3.NominalPrescaler=3
|
||||||
FDCAN3.NominalSyncJumpWidth=10
|
FDCAN3.NominalSyncJumpWidth=10
|
||||||
FDCAN3.NominalTimeSeg1=2
|
FDCAN3.NominalTimeSeg1=29
|
||||||
FDCAN3.NominalTimeSeg2=2
|
FDCAN3.NominalTimeSeg2=10
|
||||||
FDCAN3.ProtocolException=ENABLE
|
FDCAN3.ProtocolException=DISABLE
|
||||||
FDCAN3.RxFifo1ElmtsNbr=32
|
FDCAN3.RxFifo0ElmtsNbr=4
|
||||||
FDCAN3.StdFiltersNbr=1
|
FDCAN3.RxFifo1ElmtsNbr=4
|
||||||
FDCAN3.TxFifoQueueElmtsNbr=6
|
FDCAN3.StdFiltersNbr=14
|
||||||
|
FDCAN3.TxFifoQueueElmtsNbr=32
|
||||||
FREERTOS.FootprintOK=true
|
FREERTOS.FootprintOK=true
|
||||||
FREERTOS.IPParameters=Tasks01,configENABLE_FPU,FootprintOK,configUSE_NEWLIB_REENTRANT,configCHECK_FOR_STACK_OVERFLOW,configUSE_MALLOC_FAILED_HOOK
|
FREERTOS.IPParameters=Tasks01,configENABLE_FPU,FootprintOK,configUSE_NEWLIB_REENTRANT,configCHECK_FOR_STACK_OVERFLOW,configUSE_MALLOC_FAILED_HOOK,configTOTAL_HEAP_SIZE,configMINIMAL_STACK_SIZE
|
||||||
FREERTOS.Tasks01=BeginTask,24,256,StartDefaultTask,As weak,NULL,Dynamic,NULL,NULL;shoot,24,512,ShootTask,As weak,NULL,Dynamic,NULL,NULL;gimbal,24,512,GimbalTask,As weak,NULL,Dynamic,NULL,NULL;chassis,24,512,ChassisTask,As weak,NULL,Dynamic,NULL,NULL;init,40,256,StartInitTask,As weak,NULL,Dynamic,NULL,NULL;vision,24,512,VisionTask,As weak,NULL,Dynamic,NULL,NULL;cmd,24,512,CmdTask,As weak,NULL,Dynamic,NULL,NULL;reference,24,512,RefereeTask,As weak,NULL,Dynamic,NULL,NULL
|
FREERTOS.Tasks01=BeginTask,24,256,StartDefaultTask,As weak,NULL,Dynamic,NULL,NULL;shoot,24,512,ShootTask,As weak,NULL,Dynamic,NULL,NULL;gimbal,24,512,GimbalTask,As weak,NULL,Dynamic,NULL,NULL;chassis,24,512,ChassisTask,As weak,NULL,Dynamic,NULL,NULL;init,40,256,StartInitTask,As weak,NULL,Dynamic,NULL,NULL;vision,24,512,VisionTask,As weak,NULL,Dynamic,NULL,NULL;cmd,24,512,CmdTask,As weak,NULL,Dynamic,NULL,NULL;reference,24,512,RefereeTask,As weak,NULL,Dynamic,NULL,NULL;WS2812Task,16,256,ws2812Task,As external,NULL,Dynamic,NULL,NULL
|
||||||
FREERTOS.configCHECK_FOR_STACK_OVERFLOW=2
|
FREERTOS.configCHECK_FOR_STACK_OVERFLOW=2
|
||||||
FREERTOS.configENABLE_FPU=1
|
FREERTOS.configENABLE_FPU=1
|
||||||
|
FREERTOS.configMINIMAL_STACK_SIZE=256
|
||||||
|
FREERTOS.configTOTAL_HEAP_SIZE=30720
|
||||||
FREERTOS.configUSE_MALLOC_FAILED_HOOK=1
|
FREERTOS.configUSE_MALLOC_FAILED_HOOK=1
|
||||||
FREERTOS.configUSE_NEWLIB_REENTRANT=0
|
FREERTOS.configUSE_NEWLIB_REENTRANT=0
|
||||||
File.Version=6
|
File.Version=6
|
||||||
@@ -410,10 +452,11 @@ MMTAppReg6.MEMORYMAP.Size=1048576
|
|||||||
MMTAppReg6.MEMORYMAP.StartAddress=0x08000000
|
MMTAppReg6.MEMORYMAP.StartAddress=0x08000000
|
||||||
MMTAppRegionsCount=6
|
MMTAppRegionsCount=6
|
||||||
MMTConfigApplied=false
|
MMTConfigApplied=false
|
||||||
|
MMTSectionSuffix=
|
||||||
Mcu.CPN=STM32H723VGT6
|
Mcu.CPN=STM32H723VGT6
|
||||||
Mcu.Family=STM32H7
|
Mcu.Family=STM32H7
|
||||||
Mcu.IP0=ADC3
|
Mcu.IP0=ADC1
|
||||||
Mcu.IP1=CORTEX_M7
|
Mcu.IP1=ADC3
|
||||||
Mcu.IP10=NVIC
|
Mcu.IP10=NVIC
|
||||||
Mcu.IP11=RCC
|
Mcu.IP11=RCC
|
||||||
Mcu.IP12=SPI1
|
Mcu.IP12=SPI1
|
||||||
@@ -424,90 +467,95 @@ Mcu.IP16=TIM3
|
|||||||
Mcu.IP17=TIM12
|
Mcu.IP17=TIM12
|
||||||
Mcu.IP18=UART5
|
Mcu.IP18=UART5
|
||||||
Mcu.IP19=UART7
|
Mcu.IP19=UART7
|
||||||
Mcu.IP2=CRC
|
Mcu.IP2=CORTEX_M7
|
||||||
Mcu.IP20=USART1
|
Mcu.IP20=USART1
|
||||||
Mcu.IP21=USART2
|
Mcu.IP21=USART2
|
||||||
Mcu.IP22=USART3
|
Mcu.IP22=USART3
|
||||||
Mcu.IP23=USART10
|
Mcu.IP23=USART10
|
||||||
Mcu.IP24=USB_DEVICE
|
Mcu.IP24=USB_DEVICE
|
||||||
Mcu.IP25=USB_OTG_HS
|
Mcu.IP25=USB_OTG_HS
|
||||||
Mcu.IP3=DMA
|
Mcu.IP3=CRC
|
||||||
Mcu.IP4=FDCAN1
|
Mcu.IP4=DMA
|
||||||
Mcu.IP5=FDCAN2
|
Mcu.IP5=FDCAN1
|
||||||
Mcu.IP6=FDCAN3
|
Mcu.IP6=FDCAN2
|
||||||
Mcu.IP7=FREERTOS
|
Mcu.IP7=FDCAN3
|
||||||
Mcu.IP8=IWDG1
|
Mcu.IP8=FREERTOS
|
||||||
Mcu.IP9=MEMORYMAP
|
Mcu.IP9=MEMORYMAP
|
||||||
Mcu.IPNb=26
|
Mcu.IPNb=26
|
||||||
Mcu.Name=STM32H723VGTx
|
Mcu.Name=STM32H723VGTx
|
||||||
Mcu.Package=LQFP100
|
Mcu.Package=LQFP100
|
||||||
Mcu.Pin0=PE2
|
Mcu.Pin0=PE2
|
||||||
Mcu.Pin1=PE3
|
Mcu.Pin1=PE3
|
||||||
Mcu.Pin10=PA0
|
Mcu.Pin10=PC3_C
|
||||||
Mcu.Pin11=PA2
|
Mcu.Pin11=PA0
|
||||||
Mcu.Pin12=PA6
|
Mcu.Pin12=PA2
|
||||||
Mcu.Pin13=PA7
|
Mcu.Pin13=PA5
|
||||||
Mcu.Pin14=PB1
|
Mcu.Pin14=PA6
|
||||||
Mcu.Pin15=PE7
|
Mcu.Pin15=PA7
|
||||||
Mcu.Pin16=PE8
|
Mcu.Pin16=PC4
|
||||||
Mcu.Pin17=PE9
|
Mcu.Pin17=PB1
|
||||||
Mcu.Pin18=PE10
|
Mcu.Pin18=PE7
|
||||||
Mcu.Pin19=PE12
|
Mcu.Pin19=PE8
|
||||||
Mcu.Pin2=PC14-OSC32_IN
|
Mcu.Pin2=PC13
|
||||||
Mcu.Pin20=PE13
|
Mcu.Pin20=PE9
|
||||||
Mcu.Pin21=PE15
|
Mcu.Pin21=PE10
|
||||||
Mcu.Pin22=PB10
|
Mcu.Pin22=PE12
|
||||||
Mcu.Pin23=PB11
|
Mcu.Pin23=PE13
|
||||||
Mcu.Pin24=PB13
|
Mcu.Pin24=PE15
|
||||||
Mcu.Pin25=PB14
|
Mcu.Pin25=PB10
|
||||||
Mcu.Pin26=PB15
|
Mcu.Pin26=PB11
|
||||||
Mcu.Pin27=PD8
|
Mcu.Pin27=PB13
|
||||||
Mcu.Pin28=PD9
|
Mcu.Pin28=PB15
|
||||||
Mcu.Pin29=PD10
|
Mcu.Pin29=PD8
|
||||||
Mcu.Pin3=PC15-OSC32_OUT
|
Mcu.Pin3=PC14-OSC32_IN
|
||||||
Mcu.Pin30=PD12
|
Mcu.Pin30=PD9
|
||||||
Mcu.Pin31=PD13
|
Mcu.Pin31=PD10
|
||||||
Mcu.Pin32=PA8
|
Mcu.Pin32=PD12
|
||||||
Mcu.Pin33=PA9
|
Mcu.Pin33=PD13
|
||||||
Mcu.Pin34=PA10
|
Mcu.Pin34=PA8
|
||||||
Mcu.Pin35=PA11
|
Mcu.Pin35=PA9
|
||||||
Mcu.Pin36=PA12
|
Mcu.Pin36=PA10
|
||||||
Mcu.Pin37=PC10
|
Mcu.Pin37=PA11
|
||||||
Mcu.Pin38=PC11
|
Mcu.Pin38=PA12
|
||||||
Mcu.Pin39=PC12
|
Mcu.Pin39=PC10
|
||||||
Mcu.Pin4=PH0-OSC_IN
|
Mcu.Pin4=PC15-OSC32_OUT
|
||||||
Mcu.Pin40=PD0
|
Mcu.Pin40=PC11
|
||||||
Mcu.Pin41=PD1
|
Mcu.Pin41=PC12
|
||||||
Mcu.Pin42=PD2
|
Mcu.Pin42=PD0
|
||||||
Mcu.Pin43=PD4
|
Mcu.Pin43=PD1
|
||||||
Mcu.Pin44=PD5
|
Mcu.Pin44=PD2
|
||||||
Mcu.Pin45=PD6
|
Mcu.Pin45=PD4
|
||||||
Mcu.Pin46=PD7
|
Mcu.Pin46=PD5
|
||||||
Mcu.Pin47=PB3(JTDO/TRACESWO)
|
Mcu.Pin47=PD6
|
||||||
Mcu.Pin48=PB4(NJTRST)
|
Mcu.Pin48=PD7
|
||||||
Mcu.Pin49=PB5
|
Mcu.Pin49=PB3(JTDO/TRACESWO)
|
||||||
Mcu.Pin5=PH1-OSC_OUT
|
Mcu.Pin5=PH0-OSC_IN
|
||||||
Mcu.Pin50=PB6
|
Mcu.Pin50=PB4(NJTRST)
|
||||||
Mcu.Pin51=VP_ADC3_TempSens_Input
|
Mcu.Pin51=PB5
|
||||||
Mcu.Pin52=VP_CRC_VS_CRC
|
Mcu.Pin52=PB6
|
||||||
Mcu.Pin53=VP_FREERTOS_VS_CMSIS_V2
|
Mcu.Pin53=VP_ADC3_TempSens_Input
|
||||||
Mcu.Pin54=VP_IWDG1_VS_IWDG
|
Mcu.Pin54=VP_CRC_VS_CRC
|
||||||
Mcu.Pin55=VP_SYS_VS_tim23
|
Mcu.Pin55=VP_FREERTOS_VS_CMSIS_V2
|
||||||
Mcu.Pin56=VP_TIM1_VS_ClockSourceINT
|
Mcu.Pin56=VP_SYS_VS_tim23
|
||||||
Mcu.Pin57=VP_TIM1_VS_no_output3
|
Mcu.Pin57=VP_TIM1_VS_ClockSourceINT
|
||||||
Mcu.Pin58=VP_USB_DEVICE_VS_USB_DEVICE_CDC_HS
|
Mcu.Pin58=VP_TIM1_VS_no_output3
|
||||||
Mcu.Pin59=VP_MEMORYMAP_VS_MEMORYMAP
|
Mcu.Pin59=VP_USB_DEVICE_VS_USB_DEVICE_CDC_HS
|
||||||
Mcu.Pin6=PC0
|
Mcu.Pin6=PH1-OSC_OUT
|
||||||
Mcu.Pin7=PC1
|
Mcu.Pin60=VP_MEMORYMAP_VS_MEMORYMAP
|
||||||
Mcu.Pin8=PC2_C
|
Mcu.Pin61=VP_STMicroelectronics.X-CUBE-ALGOBUILD_VS_DSPOoLibraryJjLibrary_1.4.0_1.4.0
|
||||||
Mcu.Pin9=PC3_C
|
Mcu.Pin7=PC0
|
||||||
Mcu.PinsNb=60
|
Mcu.Pin8=PC1
|
||||||
Mcu.ThirdPartyNb=0
|
Mcu.Pin9=PC2_C
|
||||||
|
Mcu.PinsNb=62
|
||||||
|
Mcu.ThirdParty0=STMicroelectronics.X-CUBE-ALGOBUILD.1.4.0
|
||||||
|
Mcu.ThirdPartyNb=1
|
||||||
Mcu.UserConstants=
|
Mcu.UserConstants=
|
||||||
Mcu.UserName=STM32H723VGTx
|
Mcu.UserName=STM32H723VGTx
|
||||||
MxCube.Version=6.15.0
|
MxCube.Version=6.16.0
|
||||||
MxDb.Version=DB.6.0.150
|
MxDb.Version=DB.6.0.160
|
||||||
|
NVIC.ADC_IRQn=true\:5\:0\:false\:false\:true\:true\:true\:true\:true
|
||||||
NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false\:false
|
NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false\:false
|
||||||
|
NVIC.DMA1_Stream0_IRQn=true\:5\:0\:false\:false\:true\:true\:false\:true\:true
|
||||||
NVIC.DMA1_Stream1_IRQn=true\:5\:0\:false\:false\:true\:true\:false\:true\:true
|
NVIC.DMA1_Stream1_IRQn=true\:5\:0\:false\:false\:true\:true\:false\:true\:true
|
||||||
NVIC.DMA1_Stream2_IRQn=true\:5\:0\:false\:false\:true\:true\:false\:true\:true
|
NVIC.DMA1_Stream2_IRQn=true\:5\:0\:false\:false\:true\:true\:false\:true\:true
|
||||||
NVIC.DMA1_Stream3_IRQn=true\:5\:0\:false\:false\:true\:true\:false\:true\:true
|
NVIC.DMA1_Stream3_IRQn=true\:5\:0\:false\:false\:true\:true\:false\:true\:true
|
||||||
@@ -524,8 +572,11 @@ NVIC.DMA2_Stream6_IRQn=true\:5\:0\:false\:false\:true\:true\:false\:true\:true
|
|||||||
NVIC.DMA2_Stream7_IRQn=true\:5\:0\:false\:false\:true\:true\:false\:true\:true
|
NVIC.DMA2_Stream7_IRQn=true\:5\:0\:false\:false\:true\:true\:false\:true\:true
|
||||||
NVIC.DebugMonitor_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false\:false
|
NVIC.DebugMonitor_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false\:false
|
||||||
NVIC.FDCAN1_IT0_IRQn=true\:5\:0\:false\:false\:true\:true\:true\:true\:true
|
NVIC.FDCAN1_IT0_IRQn=true\:5\:0\:false\:false\:true\:true\:true\:true\:true
|
||||||
|
NVIC.FDCAN1_IT1_IRQn=true\:5\:0\:false\:false\:true\:true\:true\:true\:true
|
||||||
NVIC.FDCAN2_IT0_IRQn=true\:5\:0\:false\:false\:true\:true\:true\:true\:true
|
NVIC.FDCAN2_IT0_IRQn=true\:5\:0\:false\:false\:true\:true\:true\:true\:true
|
||||||
|
NVIC.FDCAN2_IT1_IRQn=true\:5\:0\:false\:false\:true\:true\:true\:true\:true
|
||||||
NVIC.FDCAN3_IT0_IRQn=true\:5\:0\:false\:false\:true\:true\:true\:true\:true
|
NVIC.FDCAN3_IT0_IRQn=true\:5\:0\:false\:false\:true\:true\:true\:true\:true
|
||||||
|
NVIC.FDCAN3_IT1_IRQn=true\:5\:0\:false\:false\:true\:true\:true\:true\:true
|
||||||
NVIC.ForceEnableDMAVector=true
|
NVIC.ForceEnableDMAVector=true
|
||||||
NVIC.HardFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false\:false
|
NVIC.HardFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false\:false
|
||||||
NVIC.MemoryManagement_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false\:false
|
NVIC.MemoryManagement_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false\:false
|
||||||
@@ -551,7 +602,7 @@ NVIC.USART2_IRQn=true\:5\:0\:false\:false\:true\:true\:true\:true\:true
|
|||||||
NVIC.USART3_IRQn=true\:5\:0\:false\:false\:true\:true\:true\:true\:true
|
NVIC.USART3_IRQn=true\:5\:0\:false\:false\:true\:true\:true\:true\:true
|
||||||
NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false\:false
|
NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false\:false
|
||||||
PA0.GPIOParameters=GPIO_Speed,PinState,GPIO_PuPd,GPIO_Label
|
PA0.GPIOParameters=GPIO_Speed,PinState,GPIO_PuPd,GPIO_Label
|
||||||
PA0.GPIO_Label=pump1
|
PA0.GPIO_Label=power2
|
||||||
PA0.GPIO_PuPd=GPIO_PULLDOWN
|
PA0.GPIO_PuPd=GPIO_PULLDOWN
|
||||||
PA0.GPIO_Speed=GPIO_SPEED_FREQ_HIGH
|
PA0.GPIO_Speed=GPIO_SPEED_FREQ_HIGH
|
||||||
PA0.Locked=true
|
PA0.Locked=true
|
||||||
@@ -566,15 +617,15 @@ PA12.Locked=true
|
|||||||
PA12.Mode=Device_Only_FS
|
PA12.Mode=Device_Only_FS
|
||||||
PA12.Signal=USB_OTG_HS_DP
|
PA12.Signal=USB_OTG_HS_DP
|
||||||
PA2.GPIOParameters=GPIO_Speed,PinState,GPIO_PuPd,GPIO_Label
|
PA2.GPIOParameters=GPIO_Speed,PinState,GPIO_PuPd,GPIO_Label
|
||||||
PA2.GPIO_Label=pump2
|
PA2.GPIO_Label=power1
|
||||||
PA2.GPIO_PuPd=GPIO_PULLDOWN
|
PA2.GPIO_PuPd=GPIO_PULLDOWN
|
||||||
PA2.GPIO_Speed=GPIO_SPEED_FREQ_HIGH
|
PA2.GPIO_Speed=GPIO_SPEED_FREQ_HIGH
|
||||||
PA2.Locked=true
|
PA2.Locked=true
|
||||||
PA2.PinState=GPIO_PIN_SET
|
PA2.PinState=GPIO_PIN_SET
|
||||||
PA2.Signal=GPIO_Output
|
PA2.Signal=GPIO_Output
|
||||||
PA6.Mode=Full_Duplex_Master
|
PA5.Signal=ADCx_INP19
|
||||||
PA6.Signal=SPI6_MISO
|
PA6.Signal=GPIO_Input
|
||||||
PA7.Mode=Full_Duplex_Master
|
PA7.Mode=TX_Only_Simplex_Unidirect_Master
|
||||||
PA7.Signal=SPI6_MOSI
|
PA7.Signal=SPI6_MOSI
|
||||||
PA8.Mode=Clock-out-1
|
PA8.Mode=Clock-out-1
|
||||||
PA8.Signal=RCC_MCO_1
|
PA8.Signal=RCC_MCO_1
|
||||||
@@ -601,12 +652,14 @@ PB13.GPIO_Speed=GPIO_SPEED_FREQ_VERY_HIGH
|
|||||||
PB13.Locked=true
|
PB13.Locked=true
|
||||||
PB13.Mode=Full_Duplex_Master
|
PB13.Mode=Full_Duplex_Master
|
||||||
PB13.Signal=SPI2_SCK
|
PB13.Signal=SPI2_SCK
|
||||||
PB14.Mode=Hardware Flow Control (RS485)
|
|
||||||
PB14.Signal=USART3_DE
|
|
||||||
PB15.Signal=S_TIM12_CH2
|
PB15.Signal=S_TIM12_CH2
|
||||||
|
PB3(JTDO/TRACESWO).GPIOParameters=GPIO_Speed
|
||||||
|
PB3(JTDO/TRACESWO).GPIO_Speed=GPIO_SPEED_FREQ_VERY_HIGH
|
||||||
PB3(JTDO/TRACESWO).Locked=true
|
PB3(JTDO/TRACESWO).Locked=true
|
||||||
PB3(JTDO/TRACESWO).Mode=Full_Duplex_Master
|
PB3(JTDO/TRACESWO).Mode=Full_Duplex_Master
|
||||||
PB3(JTDO/TRACESWO).Signal=SPI1_SCK
|
PB3(JTDO/TRACESWO).Signal=SPI1_SCK
|
||||||
|
PB4(NJTRST).GPIOParameters=GPIO_Speed
|
||||||
|
PB4(NJTRST).GPIO_Speed=GPIO_SPEED_FREQ_VERY_HIGH
|
||||||
PB4(NJTRST).Locked=true
|
PB4(NJTRST).Locked=true
|
||||||
PB4(NJTRST).Mode=Full_Duplex_Master
|
PB4(NJTRST).Mode=Full_Duplex_Master
|
||||||
PB4(NJTRST).Signal=SPI1_MISO
|
PB4(NJTRST).Signal=SPI1_MISO
|
||||||
@@ -616,10 +669,11 @@ PB5.Signal=FDCAN2_RX
|
|||||||
PB6.Locked=true
|
PB6.Locked=true
|
||||||
PB6.Mode=FDCAN_Activate
|
PB6.Mode=FDCAN_Activate
|
||||||
PB6.Signal=FDCAN2_TX
|
PB6.Signal=FDCAN2_TX
|
||||||
PC0.GPIOParameters=GPIO_Speed,GPIO_Label
|
PC0.GPIOParameters=GPIO_Speed,PinState,GPIO_Label
|
||||||
PC0.GPIO_Label=ACC_CS
|
PC0.GPIO_Label=ACC_CS
|
||||||
PC0.GPIO_Speed=GPIO_SPEED_FREQ_VERY_HIGH
|
PC0.GPIO_Speed=GPIO_SPEED_FREQ_VERY_HIGH
|
||||||
PC0.Locked=true
|
PC0.Locked=true
|
||||||
|
PC0.PinState=GPIO_PIN_SET
|
||||||
PC0.Signal=GPIO_Output
|
PC0.Signal=GPIO_Output
|
||||||
PC1.GPIOParameters=GPIO_Speed
|
PC1.GPIOParameters=GPIO_Speed
|
||||||
PC1.GPIO_Speed=GPIO_SPEED_FREQ_VERY_HIGH
|
PC1.GPIO_Speed=GPIO_SPEED_FREQ_VERY_HIGH
|
||||||
@@ -632,9 +686,18 @@ PC11.Signal=SPI3_MISO
|
|||||||
PC12.Locked=true
|
PC12.Locked=true
|
||||||
PC12.Signal=SharedStack_PC12
|
PC12.Signal=SharedStack_PC12
|
||||||
PC12.Stacked=true
|
PC12.Stacked=true
|
||||||
|
PC13.GPIOParameters=PinState,GPIO_Label
|
||||||
|
PC13.GPIO_Label=Power2
|
||||||
|
PC13.Locked=true
|
||||||
|
PC13.PinState=GPIO_PIN_SET
|
||||||
|
PC13.Signal=GPIO_Output
|
||||||
|
PC14-OSC32_IN.GPIOParameters=PinState,GPIO_Label
|
||||||
|
PC14-OSC32_IN.GPIO_Label=Power1
|
||||||
PC14-OSC32_IN.Locked=true
|
PC14-OSC32_IN.Locked=true
|
||||||
|
PC14-OSC32_IN.PinState=GPIO_PIN_SET
|
||||||
PC14-OSC32_IN.Signal=GPIO_Output
|
PC14-OSC32_IN.Signal=GPIO_Output
|
||||||
PC15-OSC32_OUT.GPIOParameters=PinState
|
PC15-OSC32_OUT.GPIOParameters=PinState,GPIO_Label
|
||||||
|
PC15-OSC32_OUT.GPIO_Label=Power_5V_EN
|
||||||
PC15-OSC32_OUT.Locked=true
|
PC15-OSC32_OUT.Locked=true
|
||||||
PC15-OSC32_OUT.PinState=GPIO_PIN_SET
|
PC15-OSC32_OUT.PinState=GPIO_PIN_SET
|
||||||
PC15-OSC32_OUT.Signal=GPIO_Output
|
PC15-OSC32_OUT.Signal=GPIO_Output
|
||||||
@@ -648,6 +711,8 @@ PC3_C.GPIO_Speed=GPIO_SPEED_FREQ_VERY_HIGH
|
|||||||
PC3_C.Locked=true
|
PC3_C.Locked=true
|
||||||
PC3_C.PinState=GPIO_PIN_SET
|
PC3_C.PinState=GPIO_PIN_SET
|
||||||
PC3_C.Signal=GPIO_Output
|
PC3_C.Signal=GPIO_Output
|
||||||
|
PC4.Locked=true
|
||||||
|
PC4.Signal=ADCx_INP4
|
||||||
PD0.Mode=FDCAN_Activate
|
PD0.Mode=FDCAN_Activate
|
||||||
PD0.Signal=FDCAN1_RX
|
PD0.Signal=FDCAN1_RX
|
||||||
PD1.Mode=FDCAN_Activate
|
PD1.Mode=FDCAN_Activate
|
||||||
@@ -675,6 +740,8 @@ PD5.Signal=USART2_TX
|
|||||||
PD6.Locked=true
|
PD6.Locked=true
|
||||||
PD6.Mode=Asynchronous
|
PD6.Mode=Asynchronous
|
||||||
PD6.Signal=USART2_RX
|
PD6.Signal=USART2_RX
|
||||||
|
PD7.GPIOParameters=GPIO_Speed
|
||||||
|
PD7.GPIO_Speed=GPIO_SPEED_FREQ_VERY_HIGH
|
||||||
PD7.Locked=true
|
PD7.Locked=true
|
||||||
PD7.Mode=Full_Duplex_Master
|
PD7.Mode=Full_Duplex_Master
|
||||||
PD7.Signal=SPI1_MOSI
|
PD7.Signal=SPI1_MOSI
|
||||||
@@ -724,7 +791,7 @@ PH1-OSC_OUT.Signal=RCC_OSC_OUT
|
|||||||
PinOutPanel.RotationAngle=0
|
PinOutPanel.RotationAngle=0
|
||||||
ProjectManager.AskForMigrate=true
|
ProjectManager.AskForMigrate=true
|
||||||
ProjectManager.BackupPrevious=false
|
ProjectManager.BackupPrevious=false
|
||||||
ProjectManager.CompilerLinker=Starm-Clang
|
ProjectManager.CompilerLinker=GCC
|
||||||
ProjectManager.CompilerOptimize=6
|
ProjectManager.CompilerOptimize=6
|
||||||
ProjectManager.ComputerToolchain=false
|
ProjectManager.ComputerToolchain=false
|
||||||
ProjectManager.CoupleFile=true
|
ProjectManager.CoupleFile=true
|
||||||
@@ -734,6 +801,7 @@ ProjectManager.DeletePrevious=true
|
|||||||
ProjectManager.DeviceId=STM32H723VGTx
|
ProjectManager.DeviceId=STM32H723VGTx
|
||||||
ProjectManager.FirmwarePackage=STM32Cube FW_H7 V1.12.1
|
ProjectManager.FirmwarePackage=STM32Cube FW_H7 V1.12.1
|
||||||
ProjectManager.FreePins=false
|
ProjectManager.FreePins=false
|
||||||
|
ProjectManager.FreePinsContext=
|
||||||
ProjectManager.HalAssertFull=false
|
ProjectManager.HalAssertFull=false
|
||||||
ProjectManager.HeapSize=0x4000
|
ProjectManager.HeapSize=0x4000
|
||||||
ProjectManager.KeepUserCode=true
|
ProjectManager.KeepUserCode=true
|
||||||
@@ -753,7 +821,7 @@ ProjectManager.ToolChainLocation=
|
|||||||
ProjectManager.UAScriptAfterPath=
|
ProjectManager.UAScriptAfterPath=
|
||||||
ProjectManager.UAScriptBeforePath=
|
ProjectManager.UAScriptBeforePath=
|
||||||
ProjectManager.UnderRoot=false
|
ProjectManager.UnderRoot=false
|
||||||
ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false,2-MX_GPIO_Init-GPIO-false-HAL-true,3-MX_DMA_Init-DMA-false-HAL-true,4-MX_FDCAN2_Init-FDCAN2-false-HAL-true,5-MX_FDCAN3_Init-FDCAN3-false-HAL-true,6-MX_CRC_Init-CRC-false-HAL-true,7-MX_USB_DEVICE_Init-USB_DEVICE-false-HAL-false,8-MX_FDCAN1_Init-FDCAN1-false-HAL-true,9-MX_USART10_UART_Init-USART10-false-HAL-true,10-MX_SPI2_Init-SPI2-false-HAL-true,11-MX_TIM12_Init-TIM12-false-HAL-true,12-MX_UART7_Init-UART7-false-HAL-true,13-MX_TIM1_Init-TIM1-false-HAL-true,14-MX_USART1_UART_Init-USART1-false-HAL-true,15-MX_ADC3_Init-ADC3-false-HAL-true,16-MX_USART2_UART_Init-USART2-false-HAL-true,17-MX_USART3_UART_Init-USART3-false-HAL-true,18-MX_SPI1_Init-SPI1-false-HAL-true,19-MX_UART5_Init-UART5-false-HAL-true,20-MX_TIM3_Init-TIM3-false-HAL-true,21-MX_IWDG1_Init-IWDG1-false-HAL-true,0-MX_CORTEX_M7_Init-CORTEX_M7-false-HAL-true
|
ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false,2-MX_GPIO_Init-GPIO-false-HAL-true,3-MX_DMA_Init-DMA-false-HAL-true,4-MX_FDCAN2_Init-FDCAN2-false-HAL-true,5-MX_FDCAN3_Init-FDCAN3-false-HAL-true,6-MX_CRC_Init-CRC-false-HAL-true,7-MX_USB_DEVICE_Init-USB_DEVICE-false-HAL-false,8-MX_FDCAN1_Init-FDCAN1-false-HAL-true,9-MX_USART10_UART_Init-USART10-false-HAL-true,10-MX_SPI2_Init-SPI2-false-HAL-true,11-MX_TIM12_Init-TIM12-false-HAL-true,12-MX_UART7_Init-UART7-false-HAL-true,13-MX_TIM1_Init-TIM1-false-HAL-true,14-MX_USART1_UART_Init-USART1-false-HAL-true,15-MX_ADC3_Init-ADC3-false-HAL-true,16-MX_USART2_UART_Init-USART2-false-HAL-true,17-MX_USART3_UART_Init-USART3-false-HAL-true,18-MX_SPI1_Init-SPI1-false-HAL-true,19-MX_UART5_Init-UART5-false-HAL-true,20-MX_TIM3_Init-TIM3-false-HAL-true,21-MX_ADC1_Init-ADC1-false-HAL-true,0-MX_CORTEX_M7_Init-CORTEX_M7-false-HAL-true
|
||||||
RCC.ADCFreq_Value=96000000
|
RCC.ADCFreq_Value=96000000
|
||||||
RCC.AHB12Freq_Value=240000000
|
RCC.AHB12Freq_Value=240000000
|
||||||
RCC.AHB4Freq_Value=240000000
|
RCC.AHB4Freq_Value=240000000
|
||||||
@@ -837,6 +905,10 @@ RCC.VCO3OutputFreq_Value=96750000
|
|||||||
RCC.VCOInput1Freq_Value=12000000
|
RCC.VCOInput1Freq_Value=12000000
|
||||||
RCC.VCOInput2Freq_Value=12000000
|
RCC.VCOInput2Freq_Value=12000000
|
||||||
RCC.VCOInput3Freq_Value=750000
|
RCC.VCOInput3Freq_Value=750000
|
||||||
|
SH.ADCx_INP19.0=ADC1_INP19,IN19-Single-Ended
|
||||||
|
SH.ADCx_INP19.ConfNb=1
|
||||||
|
SH.ADCx_INP4.0=ADC1_INP4,IN4-Single-Ended
|
||||||
|
SH.ADCx_INP4.ConfNb=1
|
||||||
SH.GPXTI10.0=GPIO_EXTI10
|
SH.GPXTI10.0=GPIO_EXTI10
|
||||||
SH.GPXTI10.ConfNb=1
|
SH.GPXTI10.ConfNb=1
|
||||||
SH.GPXTI12.0=GPIO_EXTI12
|
SH.GPXTI12.0=GPIO_EXTI12
|
||||||
@@ -848,11 +920,12 @@ SH.S_TIM3_CH4.ConfNb=1
|
|||||||
SH.SharedStack_PC12.0=SPI3_MOSI
|
SH.SharedStack_PC12.0=SPI3_MOSI
|
||||||
SH.SharedStack_PC12.1=UART5_TX,Asynchronous
|
SH.SharedStack_PC12.1=UART5_TX,Asynchronous
|
||||||
SH.SharedStack_PC12.ConfNb=2
|
SH.SharedStack_PC12.ConfNb=2
|
||||||
SPI1.BaudRatePrescaler=SPI_BAUDRATEPRESCALER_16
|
SPI1.BaudRatePrescaler=SPI_BAUDRATEPRESCALER_2
|
||||||
SPI1.CalculateBaudRate=7.5 MBits/s
|
SPI1.CLKPolarity=SPI_POLARITY_LOW
|
||||||
SPI1.DataSize=SPI_DATASIZE_16BIT
|
SPI1.CalculateBaudRate=60 MBits/s
|
||||||
|
SPI1.DataSize=SPI_DATASIZE_8BIT
|
||||||
SPI1.Direction=SPI_DIRECTION_2LINES
|
SPI1.Direction=SPI_DIRECTION_2LINES
|
||||||
SPI1.IPParameters=VirtualType,Mode,Direction,CalculateBaudRate,DataSize,BaudRatePrescaler
|
SPI1.IPParameters=VirtualType,Mode,Direction,CalculateBaudRate,DataSize,BaudRatePrescaler,CLKPolarity
|
||||||
SPI1.Mode=SPI_MODE_MASTER
|
SPI1.Mode=SPI_MODE_MASTER
|
||||||
SPI1.VirtualType=VM_MASTER
|
SPI1.VirtualType=VM_MASTER
|
||||||
SPI2.BaudRatePrescaler=SPI_BAUDRATEPRESCALER_32
|
SPI2.BaudRatePrescaler=SPI_BAUDRATEPRESCALER_32
|
||||||
@@ -865,6 +938,10 @@ SPI2.IPParameters=VirtualType,Mode,Direction,CalculateBaudRate,DataSize,BaudRate
|
|||||||
SPI2.Mode=SPI_MODE_MASTER
|
SPI2.Mode=SPI_MODE_MASTER
|
||||||
SPI2.NSSPMode=SPI_NSS_PULSE_ENABLE
|
SPI2.NSSPMode=SPI_NSS_PULSE_ENABLE
|
||||||
SPI2.VirtualType=VM_MASTER
|
SPI2.VirtualType=VM_MASTER
|
||||||
|
STMicroelectronics.X-CUBE-ALGOBUILD.1.4.0.DSPOoLibraryJjLibrary_Checked=true
|
||||||
|
STMicroelectronics.X-CUBE-ALGOBUILD.1.4.0.IPParameters=LibraryCcDSPOoLibraryJjDSPOoLibrary
|
||||||
|
STMicroelectronics.X-CUBE-ALGOBUILD.1.4.0.LibraryCcDSPOoLibraryJjDSPOoLibrary=true
|
||||||
|
STMicroelectronics.X-CUBE-ALGOBUILD.1.4.0_SwParameter=LibraryCcDSPOoLibraryJjDSPOoLibrary\:true;
|
||||||
TIM1.Channel-PWM\ Generation3\ No\ Output=TIM_CHANNEL_3
|
TIM1.Channel-PWM\ Generation3\ No\ Output=TIM_CHANNEL_3
|
||||||
TIM1.IPParameters=Channel-PWM Generation3 No Output,Prescaler,Period
|
TIM1.IPParameters=Channel-PWM Generation3 No Output,Prescaler,Period
|
||||||
TIM1.Period=1999
|
TIM1.Period=1999
|
||||||
@@ -880,9 +957,10 @@ TIM3.IPParameters=Channel-PWM Generation4 CH4,Prescaler,Period,AutoReloadPreload
|
|||||||
TIM3.Period=10000-1
|
TIM3.Period=10000-1
|
||||||
TIM3.Prescaler=24-1
|
TIM3.Prescaler=24-1
|
||||||
UART5.BaudRate=100000
|
UART5.BaudRate=100000
|
||||||
UART5.IPParameters=Mode,BaudRate,WordLength,Parity
|
UART5.IPParameters=Mode,BaudRate,WordLength,Parity,StopBits
|
||||||
UART5.Mode=MODE_RX
|
UART5.Mode=MODE_RX
|
||||||
UART5.Parity=PARITY_EVEN
|
UART5.Parity=PARITY_EVEN
|
||||||
|
UART5.StopBits=UART_STOPBITS_2
|
||||||
UART5.WordLength=WORDLENGTH_9B
|
UART5.WordLength=WORDLENGTH_9B
|
||||||
UART7.BaudRate=921600
|
UART7.BaudRate=921600
|
||||||
UART7.DMADisableonRxErrorParam=UART_ADVFEATURE_DMA_ENABLEONRXERROR
|
UART7.DMADisableonRxErrorParam=UART_ADVFEATURE_DMA_ENABLEONRXERROR
|
||||||
@@ -903,10 +981,9 @@ USART2.OverrunDisableParam=ADVFEATURE_OVERRUN_DISABLE
|
|||||||
USART2.VirtualMode-Asynchronous=VM_ASYNC
|
USART2.VirtualMode-Asynchronous=VM_ASYNC
|
||||||
USART2.VirtualMode-Hardware\ Flow\ Control\ (RS485)=VM_ASYNC
|
USART2.VirtualMode-Hardware\ Flow\ Control\ (RS485)=VM_ASYNC
|
||||||
USART3.BaudRate=4800000
|
USART3.BaudRate=4800000
|
||||||
USART3.IPParameters=VirtualMode-Asynchronous,VirtualMode-Hardware Flow Control (RS485),BaudRate,OverrunDisableParam
|
USART3.IPParameters=VirtualMode-Asynchronous,BaudRate,OverrunDisableParam
|
||||||
USART3.OverrunDisableParam=ADVFEATURE_OVERRUN_DISABLE
|
USART3.OverrunDisableParam=ADVFEATURE_OVERRUN_DISABLE
|
||||||
USART3.VirtualMode-Asynchronous=VM_ASYNC
|
USART3.VirtualMode-Asynchronous=VM_ASYNC
|
||||||
USART3.VirtualMode-Hardware\ Flow\ Control\ (RS485)=VM_ASYNC
|
|
||||||
USB_DEVICE.CLASS_NAME_HS=CDC
|
USB_DEVICE.CLASS_NAME_HS=CDC
|
||||||
USB_DEVICE.IPParameters=VirtualMode,VirtualModeHS,CLASS_NAME_HS
|
USB_DEVICE.IPParameters=VirtualMode,VirtualModeHS,CLASS_NAME_HS
|
||||||
USB_DEVICE.VirtualMode=Cdc
|
USB_DEVICE.VirtualMode=Cdc
|
||||||
@@ -919,10 +996,10 @@ VP_CRC_VS_CRC.Mode=CRC_Activate
|
|||||||
VP_CRC_VS_CRC.Signal=CRC_VS_CRC
|
VP_CRC_VS_CRC.Signal=CRC_VS_CRC
|
||||||
VP_FREERTOS_VS_CMSIS_V2.Mode=CMSIS_V2
|
VP_FREERTOS_VS_CMSIS_V2.Mode=CMSIS_V2
|
||||||
VP_FREERTOS_VS_CMSIS_V2.Signal=FREERTOS_VS_CMSIS_V2
|
VP_FREERTOS_VS_CMSIS_V2.Signal=FREERTOS_VS_CMSIS_V2
|
||||||
VP_IWDG1_VS_IWDG.Mode=IWDG_Activate
|
|
||||||
VP_IWDG1_VS_IWDG.Signal=IWDG1_VS_IWDG
|
|
||||||
VP_MEMORYMAP_VS_MEMORYMAP.Mode=CurAppReg
|
VP_MEMORYMAP_VS_MEMORYMAP.Mode=CurAppReg
|
||||||
VP_MEMORYMAP_VS_MEMORYMAP.Signal=MEMORYMAP_VS_MEMORYMAP
|
VP_MEMORYMAP_VS_MEMORYMAP.Signal=MEMORYMAP_VS_MEMORYMAP
|
||||||
|
VP_STMicroelectronics.X-CUBE-ALGOBUILD_VS_DSPOoLibraryJjLibrary_1.4.0_1.4.0.Mode=DSPOoLibraryJjLibrary
|
||||||
|
VP_STMicroelectronics.X-CUBE-ALGOBUILD_VS_DSPOoLibraryJjLibrary_1.4.0_1.4.0.Signal=STMicroelectronics.X-CUBE-ALGOBUILD_VS_DSPOoLibraryJjLibrary_1.4.0_1.4.0
|
||||||
VP_SYS_VS_tim23.Mode=TIM23
|
VP_SYS_VS_tim23.Mode=TIM23
|
||||||
VP_SYS_VS_tim23.Signal=SYS_VS_tim23
|
VP_SYS_VS_tim23.Signal=SYS_VS_tim23
|
||||||
VP_TIM1_VS_ClockSourceINT.Mode=Internal
|
VP_TIM1_VS_ClockSourceINT.Mode=Internal
|
||||||
|
|||||||
@@ -31,7 +31,8 @@
|
|||||||
|
|
||||||
/* USER CODE BEGIN PV */
|
/* USER CODE BEGIN PV */
|
||||||
/* Private variables ---------------------------------------------------------*/
|
/* Private variables ---------------------------------------------------------*/
|
||||||
|
static USBCallback tx_cbk = NULL;
|
||||||
|
static USBCallback rx_cbk = NULL;
|
||||||
/* USER CODE END PV */
|
/* USER CODE END PV */
|
||||||
|
|
||||||
/** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY
|
/** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY
|
||||||
@@ -183,7 +184,7 @@ static int8_t CDC_DeInit_HS(void)
|
|||||||
static int8_t CDC_Control_HS(uint8_t cmd, uint8_t* pbuf, uint16_t length)
|
static int8_t CDC_Control_HS(uint8_t cmd, uint8_t* pbuf, uint16_t length)
|
||||||
{
|
{
|
||||||
/* USER CODE BEGIN 10 */
|
/* USER CODE BEGIN 10 */
|
||||||
switch(cmd)
|
switch (cmd)
|
||||||
{
|
{
|
||||||
case CDC_SEND_ENCAPSULATED_COMMAND:
|
case CDC_SEND_ENCAPSULATED_COMMAND:
|
||||||
|
|
||||||
@@ -281,8 +282,9 @@ uint8_t CDC_Transmit_HS(uint8_t* Buf, uint16_t Len)
|
|||||||
{
|
{
|
||||||
uint8_t result = USBD_OK;
|
uint8_t result = USBD_OK;
|
||||||
/* USER CODE BEGIN 12 */
|
/* USER CODE BEGIN 12 */
|
||||||
USBD_CDC_HandleTypeDef *hcdc = (USBD_CDC_HandleTypeDef*)hUsbDeviceHS.pClassData;
|
USBD_CDC_HandleTypeDef *hcdc = (USBD_CDC_HandleTypeDef *) hUsbDeviceHS.pClassData;
|
||||||
if (hcdc->TxState != 0){
|
if (hcdc->TxState != 0)
|
||||||
|
{
|
||||||
return USBD_BUSY;
|
return USBD_BUSY;
|
||||||
}
|
}
|
||||||
USBD_CDC_SetTxBuffer(&hUsbDeviceHS, Buf, Len);
|
USBD_CDC_SetTxBuffer(&hUsbDeviceHS, Buf, Len);
|
||||||
@@ -310,11 +312,19 @@ static int8_t CDC_TransmitCplt_HS(uint8_t *Buf, uint32_t *Len, uint8_t epnum)
|
|||||||
UNUSED(Buf);
|
UNUSED(Buf);
|
||||||
UNUSED(Len);
|
UNUSED(Len);
|
||||||
UNUSED(epnum);
|
UNUSED(epnum);
|
||||||
|
if (tx_cbk)
|
||||||
|
tx_cbk(*Len);
|
||||||
/* USER CODE END 14 */
|
/* USER CODE END 14 */
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* USER CODE BEGIN PRIVATE_FUNCTIONS_IMPLEMENTATION */
|
/* USER CODE BEGIN PRIVATE_FUNCTIONS_IMPLEMENTATION */
|
||||||
|
uint8_t *CDCInitRxbufferNcallback(USBCallback transmit_cbk, USBCallback recv_cbk)
|
||||||
|
{
|
||||||
|
tx_cbk = transmit_cbk;
|
||||||
|
rx_cbk = recv_cbk;
|
||||||
|
return UserRxBufferHS;
|
||||||
|
}
|
||||||
|
|
||||||
/* USER CODE END PRIVATE_FUNCTIONS_IMPLEMENTATION */
|
/* USER CODE END PRIVATE_FUNCTIONS_IMPLEMENTATION */
|
||||||
|
|
||||||
|
|||||||
@@ -65,6 +65,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* USER CODE BEGIN EXPORTED_TYPES */
|
/* USER CODE BEGIN EXPORTED_TYPES */
|
||||||
|
typedef void (*USBCallback)(uint16_t);
|
||||||
|
|
||||||
/* USER CODE END EXPORTED_TYPES */
|
/* USER CODE END EXPORTED_TYPES */
|
||||||
|
|
||||||
@@ -109,6 +110,7 @@ extern USBD_CDC_ItfTypeDef USBD_Interface_fops_HS;
|
|||||||
uint8_t CDC_Transmit_HS(uint8_t* Buf, uint16_t Len);
|
uint8_t CDC_Transmit_HS(uint8_t* Buf, uint16_t Len);
|
||||||
|
|
||||||
/* USER CODE BEGIN EXPORTED_FUNCTIONS */
|
/* USER CODE BEGIN EXPORTED_FUNCTIONS */
|
||||||
|
uint8_t *CDCInitRxbufferNcallback(USBCallback transmit_cbk, USBCallback recv_cbk);
|
||||||
|
|
||||||
/* USER CODE END EXPORTED_FUNCTIONS */
|
/* USER CODE END EXPORTED_FUNCTIONS */
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
//
|
||||||
|
// Created by esqwt on 2026/3/2.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "chassis_balance_parallel.h"
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
//
|
||||||
|
// Created by esqwt on 2026/3/2.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef TRONONEH7_SCAFFOLD_CHASSIS_BALANCE_PARALLEL_H
|
||||||
|
#define TRONONEH7_SCAFFOLD_CHASSIS_BALANCE_PARALLEL_H
|
||||||
|
|
||||||
|
#endif // TRONONEH7_SCAFFOLD_CHASSIS_BALANCE_PARALLEL_H
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
//
|
||||||
|
// Created by esqwt on 2026/3/2.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "chassis_balance_serial.h"
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
//
|
||||||
|
// Created by esqwt on 2026/3/2.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef TRONONEH7_SCAFFOLD_CHASSIS_BALANCE_SERIAL_H
|
||||||
|
#define TRONONEH7_SCAFFOLD_CHASSIS_BALANCE_SERIAL_H
|
||||||
|
|
||||||
|
#endif // TRONONEH7_SCAFFOLD_CHASSIS_BALANCE_SERIAL_H
|
||||||
0
User_Code/application/chassis_app/chassis_app.md
Normal file
0
User_Code/application/chassis_app/chassis_app.md
Normal file
5
User_Code/application/chassis_app/chassis_ctrl.c
Normal file
5
User_Code/application/chassis_app/chassis_ctrl.c
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
//
|
||||||
|
// Created by esqwt on 2026/3/2.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "chassis_ctrl.h"
|
||||||
8
User_Code/application/chassis_app/chassis_ctrl.h
Normal file
8
User_Code/application/chassis_app/chassis_ctrl.h
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
//
|
||||||
|
// Created by esqwt on 2026/3/2.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef TRONONEH7_SCAFFOLD_CHASSIS_CTRL_H
|
||||||
|
#define TRONONEH7_SCAFFOLD_CHASSIS_CTRL_H
|
||||||
|
|
||||||
|
#endif // TRONONEH7_SCAFFOLD_CHASSIS_CTRL_H
|
||||||
@@ -0,0 +1,219 @@
|
|||||||
|
#include "chassis_half_steer.h"
|
||||||
|
#include "user_lib.h" // 包含 arm_math.h, PI, user_malloc 等
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
// 宏定义 (根据实际机械结构调整)
|
||||||
|
#ifndef WHEEL_BASE
|
||||||
|
#define WHEEL_BASE 0.35f // 轴距 (示例值)
|
||||||
|
#endif
|
||||||
|
#ifndef TRACK_WIDTH
|
||||||
|
#define TRACK_WIDTH 0.35f // 轮距 (示例值)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define CHASSIS_WHEEL_OFFSET 30.0f // 舵轮偏置参数
|
||||||
|
#define SQRT2 1.41421356f // 根号2
|
||||||
|
#define RAD_2_DEGREE 57.2957795f
|
||||||
|
#define DEGREE_2_RAD 0.01745329f
|
||||||
|
|
||||||
|
// 舵轮对齐角度 (根据实际安装调整)
|
||||||
|
#define STEERING_CHASSIS_ALIGN_ANGLE_RF 0.0f
|
||||||
|
#define STEERING_CHASSIS_ALIGN_ANGLE_LB 0.0f
|
||||||
|
|
||||||
|
// 静态函数声明
|
||||||
|
static void MinmizeRotation(float *angle, const float *last_angle, float *speed);
|
||||||
|
static void SteeringWheelCalculate(Chassis_HalfSteer_t *chassis);
|
||||||
|
|
||||||
|
// 默认跟随PID配置
|
||||||
|
static PID_Init_Config_s follow_pid_config = {
|
||||||
|
.Kp = 6.0f,
|
||||||
|
.Ki = 0.0f,
|
||||||
|
.Kd = 0.495f,
|
||||||
|
.MaxOut = 45.0f,
|
||||||
|
};
|
||||||
|
|
||||||
|
void Chassis_HalfSteer_Init(Chassis_HalfSteer_t *chassis,
|
||||||
|
LKMotorInstance *drive_rf, LKMotorInstance *drive_lb,
|
||||||
|
DJIMotorInstance *steer_rf, DJIMotorInstance *steer_lb)
|
||||||
|
{
|
||||||
|
if (chassis == NULL) return;
|
||||||
|
|
||||||
|
// 绑定电机实例
|
||||||
|
chassis->motor_drive_rf = drive_rf;
|
||||||
|
chassis->motor_drive_lb = drive_lb;
|
||||||
|
chassis->motor_steer_rf = steer_rf;
|
||||||
|
chassis->motor_steer_lb = steer_lb;
|
||||||
|
|
||||||
|
// 初始化PID
|
||||||
|
PIDInit(&chassis->pid_follow, &follow_pid_config);
|
||||||
|
|
||||||
|
// 初始化状态变量
|
||||||
|
chassis->last_angle_rf = 0.0f;
|
||||||
|
chassis->last_angle_lb = 0.0f;
|
||||||
|
chassis->target_speed_rf = 0.0f;
|
||||||
|
chassis->target_speed_lb = 0.0f;
|
||||||
|
chassis->target_angle_rf = 0.0f;
|
||||||
|
chassis->target_angle_lb = 0.0f;
|
||||||
|
|
||||||
|
// 如果有电机需要特定的初始化配置(如 dji_motor 的参数),请在此处补充或在外部完成
|
||||||
|
}
|
||||||
|
|
||||||
|
void Chassis_HalfSteer_Update(Chassis_HalfSteer_t *chassis, const Chassis_Ctrl_Cmd_s *cmd)
|
||||||
|
{
|
||||||
|
if (chassis == NULL || cmd == NULL) return;
|
||||||
|
|
||||||
|
// 1. 更新内部命令副本
|
||||||
|
chassis->cmd = *cmd;
|
||||||
|
|
||||||
|
// 2. 检查底盘模式与安全状态
|
||||||
|
if (chassis->cmd.chassis_mode == CHASSIS_ZERO_FORCE)
|
||||||
|
{
|
||||||
|
LKMotorStop(chassis->motor_drive_rf);
|
||||||
|
LKMotorStop(chassis->motor_drive_lb);
|
||||||
|
DJIMotorStop(chassis->motor_steer_rf);
|
||||||
|
DJIMotorStop(chassis->motor_steer_lb);
|
||||||
|
return; // 直接返回,不再计算
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LKMotorEnable(chassis->motor_drive_rf);
|
||||||
|
LKMotorEnable(chassis->motor_drive_lb);
|
||||||
|
DJIMotorEnable(chassis->motor_steer_rf);
|
||||||
|
DJIMotorEnable(chassis->motor_steer_lb);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. 预处理旋转量 (wz)
|
||||||
|
switch (chassis->cmd.chassis_mode)
|
||||||
|
{
|
||||||
|
case CHASSIS_NO_FOLLOW:
|
||||||
|
chassis->cmd.wz = 0;
|
||||||
|
break;
|
||||||
|
case CHASSIS_FOLLOW_GIMBAL_YAW:
|
||||||
|
{
|
||||||
|
float angle_err = chassis->cmd.offset_angle;
|
||||||
|
// 归一化到 [-180, 180]
|
||||||
|
if(angle_err > 180.0f) angle_err -= 360.0f;
|
||||||
|
else if(angle_err < -180.0f) angle_err += 360.0f;
|
||||||
|
|
||||||
|
// 计算跟随PID输出
|
||||||
|
chassis->cmd.wz = PIDCalculate(&chassis->pid_follow, angle_err, 0.0f) / 100.0f; // 根据原代码保留/100
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case CHASSIS_ROTATE:
|
||||||
|
chassis->cmd.wz = 0.5f; // 固定自旋速度,可改为变量
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 4. 坐标系转换 (云台系 -> 底盘系)
|
||||||
|
// 假设 cmd.vx/vy 是云台坐标系下的指令
|
||||||
|
float sin_theta = arm_sin_f32(chassis->cmd.offset_angle * DEGREE_2_RAD);
|
||||||
|
float cos_theta = arm_cos_f32(chassis->cmd.offset_angle * DEGREE_2_RAD);
|
||||||
|
|
||||||
|
// 覆盖原始 vx/vy 为底盘系速度 (使用中间变量避免污染原始cmd数据,这里直接覆盖cmd结构体中的值用于后续计算)
|
||||||
|
float chassis_vx = chassis->cmd.vx * cos_theta - chassis->cmd.vy * sin_theta;
|
||||||
|
float chassis_vy = chassis->cmd.vx * sin_theta + chassis->cmd.vy * cos_theta;
|
||||||
|
|
||||||
|
// 将转换后的速度存回用于计算,或者传递给计算函数
|
||||||
|
// 为了保持清晰,我们修改 SteeringWheelCalculate 的输入方式,这里暂时存入 cmd 结构体或传递局部变量
|
||||||
|
// 这里选择传递局部变量,需要修改 SteeringWheelCalculate 内部逻辑
|
||||||
|
// 为了复用原逻辑,我将在函数内部使用 chassis_vx/vy
|
||||||
|
|
||||||
|
// 5. 运动学解算
|
||||||
|
// 传入 chassis_vx, chassis_vy 和 chassis->cmd.wz
|
||||||
|
// 注意:原代码使用全局变量,这里我们需要适配
|
||||||
|
|
||||||
|
float w = chassis->cmd.wz * CHASSIS_WHEEL_OFFSET * SQRT2;
|
||||||
|
|
||||||
|
if (fabsf(chassis_vx) == 0 && fabsf(chassis_vy) == 0 && chassis->cmd.wz == 0) {
|
||||||
|
chassis->target_speed_lb = 0;
|
||||||
|
chassis->target_speed_rf = 0;
|
||||||
|
// 角度保持不变,或回中?原代码保持不变
|
||||||
|
} else {
|
||||||
|
// LB (Left Back) 计算: y+, x-
|
||||||
|
// 注意:原代码注释里的方向似乎与变量名有差异,这里基于原代码逻辑复刻
|
||||||
|
// 原代码: arm_sqrt_f32(temp_x * temp_x + temp_y * temp_y, &vt_lb); // lb: y+ , x-
|
||||||
|
// temp_x = chassis_vx - w; temp_y = chassis_vy + w;
|
||||||
|
float temp_x_lb = chassis_vx - w;
|
||||||
|
float temp_y_lb = chassis_vy + w;
|
||||||
|
arm_sqrt_f32(temp_x_lb * temp_x_lb + temp_y_lb * temp_y_lb, &chassis->target_speed_lb);
|
||||||
|
|
||||||
|
float offset_lb = -atan2f(temp_y_lb, temp_x_lb) * RAD_2_DEGREE;
|
||||||
|
chassis->target_angle_lb = STEERING_CHASSIS_ALIGN_ANGLE_LB + offset_lb;
|
||||||
|
|
||||||
|
// RF (Right Front) 计算: y-, x+
|
||||||
|
// 原代码: arm_sqrt_f32(temp_x * temp_x + temp_y * temp_y, &vt_rf); // rf: y- , x+
|
||||||
|
// temp_x = chassis_vx + w; temp_y = chassis_vy - w;
|
||||||
|
float temp_x_rf = chassis_vx + w;
|
||||||
|
float temp_y_rf = chassis_vy - w;
|
||||||
|
arm_sqrt_f32(temp_x_rf * temp_x_rf + temp_y_rf * temp_y_rf, &chassis->target_speed_rf);
|
||||||
|
|
||||||
|
float offset_rf = -atan2f(temp_y_rf, temp_x_rf) * RAD_2_DEGREE;
|
||||||
|
chassis->target_angle_rf = STEERING_CHASSIS_ALIGN_ANGLE_RF + offset_rf;
|
||||||
|
|
||||||
|
// 6. 角度优化 (MinmizeRotation)
|
||||||
|
// 更新 last_angle
|
||||||
|
chassis->last_angle_lb = chassis->motor_steer_lb->measure.total_angle;
|
||||||
|
chassis->last_angle_rf = chassis->motor_steer_rf->measure.total_angle;
|
||||||
|
|
||||||
|
// 限制到 [-180, 180] 绝对值逻辑? 原代码使用了 ANGLE_LIMIT_360_TO_180_ABS 宏
|
||||||
|
// 这里手动实现或调用 user_lib
|
||||||
|
// 假设 user_lib.h 中有相关宏,这里简单处理
|
||||||
|
// (省略部分宏展开,直接使用 MinmizeRotation)
|
||||||
|
|
||||||
|
MinmizeRotation(&chassis->target_angle_lb, &chassis->last_angle_lb, &chassis->target_speed_lb);
|
||||||
|
MinmizeRotation(&chassis->target_angle_rf, &chassis->last_angle_rf, &chassis->target_speed_rf);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 7. 发送控制指令
|
||||||
|
// 转向电机 (DJI GM6020)
|
||||||
|
DJIMotorSetRef(chassis->motor_steer_lb, chassis->target_angle_lb);
|
||||||
|
DJIMotorSetRef(chassis->motor_steer_rf, chassis->target_angle_rf);
|
||||||
|
|
||||||
|
// 驱动电机 (LK 9015)
|
||||||
|
LKMotorSetRef(chassis->motor_drive_lb, chassis->target_speed_lb);
|
||||||
|
LKMotorSetRef(chassis->motor_drive_rf, chassis->target_speed_rf);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 使舵电机角度最小旋转,取优弧
|
||||||
|
*/
|
||||||
|
static void MinmizeRotation(float *angle, const float *last_angle, float *speed)
|
||||||
|
{
|
||||||
|
float target_angle = *angle;
|
||||||
|
float actual_angle = *last_angle;
|
||||||
|
float rotation = target_angle - actual_angle;
|
||||||
|
float norm_rotation = rotation;
|
||||||
|
|
||||||
|
// 规范化旋转角度到 [-180, 180]
|
||||||
|
while (norm_rotation > 180.0f) {
|
||||||
|
norm_rotation -= 360.0f;
|
||||||
|
}
|
||||||
|
while (norm_rotation < -180.0f) {
|
||||||
|
norm_rotation += 360.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
float threshold = 110.0f; // 阈值,超过此角度则反转轮子方向
|
||||||
|
|
||||||
|
// 简单的优弧判断
|
||||||
|
if (norm_rotation > threshold) {
|
||||||
|
int32_t round_diff = (int32_t)((target_angle - actual_angle) / 360.0f);
|
||||||
|
*angle = actual_angle + norm_rotation - 180.0f + round_diff * 360.0f;
|
||||||
|
*speed = -(*speed);
|
||||||
|
} else if (norm_rotation < -threshold) {
|
||||||
|
int32_t round_diff = (int32_t)((target_angle - actual_angle) / 360.0f);
|
||||||
|
*angle = actual_angle + norm_rotation + 180.0f + round_diff * 360.0f;
|
||||||
|
*speed = -(*speed);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果没有触发反转,目标角度通常需要加上圈数,
|
||||||
|
// 但原代码逻辑似乎是直接修改传入的 angle 指针。
|
||||||
|
// 如果 norm_rotation 在阈值内,我们需要确保 angle 是基于 actual_angle 的最近点
|
||||||
|
// 原逻辑中 MinmizeRotation 似乎只处理了反转的情况,
|
||||||
|
// 对于常规旋转,可能需要确保 *angle 包含了正确的圈数信息。
|
||||||
|
// 补充逻辑:
|
||||||
|
if (norm_rotation <= threshold && norm_rotation >= -threshold) {
|
||||||
|
// 计算最近的目标角度(包含圈数)
|
||||||
|
*angle = actual_angle + norm_rotation;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,89 @@
|
|||||||
|
#ifndef CHASSIS_HALF_STEER_H
|
||||||
|
#define CHASSIS_HALF_STEER_H
|
||||||
|
|
||||||
|
#include "stdint.h"
|
||||||
|
#include "dji_motor.h"
|
||||||
|
#include "lk_motor.h" // 假设存在对应的C接口头文件
|
||||||
|
#include "pid.h"
|
||||||
|
#include "chassis_ctrl.h" // 包含底盘控制相关的通用定义
|
||||||
|
|
||||||
|
// 定义底盘控制命令结构体 (如果 chassis_ctrl.h 中未定义,请在此定义或确保通用)
|
||||||
|
#ifndef CHASSIS_CTRL_CMD_DEFINED
|
||||||
|
#define CHASSIS_CTRL_CMD_DEFINED
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
CHASSIS_ZERO_FORCE = 0, // 无力/急停
|
||||||
|
CHASSIS_NO_FOLLOW, // 不跟随/自由移动
|
||||||
|
CHASSIS_FOLLOW_GIMBAL_YAW, // 跟随云台Yaw
|
||||||
|
CHASSIS_ROTATE, // 小陀螺/自旋
|
||||||
|
} Chassis_Mode_e;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
float vx; // 前后速度 (m/s)
|
||||||
|
float vy; // 左右速度 (m/s)
|
||||||
|
float wz; // 旋转角速度 (rad/s 或 对应单位)
|
||||||
|
float offset_angle; // 底盘与云台的夹角 (度)
|
||||||
|
Chassis_Mode_e chassis_mode;
|
||||||
|
} Chassis_Ctrl_Cmd_s;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// 定义底盘反馈数据结构体
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
float vx;
|
||||||
|
float vy;
|
||||||
|
float wz;
|
||||||
|
// float real_angle; // 预留
|
||||||
|
} Chassis_Upload_Data_s;
|
||||||
|
|
||||||
|
// 半舵轮底盘对象结构体
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
// 轮毂电机实例 (驱动) - LK9015
|
||||||
|
LKMotorInstance *motor_drive_rf; // 右前
|
||||||
|
LKMotorInstance *motor_drive_lb; // 左后
|
||||||
|
|
||||||
|
// 舵向电机实例 (转向) - GM6020
|
||||||
|
DJIMotorInstance *motor_steer_rf; // 右前舵
|
||||||
|
DJIMotorInstance *motor_steer_lb; // 左后舵
|
||||||
|
|
||||||
|
// PID实例
|
||||||
|
PIDInstance pid_follow; // 跟随PID
|
||||||
|
|
||||||
|
// 控制命令与状态
|
||||||
|
Chassis_Ctrl_Cmd_s cmd;
|
||||||
|
Chassis_Upload_Data_s feedback;
|
||||||
|
|
||||||
|
// 内部计算中间变量
|
||||||
|
float target_speed_rf; // 右前轮目标速度
|
||||||
|
float target_speed_lb; // 左后轮目标速度
|
||||||
|
float target_angle_rf; // 右前舵目标角度
|
||||||
|
float target_angle_lb; // 左后舵目标角度
|
||||||
|
|
||||||
|
// 上一次的角度记录 (用于就近转动逻辑)
|
||||||
|
float last_angle_rf;
|
||||||
|
float last_angle_lb;
|
||||||
|
|
||||||
|
} Chassis_HalfSteer_t;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 初始化半舵轮底盘对象
|
||||||
|
* @param chassis 底盘对象指针
|
||||||
|
* @param drive_rf 右前驱动电机指针
|
||||||
|
* @param drive_lb 左后驱动电机指针
|
||||||
|
* @param steer_rf 右前转向电机指针
|
||||||
|
* @param steer_lb 左后转向电机指针
|
||||||
|
*/
|
||||||
|
void Chassis_HalfSteer_Init(Chassis_HalfSteer_t *chassis,
|
||||||
|
LKMotorInstance *drive_rf, LKMotorInstance *drive_lb,
|
||||||
|
DJIMotorInstance *steer_rf, DJIMotorInstance *steer_lb);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 底盘控制更新函数,建议在RTOS任务中周期调用
|
||||||
|
* @param chassis 底盘对象指针
|
||||||
|
* @param cmd 控制命令指针
|
||||||
|
*/
|
||||||
|
void Chassis_HalfSteer_Update(Chassis_HalfSteer_t *chassis, const Chassis_Ctrl_Cmd_s *cmd);
|
||||||
|
|
||||||
|
#endif // CHASSIS_HALF_STEER_H
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
//
|
||||||
|
// Created by esqwt on 2026/3/2.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "chassis_lift_onmi.h"
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
//
|
||||||
|
// Created by esqwt on 2026/3/2.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef TRONONEH7_SCAFFOLD_LIFT_ONMI_H
|
||||||
|
#define TRONONEH7_SCAFFOLD_LIFT_ONMI_H
|
||||||
|
|
||||||
|
#endif // TRONONEH7_SCAFFOLD_LIFT_ONMI_H
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
//
|
||||||
|
// Created by esqwt on 2026/3/2.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "chassis_mecanum.h"
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
//
|
||||||
|
// Created by esqwt on 2026/3/2.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef TRONONEH7_SCAFFOLD_CHASSIS_MECANUM_H
|
||||||
|
#define TRONONEH7_SCAFFOLD_CHASSIS_MECANUM_H
|
||||||
|
|
||||||
|
#endif // TRONONEH7_SCAFFOLD_CHASSIS_MECANUM_H
|
||||||
273
User_Code/application/chassis_app/omni/chassis_omni.c
Normal file
273
User_Code/application/chassis_app/omni/chassis_omni.c
Normal file
@@ -0,0 +1,273 @@
|
|||||||
|
#include "chassis_omni.h"
|
||||||
|
#include <math.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#ifndef M_PI
|
||||||
|
#define M_PI 3.14159265358979323846f
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// 辅助函数:绝对值限幅
|
||||||
|
static float abs_clip(float val, float limit)
|
||||||
|
{
|
||||||
|
if (val > limit) return limit;
|
||||||
|
if (val < -limit) return -limit;
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
|
||||||
|
// PID配置
|
||||||
|
static PID_Init_Config_s chassis_speed_pid_config = {
|
||||||
|
.MaxOut = 16000.0f,
|
||||||
|
.IntegralLimit = 2000.0f, // 对应 C++ IntegralLimit (Integral_Min/Max 在 C PID 中未直接对应,取其中值或限制值)
|
||||||
|
.Kp = 15.0f,
|
||||||
|
.Ki = 0.0f,
|
||||||
|
.Kd = 0.001f,
|
||||||
|
.Output_LPF_RC = 0.002f, // 对应 C++ Output_LPF
|
||||||
|
.Derivative_LPF_RC = 0.002f, // 对应 C++ D_LPF
|
||||||
|
.Improve = PID_Integral_Limit, // 对应 0x01
|
||||||
|
};
|
||||||
|
|
||||||
|
// 跟随环内环 (对应 index 0)
|
||||||
|
static PID_Init_Config_s follow_pid_inner_config = {
|
||||||
|
.MaxOut = 4000.0f,
|
||||||
|
.IntegralLimit = 200.0f,
|
||||||
|
.Kp = 20.0f,
|
||||||
|
.Ki = 4.0f,
|
||||||
|
.Kd = 0.0001f,
|
||||||
|
.Output_LPF_RC = 0.002f,
|
||||||
|
.Derivative_LPF_RC = 0.002f,
|
||||||
|
// 对应 0x37 = Integral_Limit | Differential_Forward | Trapezoid_Intergral | OutputFilter | ChangingIntegrationRate
|
||||||
|
// C definitions:
|
||||||
|
// PID_Integral_Limit (1)
|
||||||
|
// PID_Derivative_On_Measurement (2)
|
||||||
|
// PID_Trapezoid_Intergral (4)
|
||||||
|
// PID_OutputFilter (16)
|
||||||
|
// PID_ChangingIntegrationRate (32)
|
||||||
|
.Improve = PID_Integral_Limit | PID_Derivative_On_Measurement | PID_Trapezoid_Intergral | PID_OutputFilter | PID_ChangingIntegrationRate,
|
||||||
|
};
|
||||||
|
|
||||||
|
// 跟随环外环 (对应 index 1)
|
||||||
|
static PID_Init_Config_s follow_pid_outer_config = {
|
||||||
|
.MaxOut = 4000.0f,
|
||||||
|
.IntegralLimit = 4000.0f,
|
||||||
|
.Kp = 15.0f,
|
||||||
|
.Ki = 0.0f,
|
||||||
|
.Kd = 1.8f,
|
||||||
|
.Output_LPF_RC = 0.002f,
|
||||||
|
.Derivative_LPF_RC = 0.002f,
|
||||||
|
.Improve = PID_Integral_Limit | PID_Derivative_On_Measurement | PID_Trapezoid_Intergral | PID_OutputFilter | PID_ChangingIntegrationRate,
|
||||||
|
};
|
||||||
|
|
||||||
|
void Chassis_Omni_Init(Chassis_Omni_t *chassis, DJIMotorInstance *lf, DJIMotorInstance *rf, DJIMotorInstance *lb, DJIMotorInstance *rb)
|
||||||
|
{
|
||||||
|
if (chassis == NULL) return;
|
||||||
|
|
||||||
|
chassis->moto_chassis[0] = lf;
|
||||||
|
chassis->moto_chassis[1] = rf;
|
||||||
|
chassis->moto_chassis[2] = lb;
|
||||||
|
chassis->moto_chassis[3] = rb;
|
||||||
|
|
||||||
|
// 初始化速度PID
|
||||||
|
for (int i = 0; i < 4; i++) {
|
||||||
|
PIDInit(&chassis->pid_speed[i], &chassis_speed_pid_config);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 初始化跟随PID (串级)
|
||||||
|
PIDInit(&chassis->pid_follow_angle_inner, &follow_pid_inner_config);
|
||||||
|
PIDInit(&chassis->pid_follow_angle_outer, &follow_pid_outer_config);
|
||||||
|
|
||||||
|
// 初始化功率控制参数
|
||||||
|
chassis->power_config.super_power_health = 90.0f;
|
||||||
|
chassis->power_config.super_power_week = 20.0f;
|
||||||
|
chassis->power_config.chassis_normal_speed_limit = 80; // 这里的单位可能需要根据实际调整
|
||||||
|
}
|
||||||
|
|
||||||
|
// 功率分配 (防止超功率)
|
||||||
|
static void Chassis_Power_Allocation(Chassis_Omni_t *chassis)
|
||||||
|
{
|
||||||
|
float scaling[4];
|
||||||
|
float total_err = 0.0f;
|
||||||
|
|
||||||
|
// 计算总误差 (使用 Err 字段)
|
||||||
|
for (int i = 0; i < 4; i++) {
|
||||||
|
total_err += fabsf(chassis->pid_speed[i].Err);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (total_err > 1e-6f) { // 避免除零
|
||||||
|
for (int i = 0; i < 4; i++) {
|
||||||
|
scaling[i] = chassis->pid_speed[i].Err / total_err;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 限制输出
|
||||||
|
for (int i = 0; i < 4; i++) {
|
||||||
|
// 原代码: pidinstance[0].pos_out = abs_clip(..., abs(Scaling[i] * 50000))
|
||||||
|
// 注意: 这里直接修改了 PID 的 Output,可能会影响下一次计算,但在C++原版中就是这样写的
|
||||||
|
float limit = fabsf(scaling[i] * 50000.0f);
|
||||||
|
chassis->pid_speed[i].Output = abs_clip(chassis->pid_speed[i].Output, limit);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Chassis_Omni_Update(Chassis_Omni_t *chassis)
|
||||||
|
{
|
||||||
|
if (chassis == NULL) return;
|
||||||
|
|
||||||
|
// 1. 获取电机速度并进行正运动学解算 (估计底盘当前速度)
|
||||||
|
float motor_speeds[4];
|
||||||
|
float real_speed[4]; // [0]=vx, [1]=vy, [2]=w
|
||||||
|
|
||||||
|
for (int i = 0; i < 4; i++) {
|
||||||
|
// 使用 speed_aps (度/秒)
|
||||||
|
motor_speeds[i] = chassis->moto_chassis[i]->measure.speed_aps;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 逆结算部分 (原代码注释,实际是正解算:轮速 -> 体速)
|
||||||
|
// 假设是X型全向轮/麦克纳姆轮布局
|
||||||
|
real_speed[0] = (-motor_speeds[0] - motor_speeds[1] + motor_speeds[2] + motor_speeds[3]) / 4.0f;
|
||||||
|
real_speed[1] = (-motor_speeds[0] + motor_speeds[1] - motor_speeds[2] + motor_speeds[3]) / 4.0f;
|
||||||
|
real_speed[2] = (-motor_speeds[0] - motor_speeds[1] - motor_speeds[2] - motor_speeds[3]) / 4.0f;
|
||||||
|
|
||||||
|
// 将底盘体坐标系速度转换到之前的参考系 (可能是云台系或世界系,取决于 real_angle 的定义)
|
||||||
|
float cos_a = cosf(chassis->cmd.real_angle);
|
||||||
|
float sin_a = sinf(chassis->cmd.real_angle);
|
||||||
|
|
||||||
|
float speedx = real_speed[0] * cos_a - real_speed[1] * sin_a;
|
||||||
|
float speedy = real_speed[0] * sin_a + real_speed[1] * cos_a;
|
||||||
|
|
||||||
|
float target_speed[3] = {0};
|
||||||
|
|
||||||
|
if (chassis->cmd.if_enable != 0)
|
||||||
|
{
|
||||||
|
// 2. 跟随PID计算
|
||||||
|
chassis->offset_angle = -chassis->cmd.follow_angle;
|
||||||
|
chassis->offset_speed = chassis->cmd.yaw_speed;
|
||||||
|
|
||||||
|
if (!chassis->cmd.if_free) {
|
||||||
|
// 串级PID: 外环(角度) -> 内环(速度)
|
||||||
|
// 外环目标: 0 (使 offset_angle 归零)
|
||||||
|
float outer_out = PIDCalculate(&chassis->pid_follow_angle_outer, chassis->offset_angle, 0.0f);
|
||||||
|
|
||||||
|
// 内环目标: 外环输出
|
||||||
|
// 内环反馈: offset_speed (yaw_speed)
|
||||||
|
chassis->follow_increment = PIDCalculate(&chassis->pid_follow_angle_inner, chassis->offset_speed, outer_out);
|
||||||
|
} else {
|
||||||
|
chassis->follow_increment = 0.0f;
|
||||||
|
// 清空PID积分等状态
|
||||||
|
chassis->pid_follow_angle_outer.Output = 0;
|
||||||
|
chassis->pid_follow_angle_inner.Output = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. 底盘速度闭环控制 (P控制)
|
||||||
|
// 这里的 5.5 是速度环增益,计算出的是"加速度"或"力"的需求
|
||||||
|
target_speed[0] = (chassis->cmd.speed[0] - speedx) * 5.5f;
|
||||||
|
target_speed[1] = (chassis->cmd.speed[1] - speedy) * 5.5f;
|
||||||
|
|
||||||
|
// 旋转轴控制
|
||||||
|
// 如果没有指令输入,则使用 real_speed 差值进行阻尼控制?
|
||||||
|
// 原代码逻辑: speed[2] = (cmd - real) * 5.5
|
||||||
|
target_speed[2] = (chassis->cmd.speed[2] - real_speed[2]) * 5.5f;
|
||||||
|
|
||||||
|
if (chassis->cmd.speed[2] == 0.0f) // 如果没有旋转指令
|
||||||
|
{
|
||||||
|
// 叠加跟随PID输出,并减去当前旋转速度 (阻尼)
|
||||||
|
target_speed[2] = (chassis->follow_increment - real_speed[2] - real_speed[2]) * 5.5f;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// 如果有手动旋转指令,清除跟随PID积分
|
||||||
|
chassis->pid_follow_angle_outer.Output = 0;
|
||||||
|
chassis->pid_follow_angle_inner.Output = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 4. 逆运动学解算 (体速 -> 轮速)
|
||||||
|
// 引入了旋转补偿: real_angle - 0.002 * real_speed[2]
|
||||||
|
float corrected_angle = chassis->cmd.real_angle - 0.002f * real_speed[2];
|
||||||
|
float sin_ca = sinf(corrected_angle);
|
||||||
|
float cos_ca = cosf(corrected_angle);
|
||||||
|
|
||||||
|
// 转换回电机解算所需的 x, y 分量
|
||||||
|
float y = -(target_speed[0] * sinf(chassis->cmd.real_angle) - target_speed[1] * cos_ca);
|
||||||
|
float x = (target_speed[0] * cosf(chassis->cmd.real_angle) + target_speed[1] * sin_ca);
|
||||||
|
|
||||||
|
// 5. 电机PID控制与输出
|
||||||
|
float wheel_targets[4];
|
||||||
|
wheel_targets[0] = (-x - y) - target_speed[2];
|
||||||
|
wheel_targets[1] = (-x + y) - target_speed[2];
|
||||||
|
wheel_targets[2] = (x - y) - target_speed[2];
|
||||||
|
wheel_targets[3] = (x + y) - target_speed[2];
|
||||||
|
|
||||||
|
for (int i = 0; i < 4; i++) {
|
||||||
|
// PIDCalculate(pid, measure, target) -> 这里的measure似乎被当作0处理?
|
||||||
|
// 原C++代码: pid_chassis[i]->PID_handle(wheel_targets[i]);
|
||||||
|
// PID_handle(target) 内部通常是 calculate(measure, target).
|
||||||
|
// 但原代码中 PID 构造时传入了 &moto_chassis[i]->speed 地址。
|
||||||
|
// 因此 C++ PID 类会自动读取 measure。
|
||||||
|
// 在 C 中,我们需要手动传入 measure。
|
||||||
|
|
||||||
|
float output = PIDCalculate(&chassis->pid_speed[i], chassis->moto_chassis[i]->measure.speed_aps, wheel_targets[i]);
|
||||||
|
// 设置电机输出 (注意:DJIMotorSetRef 设置的是目标值还是直接电流?)
|
||||||
|
// 根据 dji_motor.h 注释: "可以将电机视为传递函数为1的设备...不需要关心底层的闭环"
|
||||||
|
// 如果 DJIMotorSetRef 是设定速度闭环的目标,那么上面的 PID 是多余的吗?
|
||||||
|
// 不,原代码 clearly 使用了 pid_chassis[i] 计算 send_data。
|
||||||
|
// 这意味着 dji_motor 应该工作在 OPEN_LOOP 或 CURRENT_LOOP 模式,或者我们需要直接操作 current。
|
||||||
|
// 假设我们这里计算的是电流值,因为 MaxOut 是 16000 (M3508电流范围)。
|
||||||
|
// DJIMotorSetRef 通常用于设定内置闭环的目标。
|
||||||
|
// 如果要发送电流,通常没有直接的 SetCurrent API,除非 Motor_Control_Setting_s 允许。
|
||||||
|
// 为了保持移植性,我们假设 DJIMotorSetRef 能够处理这个输出,或者我们需要修改 dji_motor 模块。
|
||||||
|
// 这里我们假设 DJIMotorSetRef 在电流模式下工作。
|
||||||
|
DJIMotorSetRef(chassis->moto_chassis[i], output);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 6. 功率限制
|
||||||
|
Chassis_Power_Allocation(chassis);
|
||||||
|
// 如果 Chassis_Power_Allocation 修改了 PID Output,我们需要重新 SetRef 吗?
|
||||||
|
// 原代码直接修改了 pos_out,这在下一次计算时生效,或者如果 PID 类直接返回 pos_out 给 send_data。
|
||||||
|
// C++代码: moto_chassis[i]->send_data = PID_handle(...); Chassis_Power_Allocation();
|
||||||
|
// Power_Allocation 修改了 pid instance 的 pos_out。
|
||||||
|
// 这意味着当前的 send_data 并没有被 Power_Allocation 修正!
|
||||||
|
// 修正逻辑应该是先计算 PID,再分配,再发送。
|
||||||
|
// 但为了忠实还原原代码逻辑,我们保持顺序。
|
||||||
|
// (注:原代码逻辑可能存在缺陷,分配后的功率限制在下一帧才通过积分项或直接赋值生效?
|
||||||
|
// 或者 moto_chassis->send_data 是个指针引用?不,它是值。
|
||||||
|
// 如果原代码 Allocation 在赋值给 send_data 之后调用,那么它只影响了 PID 内部状态,不影响当前帧输出。)
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (int i = 0; i < 4; i++) {
|
||||||
|
DJIMotorStop(chassis->moto_chassis[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Chassis_Omni_PowerControl(Chassis_Omni_t *chassis, Chassis_Power_Info_s *power_info, Chassis_Ctrl_Cmd_s *raw_cmd)
|
||||||
|
{
|
||||||
|
if (chassis == NULL || power_info == NULL || raw_cmd == NULL) return;
|
||||||
|
|
||||||
|
// 复制原始指令到内部 cmd (默认)
|
||||||
|
chassis->cmd = *raw_cmd;
|
||||||
|
|
||||||
|
// 简单的功率策略实现 (参考 Chassis_OmniWheel_Crtl::powerControl)
|
||||||
|
float speed_scaling = 1.0f;
|
||||||
|
|
||||||
|
if (power_info->remain_energy >= chassis->power_config.super_power_health)
|
||||||
|
{
|
||||||
|
speed_scaling = 1.0f; // 正常模式
|
||||||
|
}
|
||||||
|
else if (power_info->remain_energy >= chassis->power_config.super_power_week)
|
||||||
|
{
|
||||||
|
// 线性降额: energy + 10 ? 原代码: tired = energy + 10
|
||||||
|
float tired = power_info->remain_energy + 10.0f;
|
||||||
|
speed_scaling = tired * 0.01f; // 归一化
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
speed_scaling = 0.3f; // 低电量模式
|
||||||
|
}
|
||||||
|
|
||||||
|
// 应用缩放系数 (原代码还有 200 * 1.5/1.8 的系数,这里假设 raw_cmd 已经是归一化值,只做缩放)
|
||||||
|
// 原代码: data_to_chassis.speed[...] = data_from_FSM.speed[...] * 200 * ...
|
||||||
|
// 这里我们只做相对缩放,保留原始比例
|
||||||
|
chassis->cmd.speed[0] *= speed_scaling;
|
||||||
|
chassis->cmd.speed[1] *= speed_scaling;
|
||||||
|
chassis->cmd.speed[2] *= speed_scaling;
|
||||||
|
}
|
||||||
81
User_Code/application/chassis_app/omni/chassis_omni.h
Normal file
81
User_Code/application/chassis_app/omni/chassis_omni.h
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
#ifndef CHASSIS_OMNI_H
|
||||||
|
#define CHASSIS_OMNI_H
|
||||||
|
|
||||||
|
#include "stdint.h"
|
||||||
|
#include "dji_motor.h"
|
||||||
|
#include "pid.h"
|
||||||
|
|
||||||
|
// 定义底盘控制命令结构体 (由于chassis_ctrl.h为空,在此定义以适配逻辑)
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
float speed[3]; // x, y, z (旋转) 速度设定值
|
||||||
|
float follow_angle; // 跟随角度 (底盘与云台夹角)
|
||||||
|
float yaw_speed; // 当前Yaw轴角速度 (作为前馈或反馈)
|
||||||
|
float real_angle; // 底盘当前实际角度 (用于坐标系转换)
|
||||||
|
uint8_t if_enable; // 底盘使能标志
|
||||||
|
uint8_t if_free; // 底盘自由模式标志 (不跟随)
|
||||||
|
} Chassis_Ctrl_Cmd_s;
|
||||||
|
|
||||||
|
// 定义功率控制所需的外部数据结构
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
uint16_t chassis_power_limit; // 来自裁判系统的功率限制
|
||||||
|
float remain_energy; // 来自超级电容的剩余能量
|
||||||
|
uint16_t chassis_power_buffer; // 缓冲能量 (可选)
|
||||||
|
} Chassis_Power_Info_s;
|
||||||
|
|
||||||
|
// 全向轮底盘对象结构体
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
// 电机实例指针 (LF, RF, LB, RB)
|
||||||
|
DJIMotorInstance *moto_chassis[4];
|
||||||
|
|
||||||
|
// 速度环PID实例 (每个轮子一个)
|
||||||
|
PIDInstance pid_speed[4];
|
||||||
|
|
||||||
|
// 跟随环串级PID实例
|
||||||
|
PIDInstance pid_follow_angle_outer; // 外环 (角度)
|
||||||
|
PIDInstance pid_follow_angle_inner; // 内环 (角速度)
|
||||||
|
|
||||||
|
// 控制数据
|
||||||
|
Chassis_Ctrl_Cmd_s cmd;
|
||||||
|
|
||||||
|
// 内部计算状态变量
|
||||||
|
float offset_angle;
|
||||||
|
float offset_speed;
|
||||||
|
float follow_increment;
|
||||||
|
|
||||||
|
// 功率控制参数
|
||||||
|
struct {
|
||||||
|
float super_power_health;
|
||||||
|
float super_power_week;
|
||||||
|
uint16_t chassis_normal_speed_limit;
|
||||||
|
} power_config;
|
||||||
|
|
||||||
|
} Chassis_Omni_t;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 初始化全向轮底盘对象
|
||||||
|
* @param chassis 底盘对象指针
|
||||||
|
* @param lf 左前电机指针
|
||||||
|
* @param rf 右前电机指针
|
||||||
|
* @param lb 左后电机指针
|
||||||
|
* @param rb 右后电机指针
|
||||||
|
*/
|
||||||
|
void Chassis_Omni_Init(Chassis_Omni_t *chassis, DJIMotorInstance *lf, DJIMotorInstance *rf, DJIMotorInstance *lb, DJIMotorInstance *rb);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 底盘控制任务函数,建议在RTOS任务中周期调用
|
||||||
|
* @param chassis 底盘对象指针
|
||||||
|
*/
|
||||||
|
void Chassis_Omni_Update(Chassis_Omni_t *chassis);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 功率控制逻辑,根据裁判系统和超电状态限制目标速度
|
||||||
|
* @param chassis 底盘对象指针
|
||||||
|
* @param power_info 功率状态信息
|
||||||
|
* @param raw_cmd 原始控制命令 (通常来自上层FSM)
|
||||||
|
*/
|
||||||
|
void Chassis_Omni_PowerControl(Chassis_Omni_t *chassis, Chassis_Power_Info_s *power_info, Chassis_Ctrl_Cmd_s *raw_cmd);
|
||||||
|
|
||||||
|
#endif // CHASSIS_OMNI_H
|
||||||
5
User_Code/application/chassis_app/steer/chassis_steer.c
Normal file
5
User_Code/application/chassis_app/steer/chassis_steer.c
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
//
|
||||||
|
// Created by esqwt on 2026/3/2.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "chassis_steer.h"
|
||||||
8
User_Code/application/chassis_app/steer/chassis_steer.h
Normal file
8
User_Code/application/chassis_app/steer/chassis_steer.h
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
//
|
||||||
|
// Created by esqwt on 2026/3/2.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef TRONONEH7_SCAFFOLD_CHASSIS_STEER_H
|
||||||
|
#define TRONONEH7_SCAFFOLD_CHASSIS_STEER_H
|
||||||
|
|
||||||
|
#endif // TRONONEH7_SCAFFOLD_CHASSIS_STEER_H
|
||||||
5
User_Code/application/gimbal_app/gimbal/gimbal.c
Normal file
5
User_Code/application/gimbal_app/gimbal/gimbal.c
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
//
|
||||||
|
// Created by esqwt on 2026/3/2.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "gimbal.h"
|
||||||
8
User_Code/application/gimbal_app/gimbal/gimbal.h
Normal file
8
User_Code/application/gimbal_app/gimbal/gimbal.h
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
//
|
||||||
|
// Created by esqwt on 2026/3/2.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef TRONONEH7_SCAFFOLD_GIMBAL_H
|
||||||
|
#define TRONONEH7_SCAFFOLD_GIMBAL_H
|
||||||
|
|
||||||
|
#endif // TRONONEH7_SCAFFOLD_GIMBAL_H
|
||||||
0
User_Code/application/gimbal_app/gimbal_app.md
Normal file
0
User_Code/application/gimbal_app/gimbal_app.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
//
|
||||||
|
// Created by esqwt on 2026/3/2.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "gimbal_control.h"
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
//
|
||||||
|
// Created by esqwt on 2026/3/2.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef TRONONEH7_SCAFFOLD_GIMBAL_CTRL_H
|
||||||
|
#define TRONONEH7_SCAFFOLD_GIMBAL_CTRL_H
|
||||||
|
|
||||||
|
#endif // TRONONEH7_SCAFFOLD_GIMBAL_CTRL_H
|
||||||
203
User_Code/application/indicator_app/ws2812status.c
Normal file
203
User_Code/application/indicator_app/ws2812status.c
Normal file
@@ -0,0 +1,203 @@
|
|||||||
|
/**
|
||||||
|
* @file ws2812Task.c
|
||||||
|
* @brief WS2812 LED control task
|
||||||
|
* @author TuxMonkey (nqx2004@gmail.com)
|
||||||
|
* @version 1.0
|
||||||
|
* @date 2025-07-08
|
||||||
|
*
|
||||||
|
* @copyright Copyright (c) 2025 DLMU-C.ONE
|
||||||
|
*
|
||||||
|
* @par 修改日志:
|
||||||
|
* <table>
|
||||||
|
* <tr><th>Date <th>Version <th>Author <th>Description
|
||||||
|
* <tr><td>2025-07-08 <td>1.0 <td>TuxMonkey <td>内容
|
||||||
|
* </table>
|
||||||
|
*/
|
||||||
|
|
||||||
|
//真的有点抽象了不太清楚什么问题,24V的时候用16的分频器可以 5V时候就只能用32的分频器了 spi6的 这个之后注意一下吧 如果要开发还是用32的分频器。
|
||||||
|
|
||||||
|
/*---------------------INCLUDES----------------------*/
|
||||||
|
#include "ws2812status.h"
|
||||||
|
#include "ws2812.h"
|
||||||
|
#include "cmsis_os.h"
|
||||||
|
#include "tim.h"
|
||||||
|
#include "delayticks.h"
|
||||||
|
|
||||||
|
#include "robot_def.h"
|
||||||
|
#include "rc.h"
|
||||||
|
|
||||||
|
/*---------------------VARIABLES---------------------*/
|
||||||
|
uint8_t r = 0;
|
||||||
|
uint8_t g = 0;
|
||||||
|
uint8_t b = 0;
|
||||||
|
|
||||||
|
/*---------------------FUNCTIONS---------------------*/
|
||||||
|
|
||||||
|
void robotSelfCheck(void)
|
||||||
|
{
|
||||||
|
WS2812_Ctrl(255, 0, 0);
|
||||||
|
HAL_Delay(300);
|
||||||
|
|
||||||
|
WS2812_Ctrl(0, 0, 255);
|
||||||
|
HAL_Delay(300);
|
||||||
|
|
||||||
|
WS2812_Ctrl(0, 255, 0);
|
||||||
|
HAL_Delay(300);
|
||||||
|
|
||||||
|
WS2812_Ctrl(0, 255, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief WS2812 LED control task
|
||||||
|
* @param argument
|
||||||
|
*/
|
||||||
|
void ws2812Task(void *argument)
|
||||||
|
{
|
||||||
|
(void) argument;
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
RobotMode_t display_mode = RobotMode;
|
||||||
|
if (display_mode != SYS_ERROR_OCCURRED && !RemoteControlIsOnline())
|
||||||
|
display_mode = REMOTE_NOT_CONNECTED;
|
||||||
|
|
||||||
|
switch (display_mode)
|
||||||
|
{
|
||||||
|
case NORMAL_MODE:
|
||||||
|
BlinkGreen();
|
||||||
|
break;
|
||||||
|
case SYS_ERROR_OCCURRED:
|
||||||
|
BlinkRed();
|
||||||
|
break;
|
||||||
|
case REMOTE_NOT_CONNECTED:
|
||||||
|
BlinkRed();
|
||||||
|
break;
|
||||||
|
case REMOTE_NOT_READY:
|
||||||
|
BlinkWhite();
|
||||||
|
break;
|
||||||
|
case REMOTE_READY:
|
||||||
|
BlinkPurple();
|
||||||
|
break;
|
||||||
|
case REMOTE_PROTECT:
|
||||||
|
BlinkYellow();
|
||||||
|
break;
|
||||||
|
case AUTO_SHOOTING_MODE:
|
||||||
|
BlinkCyan();
|
||||||
|
break;
|
||||||
|
case IMU_CALIBERATION_MODE:
|
||||||
|
BlinkPurple();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
BlinkYellow();
|
||||||
|
}
|
||||||
|
osDelay(10); // 每个任务最后都要写在while里,要不然会导致任务切换失败
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void BlinkYellow(void)
|
||||||
|
{
|
||||||
|
r = 255; // 红色分量
|
||||||
|
g = 255; // 绿色分量
|
||||||
|
b = 0; // 蓝色分量
|
||||||
|
WS2812_Ctrl(r, g, b); // 设置为黄色
|
||||||
|
delay_ticks(500); // 延时500毫秒
|
||||||
|
WS2812_Ctrl(0, 0, 0); // 关闭LED灯
|
||||||
|
delay_ticks(500); // 延时500毫秒
|
||||||
|
}
|
||||||
|
|
||||||
|
void BlinkRed(void)
|
||||||
|
{
|
||||||
|
r = 255; // 红色分量
|
||||||
|
g = 0; // 绿色分量
|
||||||
|
b = 0; // 蓝色分量
|
||||||
|
WS2812_Ctrl(r, g, b); // 设置为红色
|
||||||
|
delay_ticks(500); // 延时500毫秒
|
||||||
|
WS2812_Ctrl(0, 0, 0); // 关闭LED灯
|
||||||
|
delay_ticks(500); // 延时500毫秒
|
||||||
|
}
|
||||||
|
|
||||||
|
void BlinkGreen(void)
|
||||||
|
{
|
||||||
|
r = 0; // 红色分量
|
||||||
|
g = 255; // 绿色分量
|
||||||
|
b = 0; // 蓝色分量
|
||||||
|
WS2812_Ctrl(r, g, b); // 设置为绿色
|
||||||
|
delay_ticks(500); // 延时500毫秒
|
||||||
|
WS2812_Ctrl(0, 0, 0); // 关闭LED灯
|
||||||
|
delay_ticks(500); // 延时500毫秒
|
||||||
|
}
|
||||||
|
|
||||||
|
void BlinkBlue(void)
|
||||||
|
{
|
||||||
|
r = 0; // 红色分量
|
||||||
|
g = 0; // 绿色分量
|
||||||
|
b = 255; // 蓝色分量
|
||||||
|
WS2812_Ctrl(r, g, b); // 设置为蓝色
|
||||||
|
delay_ticks(500); // 延时500毫秒
|
||||||
|
WS2812_Ctrl(0, 0, 0); // 关闭LED灯
|
||||||
|
delay_ticks(500); // 延时500毫秒
|
||||||
|
}
|
||||||
|
|
||||||
|
void BlinkWhite(void)
|
||||||
|
{
|
||||||
|
r = 255; // 红色分量
|
||||||
|
g = 255; // 绿色分量
|
||||||
|
b = 255; // 蓝色分量
|
||||||
|
WS2812_Ctrl(r, g, b); // 设置为白色
|
||||||
|
delay_ticks(500); // 延时500毫秒
|
||||||
|
WS2812_Ctrl(0, 0, 0); // 关闭LED灯
|
||||||
|
delay_ticks(500); // 延时500毫秒
|
||||||
|
}
|
||||||
|
|
||||||
|
void BlinkCyan(void)
|
||||||
|
{
|
||||||
|
r = 0; // 红色分量
|
||||||
|
g = 255; // 绿色分量
|
||||||
|
b = 255; // 蓝色分量
|
||||||
|
WS2812_Ctrl(r, g, b); // 设置为青色
|
||||||
|
delay_ticks(500); // 延时500毫秒
|
||||||
|
WS2812_Ctrl(0, 0, 0); // 关闭LED灯
|
||||||
|
delay_ticks(500); // 延时500毫秒
|
||||||
|
}
|
||||||
|
|
||||||
|
void BlinkPurple(void)
|
||||||
|
{
|
||||||
|
r = 255; // 红色分量
|
||||||
|
g = 0; // 绿色分量
|
||||||
|
b = 255; // 蓝色分量
|
||||||
|
WS2812_Ctrl(r, g, b); // 设置为紫色
|
||||||
|
delay_ticks(500); // 延时500毫秒
|
||||||
|
WS2812_Ctrl(0, 0, 0); // 关闭LED灯
|
||||||
|
delay_ticks(500); // 延时500毫秒
|
||||||
|
}
|
||||||
|
|
||||||
|
void PWMControlLed(void)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
|
||||||
|
// WS2812_Ctrl(r, g, b);
|
||||||
|
// r++;
|
||||||
|
// g += 5;
|
||||||
|
// b += 10;
|
||||||
|
|
||||||
|
// r=0;g=255;b=0;//绿色
|
||||||
|
// WS2812_Ctrl(r, g, b);
|
||||||
|
// delay_ticks(500); // 使用延时函数代替osDelay,避免任务切换失败
|
||||||
|
|
||||||
|
// r=0;g=0;b=255;//蓝色
|
||||||
|
// WS2812_Ctrl(r, g, b);
|
||||||
|
// delay_ticks(500);
|
||||||
|
|
||||||
|
// r=0;g=255;b=255;//青色
|
||||||
|
// WS2812_Ctrl(r, g, b);
|
||||||
|
// delay_ticks(500);
|
||||||
|
|
||||||
|
// r=255;g=0;b=255;//紫色
|
||||||
|
// WS2812_Ctrl(r, g, b);
|
||||||
|
// delay_ticks(500);
|
||||||
|
|
||||||
|
// r=255;g=255;b=255;
|
||||||
|
// WS2812_Ctrl(r, g, b);
|
||||||
|
// delay_ticks(1000);
|
||||||
|
// osDelay(1);
|
||||||
|
// osDelay(100);
|
||||||
|
}
|
||||||
29
User_Code/application/indicator_app/ws2812status.h
Normal file
29
User_Code/application/indicator_app/ws2812status.h
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
#ifndef ws2812status_H
|
||||||
|
#define ws2812status_H
|
||||||
|
|
||||||
|
/*---------------------INCLUDES----------------------*/
|
||||||
|
#include "main.h"
|
||||||
|
#include "cmsis_os.h"
|
||||||
|
#include "tim.h"
|
||||||
|
#include "ws2812.h"
|
||||||
|
|
||||||
|
/*---------------------FUNCTIONS---------------------*/
|
||||||
|
void ws2812Task(void *argument);
|
||||||
|
|
||||||
|
void robotSelfCheck(void);
|
||||||
|
|
||||||
|
void BlinkYellow(void);
|
||||||
|
|
||||||
|
void BlinkRed(void);
|
||||||
|
|
||||||
|
void BlinkBlue(void);
|
||||||
|
|
||||||
|
void BlinkGreen(void);
|
||||||
|
|
||||||
|
void BlinkWhite(void);
|
||||||
|
|
||||||
|
void BlinkCyan(void);
|
||||||
|
|
||||||
|
void BlinkPurple(void);
|
||||||
|
|
||||||
|
#endif
|
||||||
97
User_Code/application/robot.c
Normal file
97
User_Code/application/robot.c
Normal file
@@ -0,0 +1,97 @@
|
|||||||
|
/**
|
||||||
|
* @file robot.c
|
||||||
|
* @brief
|
||||||
|
* @author TuxMonkey (nqx2004@gmail.com)
|
||||||
|
* @version 1.0
|
||||||
|
* @date 2025-07-08
|
||||||
|
*
|
||||||
|
* @copyright Copyright (c) 2025 DLMU-C.ONE
|
||||||
|
*
|
||||||
|
* @par 修改日志:
|
||||||
|
* <table>
|
||||||
|
* <tr><th>Date <th>Version <th>Author <th>Description
|
||||||
|
* <tr><td>2025-07-08 <td>1.0 <td>TuxMonkey <td>内容
|
||||||
|
* </table>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "bsp_init.h"
|
||||||
|
#include "robot.h"
|
||||||
|
#include "rc.h"
|
||||||
|
#include "robot_def.h"
|
||||||
|
|
||||||
|
#include "cmsis_gcc.h"
|
||||||
|
// #include "robot_def.h"
|
||||||
|
// #include "robot_task.h"
|
||||||
|
|
||||||
|
// // 编译warning,提醒开发者修改机器人参数
|
||||||
|
// #ifndef ROBOT_DEF_PARAM_WARNING
|
||||||
|
// #define ROBOT_DEF_PARAM_WARNING
|
||||||
|
// #pragma message "check if you have configured the parameters in robot_def.h, IF NOT, please refer to the comments AND DO IT, otherwise the robot will have FATAL ERRORS!!!"
|
||||||
|
// #endif // !ROBOT_DEF_PARAM_WARNING
|
||||||
|
|
||||||
|
volatile RobotMode_t RobotMode = REMOTE_NOT_CONNECTED;
|
||||||
|
|
||||||
|
// #if defined(ONE_BOARD) || defined(CHASSIS_BOARD)
|
||||||
|
// #include "chassis.h"
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
// #if defined(ONE_BOARD) || defined(GIMBAL_BOARD)
|
||||||
|
// #include "gimbal.h"
|
||||||
|
// #include "shoot.h"
|
||||||
|
// #include "robot_cmd.h"
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 机器人初始化函数
|
||||||
|
*
|
||||||
|
* @note 该函数在系统启动时调用,用于初始化机器人各个模块
|
||||||
|
*
|
||||||
|
* @attention 请不要在初始化过程中使用中断和延时函数!
|
||||||
|
* 若必须,则只允许使用DWT_Delay()
|
||||||
|
*/
|
||||||
|
|
||||||
|
void RobotInit()
|
||||||
|
{
|
||||||
|
// 关闭中断,防止在初始化过程中发生中断
|
||||||
|
// 请不要在初始化过程中使用中断和延时函数!
|
||||||
|
// 若必须,则只允许使用DWT_Delay()
|
||||||
|
__disable_irq();
|
||||||
|
|
||||||
|
// HAL_GPIO_WritePin(Power1_GPIO_Port, Power1_Pin, GPIO_PIN_SET);//使能24V电源
|
||||||
|
// HAL_GPIO_WritePin(Power2_GPIO_Port, Power2_Pin, GPIO_PIN_SET);//使能24V电源
|
||||||
|
// HAL_GPIO_WritePin(Power_5V_EN_GPIO_Port, Power_5V_EN_Pin, GPIO_PIN_SET);//使能5V电源
|
||||||
|
|
||||||
|
BSPInit();
|
||||||
|
|
||||||
|
if (RemoteControlInit(&huart5) == NULL)
|
||||||
|
RobotMode = SYS_ERROR_OCCURRED;
|
||||||
|
|
||||||
|
#if defined(ONE_BOARD) || defined(GIMBAL_BOARD)
|
||||||
|
RobotCMDInit();
|
||||||
|
// GimbalInit();
|
||||||
|
// ShootInit();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(ONE_BOARD) || defined(CHASSIS_BOARD)
|
||||||
|
ChassisInit();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// OSTaskInit(); // 创建基础任务
|
||||||
|
|
||||||
|
// 初始化完成,开启中断
|
||||||
|
__enable_irq();
|
||||||
|
}
|
||||||
|
|
||||||
|
// void RobotTask()
|
||||||
|
// {
|
||||||
|
// #if defined(ONE_BOARD) || defined(GIMBAL_BOARD)
|
||||||
|
// RobotCMDTask();
|
||||||
|
// // GimbalTask();
|
||||||
|
// // ShootTask();
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
// #if defined(ONE_BOARD) || defined(CHASSIS_BOARD)
|
||||||
|
// ChassisTask();
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
// }
|
||||||
18
User_Code/application/robot.h
Normal file
18
User_Code/application/robot.h
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
#ifndef ROBOT_H
|
||||||
|
#define ROBOT_H
|
||||||
|
|
||||||
|
/* Robot利用robot_def.h中的宏对不同的机器人进行了大量的兼容,同时兼容了两个开发板(云台板和底盘板)的配置 */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 机器人初始化,请在开启rtos之前调用.这也是唯一需要放入main函数的函数
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void RobotInit();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 机器人任务,放入实时系统以一定频率运行,内部会调用各个应用的任务
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void RobotTask();
|
||||||
|
|
||||||
|
#endif
|
||||||
5
User_Code/application/shoot_app/shoot/shoot.c
Normal file
5
User_Code/application/shoot_app/shoot/shoot.c
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
//
|
||||||
|
// Created by esqwt on 2026/3/2.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "shoot.h"
|
||||||
8
User_Code/application/shoot_app/shoot/shoot.h
Normal file
8
User_Code/application/shoot_app/shoot/shoot.h
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
//
|
||||||
|
// Created by esqwt on 2026/3/2.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef TRONONEH7_SCAFFOLD_SHOOT_H
|
||||||
|
#define TRONONEH7_SCAFFOLD_SHOOT_H
|
||||||
|
|
||||||
|
#endif // TRONONEH7_SCAFFOLD_SHOOT_H
|
||||||
0
User_Code/application/shoot_app/shoot_app.md
Normal file
0
User_Code/application/shoot_app/shoot_app.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
//
|
||||||
|
// Created by esqwt on 2026/3/2.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "shoot_control.h"
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
//
|
||||||
|
// Created by esqwt on 2026/3/2.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef TRONONEH7_SCAFFOLD_SHOOT_CONTROL_H
|
||||||
|
#define TRONONEH7_SCAFFOLD_SHOOT_CONTROL_H
|
||||||
|
|
||||||
|
#endif // TRONONEH7_SCAFFOLD_SHOOT_CONTROL_H
|
||||||
0
User_Code/application/vision_app/vision_app.md
Normal file
0
User_Code/application/vision_app/vision_app.md
Normal file
5
User_Code/application/vision_app/visionapp.c
Normal file
5
User_Code/application/vision_app/visionapp.c
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
//
|
||||||
|
// Created by esqwt on 2026/3/2.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "visionapp.h"
|
||||||
8
User_Code/application/vision_app/visionapp.h
Normal file
8
User_Code/application/vision_app/visionapp.h
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
//
|
||||||
|
// Created by esqwt on 2026/3/2.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef TRONONEH7_SCAFFOLD_VISIONAPP_H
|
||||||
|
#define TRONONEH7_SCAFFOLD_VISIONAPP_H
|
||||||
|
|
||||||
|
#endif // TRONONEH7_SCAFFOLD_VISIONAPP_H
|
||||||
84
User_Code/bsp/adc/bsp_adc.c
Normal file
84
User_Code/bsp/adc/bsp_adc.c
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
/* USER CODE BEGIN Header */
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file : bsp_adc.c
|
||||||
|
* @brief : bsp adc functions
|
||||||
|
* @author : TuxMonkey
|
||||||
|
* @date : 2025/11/22
|
||||||
|
* @version : v1.0
|
||||||
|
******************************************************************************
|
||||||
|
* @attention : Pay attention to enable the adc
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
/* USER CODE END Header */
|
||||||
|
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include "bsp_adc.h"
|
||||||
|
#include "adc.h"
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief ADC sampling voltage array
|
||||||
|
*/
|
||||||
|
__attribute__((section(".dma_buffer"), aligned(32))) volatile uint16_t ADC_Voltage_Val[BSP_ADC_CHANNEL_COUNT];
|
||||||
|
|
||||||
|
static bool bsp_adc_started = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Configures the ADC.
|
||||||
|
* @param None
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
void BSP_ADC_Init(void)
|
||||||
|
{
|
||||||
|
if (bsp_adc_started)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
(void) HAL_ADCEx_Calibration_Start(&hadc1, ADC_CALIB_OFFSET, ADC_SINGLE_ENDED);
|
||||||
|
if (HAL_ADC_Start_DMA(&hadc1, (uint32_t *) ADC_Voltage_Val, BSP_ADC_CHANNEL_COUNT) == HAL_OK)
|
||||||
|
{
|
||||||
|
bsp_adc_started = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief USER get current voltage.
|
||||||
|
* @param None
|
||||||
|
* @retval Voltage
|
||||||
|
*/
|
||||||
|
float USER_ADC_Voltage_Update(void)
|
||||||
|
{
|
||||||
|
float voltage = ((float) ADC_Voltage_Val[BSP_ADC_BOARD_VOLTAGE_INDEX] * 3.3f / 65535.0f) * 11.0f;
|
||||||
|
return voltage;
|
||||||
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
uint16_t BSP_ADC_GetRaw(uint32_t index)
|
||||||
|
{
|
||||||
|
if (index >= BSP_ADC_CHANNEL_COUNT)
|
||||||
|
{
|
||||||
|
return 0U;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ADC_Voltage_Val[index];
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16_t BSP_ADC_GetJoystickRaw(void)
|
||||||
|
{
|
||||||
|
return BSP_ADC_GetRaw(BSP_ADC_JOYSTICK_INDEX);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16_t BSP_ADC_GetJoystickRaw12(void)
|
||||||
|
{
|
||||||
|
return (uint16_t) (BSP_ADC_GetJoystickRaw() >> 4U);
|
||||||
|
}
|
||||||
|
|
||||||
|
float BSP_ADC_GetJoystickVoltage(void)
|
||||||
|
{
|
||||||
|
return (float) BSP_ADC_GetJoystickRaw() * 3.3f / 65535.0f;
|
||||||
|
}
|
||||||
45
User_Code/bsp/adc/bsp_adc.h
Normal file
45
User_Code/bsp/adc/bsp_adc.h
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
/* USER CODE BEGIN Header */
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file : bsp_adc.h
|
||||||
|
* @brief : The header file of bsp_adc.h
|
||||||
|
* @author : TuxMonkey
|
||||||
|
* @date : 2025/11/22
|
||||||
|
* @version : v1.0
|
||||||
|
******************************************************************************
|
||||||
|
* @attention : Pay attention to config the clock source of the advanced TIM
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
/* USER CODE END Header */
|
||||||
|
|
||||||
|
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||||
|
#ifndef BSP_ADC_H
|
||||||
|
#define BSP_ADC_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include "adc.h"
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#define BSP_ADC_CHANNEL_COUNT 2U
|
||||||
|
#define BSP_ADC_BOARD_VOLTAGE_INDEX 0U
|
||||||
|
#define BSP_ADC_JOYSTICK_INDEX 1U
|
||||||
|
|
||||||
|
extern volatile uint16_t ADC_Voltage_Val[BSP_ADC_CHANNEL_COUNT];
|
||||||
|
|
||||||
|
/* Externs ---------------------------------------------*/
|
||||||
|
void BSP_ADC_Init(void);
|
||||||
|
|
||||||
|
float USER_ADC_Voltage_Update(void);
|
||||||
|
uint16_t BSP_ADC_GetRaw(uint32_t index);
|
||||||
|
uint16_t BSP_ADC_GetJoystickRaw(void);
|
||||||
|
uint16_t BSP_ADC_GetJoystickRaw12(void);
|
||||||
|
float BSP_ADC_GetJoystickVoltage(void);
|
||||||
|
#endif //BSP_ADC_H
|
||||||
22
User_Code/bsp/bsp_init.h
Normal file
22
User_Code/bsp/bsp_init.h
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
#ifndef BSP_INIT_h
|
||||||
|
#define BSP_INIT_h
|
||||||
|
|
||||||
|
#include "bsp_init.h"
|
||||||
|
// #include "bsp_log.h"
|
||||||
|
#include "bsp_dwt.h"
|
||||||
|
// #include "bsp_usb.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief bsp层初始化统一入口,这里仅初始化必须的bsp组件,其他组件的初始化在各自的模块中进行
|
||||||
|
* 需在实时系统启动前调用,目前由RobotoInit()调用
|
||||||
|
*
|
||||||
|
* @note 其他实例型的外设如CAN和串口会在注册实例的时候自动初始化,不注册不初始化
|
||||||
|
*/
|
||||||
|
void BSPInit()
|
||||||
|
{
|
||||||
|
DWT_Init(480); //Todo:修改这里以适配喵板cpufreq
|
||||||
|
// BSPLogInit();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // !BSP_INIT_h
|
||||||
|
|
||||||
39
User_Code/bsp/delayticks/delayticks.c
Normal file
39
User_Code/bsp/delayticks/delayticks.c
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
#include "delayticks.h"
|
||||||
|
|
||||||
|
/*延时函数,不会将任务挂起*/
|
||||||
|
void delay_ticks(uint32_t delay)
|
||||||
|
{
|
||||||
|
/*开始计数器值*/
|
||||||
|
uint32_t tickstart = xTaskGetTickCount();
|
||||||
|
/*指定延时时间*/
|
||||||
|
uint32_t wait = delay;
|
||||||
|
/*计算当前计数器值和开始计数器值的差*/
|
||||||
|
uint32_t ticks_diff = xTaskGetTickCount() - tickstart;
|
||||||
|
|
||||||
|
if ( ticks_diff < wait )
|
||||||
|
{
|
||||||
|
/*计算剩余等待的时间*/
|
||||||
|
uint32_t remaining_ticks = wait - ticks_diff;
|
||||||
|
|
||||||
|
/*循环等待,直到剩余时间结束*/
|
||||||
|
while ( ( xTaskGetTickCount() - tickstart) < wait )
|
||||||
|
{
|
||||||
|
/*如果发生溢出,则重新计算时间差*/
|
||||||
|
if ( xTaskGetTickCount() < tickstart )
|
||||||
|
{
|
||||||
|
/*重新计算时间差*/
|
||||||
|
ticks_diff = UINT32_MAX - tickstart + xTaskGetTickCount();
|
||||||
|
|
||||||
|
if ( ticks_diff < wait )
|
||||||
|
{
|
||||||
|
remaining_ticks = wait - ticks_diff;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/*如果时间差已经大于等于等待时间,则退出*/
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
10
User_Code/bsp/delayticks/delayticks.h
Normal file
10
User_Code/bsp/delayticks/delayticks.h
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
#ifndef DELAYTICKS_H
|
||||||
|
#define DELAYTICKS_H
|
||||||
|
|
||||||
|
#include "main.h"
|
||||||
|
#include "cmsis_os.h"
|
||||||
|
#include "tim.h"
|
||||||
|
|
||||||
|
extern void delay_ticks(uint32_t delay);
|
||||||
|
|
||||||
|
#endif
|
||||||
5
User_Code/bsp/dmaMalloc/bsp_dmaMalloc.c
Normal file
5
User_Code/bsp/dmaMalloc/bsp_dmaMalloc.c
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
//
|
||||||
|
// Created by tuxmonkey on 2025/10/28.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "bsp_dmaMalloc.h"
|
||||||
8
User_Code/bsp/dmaMalloc/bsp_dmaMalloc.h
Normal file
8
User_Code/bsp/dmaMalloc/bsp_dmaMalloc.h
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
//
|
||||||
|
// Created by tuxmonkey on 2025/10/28.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef TRONONEH7_SCAFFOLD_BSP_DMAMALLOC_H
|
||||||
|
#define TRONONEH7_SCAFFOLD_BSP_DMAMALLOC_H
|
||||||
|
|
||||||
|
#endif //TRONONEH7_SCAFFOLD_BSP_DMAMALLOC_H
|
||||||
139
User_Code/bsp/dwt/bsp_dwt.c
Normal file
139
User_Code/bsp/dwt/bsp_dwt.c
Normal file
@@ -0,0 +1,139 @@
|
|||||||
|
/**
|
||||||
|
* @file bsp_dwt.c
|
||||||
|
* @brief DWT延时 软件延时库
|
||||||
|
* @author TuxMonkey (nqx2004@gmail.com)
|
||||||
|
* @version 1.0
|
||||||
|
* @date 2025-07-08
|
||||||
|
*
|
||||||
|
* @copyright Copyright (c) 2025 DLMU-C.ONE
|
||||||
|
*
|
||||||
|
* @par 修改日志:
|
||||||
|
* <table>
|
||||||
|
* <tr><th>Date <th>Version <th>Author <th>Description
|
||||||
|
* <tr><td>2025-07-08 <td>1.0 <td>TuxMonkey <td>内容
|
||||||
|
* </table>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "bsp_dwt.h"
|
||||||
|
#include "cmsis_os.h"
|
||||||
|
|
||||||
|
static DWT_Time_t SysTime;
|
||||||
|
static uint32_t CPU_FREQ_Hz, CPU_FREQ_Hz_ms, CPU_FREQ_Hz_us;
|
||||||
|
static uint32_t CYCCNT_RountCount;
|
||||||
|
static uint32_t CYCCNT_LAST;
|
||||||
|
static uint64_t CYCCNT64;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 私有函数,用于检查DWT CYCCNT寄存器是否溢出,并更新CYCCNT_RountCount
|
||||||
|
* @attention 此函数假设两次调用之间的时间间隔不超过一次溢出
|
||||||
|
*
|
||||||
|
* @todo 更好的方案是为dwt的时间更新单独设置一个任务?
|
||||||
|
* 不过,使用dwt的初衷是定时不被中断/任务等因素影响,因此该实现仍然有其存在的意义
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
static void DWT_CNT_Update(void)
|
||||||
|
{
|
||||||
|
static volatile uint8_t bit_locker = 0;
|
||||||
|
if (!bit_locker)
|
||||||
|
{
|
||||||
|
bit_locker = 1;
|
||||||
|
volatile uint32_t cnt_now = DWT->CYCCNT;
|
||||||
|
if (cnt_now < CYCCNT_LAST)
|
||||||
|
CYCCNT_RountCount++;
|
||||||
|
|
||||||
|
CYCCNT_LAST = DWT->CYCCNT;
|
||||||
|
bit_locker = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void DWT_Init(uint32_t CPU_Freq_mHz)
|
||||||
|
{
|
||||||
|
/* 使能DWT外设 */
|
||||||
|
CoreDebug->DEMCR |= CoreDebug_DEMCR_TRCENA_Msk;
|
||||||
|
|
||||||
|
/* DWT CYCCNT寄存器计数清0 */
|
||||||
|
DWT->CYCCNT = (uint32_t) 0u;
|
||||||
|
|
||||||
|
/* 使能Cortex-M DWT CYCCNT寄存器 */
|
||||||
|
DWT->CTRL |= DWT_CTRL_CYCCNTENA_Msk;
|
||||||
|
|
||||||
|
CPU_FREQ_Hz = CPU_Freq_mHz * 1000000;
|
||||||
|
CPU_FREQ_Hz_ms = CPU_FREQ_Hz / 1000;
|
||||||
|
CPU_FREQ_Hz_us = CPU_FREQ_Hz / 1000000;
|
||||||
|
CYCCNT_RountCount = 0;
|
||||||
|
|
||||||
|
DWT_CNT_Update();
|
||||||
|
}
|
||||||
|
|
||||||
|
float DWT_GetDeltaT(uint32_t *cnt_last)
|
||||||
|
{
|
||||||
|
volatile uint32_t cnt_now = DWT->CYCCNT;
|
||||||
|
float dt = ((uint32_t) (cnt_now - *cnt_last)) / ((float) (CPU_FREQ_Hz));
|
||||||
|
*cnt_last = cnt_now;
|
||||||
|
|
||||||
|
DWT_CNT_Update();
|
||||||
|
|
||||||
|
return dt;
|
||||||
|
}
|
||||||
|
|
||||||
|
double DWT_GetDeltaT64(uint32_t *cnt_last)
|
||||||
|
{
|
||||||
|
volatile uint32_t cnt_now = DWT->CYCCNT;
|
||||||
|
double dt = ((uint32_t) (cnt_now - *cnt_last)) / ((double) (CPU_FREQ_Hz));
|
||||||
|
*cnt_last = cnt_now;
|
||||||
|
|
||||||
|
DWT_CNT_Update();
|
||||||
|
|
||||||
|
return dt;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DWT_SysTimeUpdate(void)
|
||||||
|
{
|
||||||
|
volatile uint32_t cnt_now = DWT->CYCCNT;
|
||||||
|
static uint64_t CNT_TEMP1, CNT_TEMP2, CNT_TEMP3;
|
||||||
|
|
||||||
|
DWT_CNT_Update();
|
||||||
|
|
||||||
|
CYCCNT64 = (uint64_t) CYCCNT_RountCount * (uint64_t) UINT32_MAX + (uint64_t) cnt_now;
|
||||||
|
CNT_TEMP1 = CYCCNT64 / CPU_FREQ_Hz;
|
||||||
|
CNT_TEMP2 = CYCCNT64 - CNT_TEMP1 * CPU_FREQ_Hz;
|
||||||
|
SysTime.s = CNT_TEMP1;
|
||||||
|
SysTime.ms = CNT_TEMP2 / CPU_FREQ_Hz_ms;
|
||||||
|
CNT_TEMP3 = CNT_TEMP2 - SysTime.ms * CPU_FREQ_Hz_ms;
|
||||||
|
SysTime.us = CNT_TEMP3 / CPU_FREQ_Hz_us;
|
||||||
|
}
|
||||||
|
|
||||||
|
float DWT_GetTimeline_s(void)
|
||||||
|
{
|
||||||
|
DWT_SysTimeUpdate();
|
||||||
|
|
||||||
|
float DWT_Timelinef32 = SysTime.s + SysTime.ms * 0.001f + SysTime.us * 0.000001f;
|
||||||
|
|
||||||
|
return DWT_Timelinef32;
|
||||||
|
}
|
||||||
|
|
||||||
|
float DWT_GetTimeline_ms(void)
|
||||||
|
{
|
||||||
|
DWT_SysTimeUpdate();
|
||||||
|
|
||||||
|
float DWT_Timelinef32 = SysTime.s * 1000 + SysTime.ms + SysTime.us * 0.001f;
|
||||||
|
|
||||||
|
return DWT_Timelinef32;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint64_t DWT_GetTimeline_us(void)
|
||||||
|
{
|
||||||
|
DWT_SysTimeUpdate();
|
||||||
|
|
||||||
|
uint64_t DWT_Timelinef32 = SysTime.s * 1000000 + SysTime.ms * 1000 + SysTime.us;
|
||||||
|
|
||||||
|
return DWT_Timelinef32;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DWT_Delay(float Delay)
|
||||||
|
{
|
||||||
|
uint32_t tickstart = DWT->CYCCNT;
|
||||||
|
float wait = Delay;
|
||||||
|
|
||||||
|
while ((DWT->CYCCNT - tickstart) < wait * (float) CPU_FREQ_Hz);
|
||||||
|
}
|
||||||
104
User_Code/bsp/dwt/bsp_dwt.h
Normal file
104
User_Code/bsp/dwt/bsp_dwt.h
Normal file
@@ -0,0 +1,104 @@
|
|||||||
|
/**
|
||||||
|
* @file bsp_dwt.h
|
||||||
|
* @brief DWT延时 软件延时库头文件
|
||||||
|
* @author TuxMonkey (nqx2004@gmail.com)
|
||||||
|
* @version 1.0
|
||||||
|
* @date 2025-07-08
|
||||||
|
*
|
||||||
|
* @copyright Copyright (c) 2025 DLMU-C.ONE
|
||||||
|
*
|
||||||
|
* @par 修改日志:
|
||||||
|
* <table>
|
||||||
|
* <tr><th>Date <th>Version <th>Author <th>Description
|
||||||
|
* <tr><td>2025-07-08 <td>1.0 <td>TuxMonkey <td>内容
|
||||||
|
* </table>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _BSP_DWT_H
|
||||||
|
#define _BSP_DWT_H
|
||||||
|
|
||||||
|
#include "main.h"
|
||||||
|
#include "stdint.h"
|
||||||
|
#include "bsp_log.h"
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
uint32_t s;
|
||||||
|
uint16_t ms;
|
||||||
|
uint16_t us;
|
||||||
|
} DWT_Time_t;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 该宏用于计算代码段执行时间,单位为秒/s,返回值为float类型
|
||||||
|
* 首先需要创建一个float类型的变量,用于存储时间间隔
|
||||||
|
* 计算得到的时间间隔同时还会通过RTT打印到日志终端,你也可以将你的dt变量添加到查看
|
||||||
|
*/
|
||||||
|
#define TIME_ELAPSE(dt, code) \
|
||||||
|
do \
|
||||||
|
{ \
|
||||||
|
float tstart = DWT_GetTimeline_s(); \
|
||||||
|
code; \
|
||||||
|
dt = DWT_GetTimeline_s() - tstart; \
|
||||||
|
LOGINFO("[DWT] " #dt " = %f s\r\n", dt); \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 初始化DWT,传入参数为CPU频率,单位MHz
|
||||||
|
*
|
||||||
|
* @param CPU_Freq_mHz c板为168MHz,A板为180MHz
|
||||||
|
*/
|
||||||
|
void DWT_Init(uint32_t CPU_Freq_mHz);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 获取两次调用之间的时间间隔,单位为秒/s
|
||||||
|
*
|
||||||
|
* @param cnt_last 上一次调用的时间戳
|
||||||
|
* @return float 时间间隔,单位为秒/s
|
||||||
|
*/
|
||||||
|
float DWT_GetDeltaT(uint32_t *cnt_last);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 获取两次调用之间的时间间隔,单位为秒/s,高精度
|
||||||
|
*
|
||||||
|
* @param cnt_last 上一次调用的时间戳
|
||||||
|
* @return double 时间间隔,单位为秒/s
|
||||||
|
*/
|
||||||
|
double DWT_GetDeltaT64(uint32_t *cnt_last);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 获取当前时间,单位为秒/s,即初始化后的时间
|
||||||
|
*
|
||||||
|
* @return float 时间轴
|
||||||
|
*/
|
||||||
|
float DWT_GetTimeline_s(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 获取当前时间,单位为毫秒/ms,即初始化后的时间
|
||||||
|
*
|
||||||
|
* @return float
|
||||||
|
*/
|
||||||
|
float DWT_GetTimeline_ms(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 获取当前时间,单位为微秒/us,即初始化后的时间
|
||||||
|
*
|
||||||
|
* @return uint64_t
|
||||||
|
*/
|
||||||
|
uint64_t DWT_GetTimeline_us(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief DWT延时函数,单位为秒/s
|
||||||
|
* @attention 该函数不受中断是否开启的影响,可以在临界区和关闭中断时使用
|
||||||
|
* @note 禁止在__disable_irq()和__enable_irq()之间使用HAL_Delay()函数,应使用本函数
|
||||||
|
*
|
||||||
|
* @param Delay 延时时间,单位为秒/s
|
||||||
|
*/
|
||||||
|
void DWT_Delay(float Delay);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief DWT更新时间轴函数,会被三个timeline函数调用
|
||||||
|
* @attention 如果长时间不调用timeline函数,则需要手动调用该函数更新时间轴,否则CYCCNT溢出后定时和时间轴不准确
|
||||||
|
*/
|
||||||
|
void DWT_SysTimeUpdate(void);
|
||||||
|
|
||||||
|
#endif /* BSP_DWT_H_ */
|
||||||
54
User_Code/bsp/dwt/bsp_dwt.md
Normal file
54
User_Code/bsp/dwt/bsp_dwt.md
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
# bsp_dwt
|
||||||
|
|
||||||
|
DWT是stm32内部的一个"隐藏资源",他的用途是给下载器提供准确的定时,从而为调试信息加上时间戳.并在固定的时间间隔将调试数据发送到你的xxlink上.
|
||||||
|
|
||||||
|
## 常用功能
|
||||||
|
|
||||||
|
### 计算两次进入同一个函数的时间间隔
|
||||||
|
|
||||||
|
```c
|
||||||
|
static uint32_t cnt;
|
||||||
|
float deltaT;
|
||||||
|
|
||||||
|
deltaT=DWT_GetDeltaT(&cnt);
|
||||||
|
```
|
||||||
|
|
||||||
|
### 计算执行某部分代码的耗时
|
||||||
|
|
||||||
|
```c
|
||||||
|
float start,end;
|
||||||
|
start=DWT_DetTimeline_ms();
|
||||||
|
|
||||||
|
// some proc to go...
|
||||||
|
for(uint8_t i=0;i<10;i++)
|
||||||
|
foo();
|
||||||
|
|
||||||
|
end = DWT_DetTimeline_ms()-start;
|
||||||
|
```
|
||||||
|
|
||||||
|
我们还提供了一个宏用于调试计时:
|
||||||
|
|
||||||
|
```c
|
||||||
|
#define TIME_ELAPSE(dt, code) \
|
||||||
|
do \
|
||||||
|
{ \
|
||||||
|
float tstart = DWT_GetTimeline_s(); \
|
||||||
|
code; \
|
||||||
|
dt = DWT_GetTimeline_s() - tstart; \
|
||||||
|
LOGINFO("[DWT] " #dt " = %f s\r\n", dt); \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
传入一个float类型的变量,并将你要执行的代码写入第二个参数:
|
||||||
|
|
||||||
|
```c
|
||||||
|
static float my_func_dt;
|
||||||
|
TIME_ELAPSE(my_func_dt,
|
||||||
|
Function1(vara);
|
||||||
|
Function2(some, var);
|
||||||
|
Function3(your,param);
|
||||||
|
// something more
|
||||||
|
);
|
||||||
|
// my_func_dt can be used for other purpose then;
|
||||||
|
```
|
||||||
437
User_Code/bsp/fdcan/bsp_fdcan.c
Normal file
437
User_Code/bsp/fdcan/bsp_fdcan.c
Normal file
@@ -0,0 +1,437 @@
|
|||||||
|
#include "bsp_fdcan.h"
|
||||||
|
#include "main.h"
|
||||||
|
#include "memory.h"
|
||||||
|
#include "stdlib.h"
|
||||||
|
#include "bsp_dwt.h"
|
||||||
|
#include "bsp_log.h"
|
||||||
|
//说是fdcan实际上就是配置成了经典的CAN
|
||||||
|
|
||||||
|
/* can instance ptrs storage, used for recv callback */
|
||||||
|
// 在CAN产生接收中断会遍历数组,选出hcan和rxid与发生中断的实例相同的那个,调用其回调函数
|
||||||
|
// @todo: 后续为每个CAN总线单独添加一个can_instance指针数组,提高回调查找的性能
|
||||||
|
static FDCANInstance *fdcan_instance[CAN_MX_REGISTER_CNT] = {NULL};
|
||||||
|
static uint8_t idx; // 全局CAN实例索引,每次有新的模块注册会自增
|
||||||
|
|
||||||
|
/* ----------------two static function called by CANRegister()-------------------- */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 添加过滤器以实现对特定id的报文的接收,会被CANRegister()调用
|
||||||
|
* 给CAN添加过滤器后,BxCAN会根据接收到的报文的id进行消息过滤,符合规则的id会被填入FIFO触发中断
|
||||||
|
* 对于FDCAN,设置使用特定ID模式过滤。
|
||||||
|
*
|
||||||
|
* @note f407的bxCAN有28个过滤器,这里将其配置为前14个过滤器给CAN1使用,后14个被CAN2使用
|
||||||
|
* 初始化时,奇数id的模块会被分配到FIFO0,偶数id的模块会被分配到FIFO1
|
||||||
|
* 注册到CAN1的模块使用过滤器0-13,CAN2使用过滤器14-27
|
||||||
|
* FDCAN的消息RAM是所有FDCAN外设共用的。
|
||||||
|
* H723系列FDCAN过滤器数量完全在CubeMX中自定义,因此先做一次检查,再添加即可。
|
||||||
|
*
|
||||||
|
* @attention 你不需要完全理解这个函数的作用,因为它主要是用于初始化,在开发过程中不需要关心底层的实现
|
||||||
|
* 享受开发的乐趣吧!如果你真的想知道这个函数在干什么,请联系作者或自己查阅资料(请直接查阅官方的reference manual)
|
||||||
|
* FDCAN的教程较少,但是添加FDCAN的人已经发了一篇CSDN讲解了,可以参考一下
|
||||||
|
*
|
||||||
|
* @param _instance can instance owned by specific module
|
||||||
|
*/
|
||||||
|
static void CANAddFilter(FDCANInstance *_instance)
|
||||||
|
{
|
||||||
|
#ifdef FDCAN
|
||||||
|
static uint8_t can1_filter_idx = 0, can2_filter_idx = 0, can3_filter_idx = 0;
|
||||||
|
//检查是否超出过滤器设定数量上限
|
||||||
|
if (can1_filter_idx > hfdcan1.Init.StdFiltersNbr || can2_filter_idx > hfdcan2.Init.StdFiltersNbr || can3_filter_idx
|
||||||
|
> hfdcan3.Init.StdFiltersNbr)
|
||||||
|
{
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
//报错
|
||||||
|
}
|
||||||
|
}
|
||||||
|
uint8_t *filter_idx_p;
|
||||||
|
|
||||||
|
if (_instance->can_handle == &hfdcan1)
|
||||||
|
{
|
||||||
|
filter_idx_p = &can1_filter_idx;
|
||||||
|
}
|
||||||
|
else if (_instance->can_handle == &hfdcan2)
|
||||||
|
{
|
||||||
|
filter_idx_p = &can2_filter_idx;
|
||||||
|
}
|
||||||
|
else if (_instance->can_handle == &hfdcan3)
|
||||||
|
{
|
||||||
|
filter_idx_p = &can3_filter_idx;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
//报错
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FDCAN_FilterTypeDef fdcan_filter_conf;
|
||||||
|
fdcan_filter_conf.FilterIndex = (*filter_idx_p)++;
|
||||||
|
//使用单个ID模式
|
||||||
|
fdcan_filter_conf.FilterType = FDCAN_FILTER_DUAL;
|
||||||
|
fdcan_filter_conf.FilterConfig = (_instance->tx_id & 1) ? FDCAN_FILTER_TO_RXFIFO0 : FDCAN_FILTER_TO_RXFIFO1;
|
||||||
|
//奇数id的模块会被分配到FIFO0,偶数id的模块会被分配到FIFO1
|
||||||
|
fdcan_filter_conf.FilterID1 = _instance->rx_id;
|
||||||
|
fdcan_filter_conf.FilterID2 = _instance->rx_id;
|
||||||
|
fdcan_filter_conf.IdType = FDCAN_STANDARD_ID;
|
||||||
|
fdcan_filter_conf.IsCalibrationMsg = 0;
|
||||||
|
//fdcan_filter_conf.RxBufferIndex=0;
|
||||||
|
|
||||||
|
// // ================== 【核心修复区】 ==================@todo:有问题 我要验牌
|
||||||
|
// // 1. 强制让 FDCAN 进入 INIT 模式,否则无法写入 Message RAM
|
||||||
|
// HAL_FDCAN_Stop(_instance->can_handle);
|
||||||
|
//
|
||||||
|
// // 2. 写入过滤器配置
|
||||||
|
// HAL_FDCAN_ConfigFilter(_instance->can_handle, &fdcan_filter_conf);
|
||||||
|
//
|
||||||
|
// // 3. 重新启动 FDCAN
|
||||||
|
// HAL_FDCAN_Start(_instance->can_handle);
|
||||||
|
//
|
||||||
|
// // 4. 【救命稻草】HAL_FDCAN_Stop 关闭了所有中断,必须在这里重新激活!
|
||||||
|
// uint32_t FDCAN_RXActiveITs = FDCAN_IT_RX_FIFO0_NEW_MESSAGE | FDCAN_IT_RX_FIFO0_FULL |
|
||||||
|
// FDCAN_IT_RX_FIFO0_WATERMARK | FDCAN_IT_RX_FIFO0_MESSAGE_LOST |
|
||||||
|
// FDCAN_IT_RX_FIFO1_NEW_MESSAGE | FDCAN_IT_RX_FIFO1_FULL |
|
||||||
|
// FDCAN_IT_RX_FIFO1_WATERMARK | FDCAN_IT_RX_FIFO1_MESSAGE_LOST;
|
||||||
|
// HAL_FDCAN_ActivateNotification(_instance->can_handle, FDCAN_RXActiveITs, 0);
|
||||||
|
// // ====================================================
|
||||||
|
|
||||||
|
HAL_FDCAN_ConfigFilter(_instance->can_handle, &fdcan_filter_conf);
|
||||||
|
|
||||||
|
#else
|
||||||
|
CAN_FilterTypeDef can_filter_conf;
|
||||||
|
static uint8_t can1_filter_idx = 0, can2_filter_idx = 14; // 0-13给can1用,14-27给can2用
|
||||||
|
|
||||||
|
can_filter_conf.FilterMode = CAN_FILTERMODE_IDLIST; // 使用id list模式,即只有将rxid添加到过滤器中才会接收到,其他报文会被过滤
|
||||||
|
can_filter_conf.FilterScale = CAN_FILTERSCALE_16BIT; // 使用16位id模式,即只有低16位有效
|
||||||
|
can_filter_conf.FilterFIFOAssignment = (_instance->tx_id & 1) ? CAN_RX_FIFO0 : CAN_RX_FIFO1;
|
||||||
|
// 奇数id的模块会被分配到FIFO0,偶数id的模块会被分配到FIFO1
|
||||||
|
can_filter_conf.SlaveStartFilterBank = 14; // 从第14个过滤器开始配置从机过滤器(在STM32的BxCAN控制器中CAN2是CAN1的从机)
|
||||||
|
can_filter_conf.FilterIdLow = _instance->rx_id << 5; // 过滤器寄存器的低16位,因为使用STDID,所以只有低11位有效,高5位要填0
|
||||||
|
can_filter_conf.FilterBank = _instance->can_handle == &hcan1 ? (can1_filter_idx++) : (can2_filter_idx++);
|
||||||
|
// 根据can_handle判断是CAN1还是CAN2,然后自增
|
||||||
|
can_filter_conf.FilterActivation = CAN_FILTER_ENABLE; // 启用过滤器
|
||||||
|
|
||||||
|
HAL_CAN_ConfigFilter(_instance->can_handle, &can_filter_conf);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 在第一个CAN实例初始化的时候会自动调用此函数,启动CAN服务
|
||||||
|
*
|
||||||
|
* @note 此函数会启动CAN1并开启中断
|
||||||
|
* FDCAN的情况下,我们采用FIFO接收方式(而不是buffer),FIFO和buffer还有queue接收方式请自行查阅H723手册
|
||||||
|
* FDCAN比bxCAN多了一个全局过滤器,这里配置为全部拒绝,只接受指定ID。
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void CANServiceInit()
|
||||||
|
{
|
||||||
|
#ifdef FDCAN
|
||||||
|
//可能不需要这么多中断
|
||||||
|
uint32_t FDCAN_RXActiveITs = FDCAN_IT_RX_FIFO0_NEW_MESSAGE | FDCAN_IT_RX_FIFO0_FULL\
|
||||||
|
| FDCAN_IT_RX_FIFO0_WATERMARK | FDCAN_IT_RX_FIFO0_MESSAGE_LOST
|
||||||
|
| FDCAN_IT_RX_FIFO1_NEW_MESSAGE | FDCAN_IT_RX_FIFO1_FULL\
|
||||||
|
| FDCAN_IT_RX_FIFO1_WATERMARK | FDCAN_IT_RX_FIFO1_MESSAGE_LOST;
|
||||||
|
|
||||||
|
|
||||||
|
//HAL_FDCAN_ConfigClockCalibration()
|
||||||
|
HAL_FDCAN_ConfigRxFifoOverwrite(&hfdcan1,FDCAN_RX_FIFO0,FDCAN_RX_FIFO_OVERWRITE);
|
||||||
|
HAL_FDCAN_ConfigRxFifoOverwrite(&hfdcan1,FDCAN_RX_FIFO1,FDCAN_RX_FIFO_OVERWRITE);
|
||||||
|
HAL_FDCAN_ConfigGlobalFilter(&hfdcan1, FDCAN_REJECT, FDCAN_REJECT, FDCAN_REJECT_REMOTE, FDCAN_REJECT_REMOTE);
|
||||||
|
//全局过滤器设置
|
||||||
|
HAL_FDCAN_Start(&hfdcan1);
|
||||||
|
HAL_FDCAN_ActivateNotification(&hfdcan1, FDCAN_RXActiveITs, 0);
|
||||||
|
|
||||||
|
HAL_FDCAN_ConfigRxFifoOverwrite(&hfdcan2,FDCAN_RX_FIFO0,FDCAN_RX_FIFO_OVERWRITE);
|
||||||
|
HAL_FDCAN_ConfigRxFifoOverwrite(&hfdcan2,FDCAN_RX_FIFO1,FDCAN_RX_FIFO_OVERWRITE);
|
||||||
|
HAL_FDCAN_ConfigGlobalFilter(&hfdcan2, FDCAN_REJECT, FDCAN_REJECT, FDCAN_REJECT_REMOTE, FDCAN_REJECT_REMOTE);
|
||||||
|
HAL_FDCAN_Start(&hfdcan2);
|
||||||
|
HAL_FDCAN_ActivateNotification(&hfdcan2, FDCAN_RXActiveITs, 0);
|
||||||
|
|
||||||
|
|
||||||
|
HAL_FDCAN_ConfigRxFifoOverwrite(&hfdcan3,FDCAN_RX_FIFO0,FDCAN_RX_FIFO_OVERWRITE);
|
||||||
|
HAL_FDCAN_ConfigRxFifoOverwrite(&hfdcan3,FDCAN_RX_FIFO1,FDCAN_RX_FIFO_OVERWRITE);
|
||||||
|
HAL_FDCAN_ConfigGlobalFilter(&hfdcan3, FDCAN_REJECT, FDCAN_REJECT, FDCAN_REJECT_REMOTE, FDCAN_REJECT_REMOTE);
|
||||||
|
HAL_FDCAN_Start(&hfdcan3);
|
||||||
|
HAL_FDCAN_ActivateNotification(&hfdcan3, FDCAN_RXActiveITs, 0);
|
||||||
|
|
||||||
|
|
||||||
|
#else
|
||||||
|
HAL_CAN_Start(&hcan1);
|
||||||
|
HAL_CAN_ActivateNotification(&hcan1, CAN_IT_RX_FIFO0_MSG_PENDING);
|
||||||
|
HAL_CAN_ActivateNotification(&hcan1, CAN_IT_RX_FIFO1_MSG_PENDING);
|
||||||
|
HAL_CAN_Start(&hcan2);
|
||||||
|
HAL_CAN_ActivateNotification(&hcan2, CAN_IT_RX_FIFO0_MSG_PENDING);
|
||||||
|
HAL_CAN_ActivateNotification(&hcan2, CAN_IT_RX_FIFO1_MSG_PENDING);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ----------------------- two extern callable function -----------------------*/
|
||||||
|
|
||||||
|
FDCANInstance *CANRegister(FDCAN_Init_Config_s *config)
|
||||||
|
{
|
||||||
|
if (!idx)
|
||||||
|
{
|
||||||
|
CANServiceInit(); // 第一次注册,先进行硬件初始化
|
||||||
|
LOGINFO("[bsp_can] CAN Service Init");
|
||||||
|
}
|
||||||
|
if (idx >= CAN_MX_REGISTER_CNT) // 超过最大实例数
|
||||||
|
{
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
LOGERROR("[bsp_can] CAN instance exceeded MAX num, consider balance the load of CAN bus");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (size_t i = 0; i < idx; i++)
|
||||||
|
{
|
||||||
|
// 重复注册 | id重复
|
||||||
|
if (fdcan_instance[i]->rx_id == config->rx_id && fdcan_instance[i]->can_handle == config->can_handle)
|
||||||
|
{
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
LOGERROR("[}bsp_can] CAN id crash ,tx [%d] or rx [%d] already registered", &config->tx_id,
|
||||||
|
&config->rx_id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FDCANInstance *instance = (FDCANInstance *) malloc(sizeof(FDCANInstance)); // 分配空间
|
||||||
|
memset(instance, 0, sizeof(FDCANInstance)); // 分配的空间未必是0,所以要先清空
|
||||||
|
// 进行发送报文的配置
|
||||||
|
#ifdef FDCAN
|
||||||
|
instance->txconf.Identifier = config->tx_id; // 发送id
|
||||||
|
instance->txconf.IdType = FDCAN_STANDARD_ID; // 使用标准id,扩展id则使用CAN_ID_EXT(目前没有需求)
|
||||||
|
instance->txconf.TxFrameType = FDCAN_DATA_FRAME, // 发送数据帧
|
||||||
|
instance->txconf.DataLength = FDCAN_DLC_BYTES_8, // 数据长度为8字节
|
||||||
|
instance->txconf.ErrorStateIndicator = FDCAN_ESI_ACTIVE, // 兼容CAN2.0,错误状态指示器设为主动
|
||||||
|
instance->txconf.BitRateSwitch = FDCAN_BRS_OFF, // 兼容CAN2.0禁用位速率切换
|
||||||
|
instance->txconf.FDFormat = FDCAN_CLASSIC_CAN, // 使用经典CAN格式
|
||||||
|
instance->txconf.TxEventFifoControl = FDCAN_NO_TX_EVENTS, // 不需要,禁用事件FIFO
|
||||||
|
instance->txconf.MessageMarker = 0; // 不使用消息标记
|
||||||
|
#else
|
||||||
|
instance->txconf.StdId = config->tx_id; // 发送id
|
||||||
|
instance->txconf.IDE = CAN_ID_STD; // 使用标准id,扩展id则使用CAN_ID_EXT(目前没有需求)
|
||||||
|
instance->txconf.RTR = CAN_RTR_DATA; // 发送数据帧
|
||||||
|
instance->txconf.DLC = 0x08; // 默认发送长度为8
|
||||||
|
#endif
|
||||||
|
// 设置回调函数和接收发送id
|
||||||
|
instance->can_handle = config->can_handle;
|
||||||
|
instance->tx_id = config->tx_id; // 好像没用,可以删掉
|
||||||
|
instance->rx_id = config->rx_id;
|
||||||
|
instance->can_module_callback = config->can_module_callback;
|
||||||
|
instance->id = config->id;
|
||||||
|
|
||||||
|
CANAddFilter(instance); // 添加CAN过滤器规则
|
||||||
|
fdcan_instance[idx++] = instance; // 将实例保存到can_instance中
|
||||||
|
|
||||||
|
return instance; // 返回can实例指针
|
||||||
|
}
|
||||||
|
|
||||||
|
/* @todo 目前似乎封装过度,应该添加一个指向tx_buff的指针,tx_buff不应该由CAN instance保存 */
|
||||||
|
/* 如果让CANinstance保存txbuff,会增加一次复制的开销 */
|
||||||
|
uint8_t CANTransmit(FDCANInstance *_instance, float timeout)
|
||||||
|
{
|
||||||
|
static uint32_t busy_count;
|
||||||
|
static volatile float wait_time __attribute__((unused)); // for cancel warning
|
||||||
|
float dwt_start = DWT_GetTimeline_ms();
|
||||||
|
#ifdef FDCAN
|
||||||
|
while (HAL_FDCAN_GetTxFifoFreeLevel(_instance->can_handle) == 0)
|
||||||
|
#else
|
||||||
|
while (HAL_CAN_GetTxMailboxesFreeLevel(_instance->can_handle) == 0) // 等待邮箱空闲
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
if (DWT_GetTimeline_ms() - dwt_start > timeout) // 超时
|
||||||
|
{
|
||||||
|
LOGWARNING("[bsp_can] CAN MAILbox full! failed to add msg to mailbox. Cnt [%d]", busy_count);
|
||||||
|
busy_count++;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
wait_time = DWT_GetTimeline_ms() - dwt_start;
|
||||||
|
|
||||||
|
#ifdef FDCAN
|
||||||
|
if (HAL_FDCAN_AddMessageToTxFifoQ(_instance->can_handle, &_instance->txconf, _instance->tx_buff))
|
||||||
|
#else
|
||||||
|
// tx_mailbox会保存实际填入了这一帧消息的邮箱,但是知道是哪个邮箱发的似乎也没啥用
|
||||||
|
if (HAL_CAN_AddTxMessage(_instance->can_handle, &_instance->txconf, _instance->tx_buff, &_instance->tx_mailbox))
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
LOGWARNING("[bsp_can] CAN bus BUSY! cnt:%d", busy_count);
|
||||||
|
busy_count++;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return 1; // 发送成功
|
||||||
|
}
|
||||||
|
|
||||||
|
void CANSetDLC(FDCANInstance *_instance, uint8_t length)
|
||||||
|
{
|
||||||
|
// 发送长度错误!检查调用参数是否出错,或出现野指针/越界访问
|
||||||
|
if (length > 8 || length == 0) // 安全检查
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
LOGERROR("[bsp_can] CAN DLC error! check your code or wild pointer");
|
||||||
|
}
|
||||||
|
|
||||||
|
_instance->txconf.DataLength = DLC_LookUp_Table[length];
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -----------------------belows are callback definitions--------------------------*/
|
||||||
|
|
||||||
|
//对于FDCAN,回调函数和处理方式完全不同,因此直接用两套逻辑处理
|
||||||
|
#ifdef FDCAN
|
||||||
|
/**
|
||||||
|
* @brief 此函数会被下面两个函数调用,用于处理FIFO0和FIFO1溢出中断(说明收到了新的数据)
|
||||||
|
* 所有的实例都会被遍历,找到can_handle和rx_id相等的实例时,调用该实例的回调函数
|
||||||
|
*
|
||||||
|
* @param _hfdcan
|
||||||
|
* @param fifox passed to HAL_CAN_GetRxMessage() to get mesg from a specific fifo
|
||||||
|
*/
|
||||||
|
static void FDCANFIFOxCallback(FDCAN_HandleTypeDef *_hfdcan, uint32_t fifox)
|
||||||
|
{
|
||||||
|
static FDCAN_RxHeaderTypeDef rxconf;
|
||||||
|
static uint16_t DataLength = 0;
|
||||||
|
static uint8_t fdcan_rx_buff[8];
|
||||||
|
|
||||||
|
while (HAL_FDCAN_GetRxFifoFillLevel(_hfdcan, fifox))
|
||||||
|
{
|
||||||
|
HAL_FDCAN_GetRxMessage(_hfdcan, fifox, &rxconf, fdcan_rx_buff);
|
||||||
|
|
||||||
|
//@todo:DataLength解析
|
||||||
|
switch (rxconf.DataLength)
|
||||||
|
{
|
||||||
|
case FDCAN_DLC_BYTES_0: DataLength = 0;
|
||||||
|
break;
|
||||||
|
case FDCAN_DLC_BYTES_1: DataLength = 1;
|
||||||
|
break;
|
||||||
|
case FDCAN_DLC_BYTES_2: DataLength = 2;
|
||||||
|
break;
|
||||||
|
case FDCAN_DLC_BYTES_3: DataLength = 3;
|
||||||
|
break;
|
||||||
|
case FDCAN_DLC_BYTES_4: DataLength = 4;
|
||||||
|
break;
|
||||||
|
case FDCAN_DLC_BYTES_5: DataLength = 5;
|
||||||
|
break;
|
||||||
|
case FDCAN_DLC_BYTES_6: DataLength = 6;
|
||||||
|
break;
|
||||||
|
case FDCAN_DLC_BYTES_7: DataLength = 7;
|
||||||
|
break;
|
||||||
|
case FDCAN_DLC_BYTES_8: DataLength = 8;
|
||||||
|
break;
|
||||||
|
// 如果后续用到了 FDCAN 真正的长帧(12~64字节),可以在这里继续加 case
|
||||||
|
default: DataLength = 8;
|
||||||
|
break; // 兜底保护
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rxconf.RxFrameType == FDCAN_DATA_FRAME && rxconf.IdType == FDCAN_STANDARD_ID)
|
||||||
|
{
|
||||||
|
for (size_t i = 0; i < idx; ++i)
|
||||||
|
{
|
||||||
|
if (_hfdcan == fdcan_instance[i]->can_handle && rxconf.Identifier == fdcan_instance[i]->rx_id)
|
||||||
|
{
|
||||||
|
if (fdcan_instance[i]->can_module_callback != NULL)
|
||||||
|
{
|
||||||
|
fdcan_instance[i]->rx_len = DataLength;
|
||||||
|
memcpy(fdcan_instance[i]->rx_buff, fdcan_rx_buff, fdcan_instance[i]->rx_len);
|
||||||
|
fdcan_instance[i]->can_module_callback(fdcan_instance[i]);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void HAL_FDCAN_RxFifo0Callback(FDCAN_HandleTypeDef *hfdcan, uint32_t RxFifo0ITs)
|
||||||
|
{
|
||||||
|
/* 检查Rx FIFO 0中是否有消息丢失 */
|
||||||
|
if ((RxFifo0ITs & FDCAN_IT_RX_FIFO0_MESSAGE_LOST) != 0)
|
||||||
|
{
|
||||||
|
//报错
|
||||||
|
}
|
||||||
|
/* 检查是否有新消息写入Rx FIFO 0或到达一定阈值 */
|
||||||
|
if ((RxFifo0ITs & FDCAN_IT_RX_FIFO0_NEW_MESSAGE) || (RxFifo0ITs & FDCAN_IT_RX_FIFO0_FULL) || (
|
||||||
|
RxFifo0ITs & FDCAN_IT_RX_FIFO0_WATERMARK))
|
||||||
|
{
|
||||||
|
FDCANFIFOxCallback(hfdcan, FDCAN_RX_FIFO0); // 调用我们自己写的函数来处理消息
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void HAL_FDCAN_RxFifo1Callback(FDCAN_HandleTypeDef *hfdcan, uint32_t RxFifo1ITs)
|
||||||
|
{
|
||||||
|
/* 检查Rx FIFO 1中是否有消息丢失 */
|
||||||
|
if ((RxFifo1ITs & FDCAN_IT_RX_FIFO1_MESSAGE_LOST) != 0)
|
||||||
|
{
|
||||||
|
//报错
|
||||||
|
}
|
||||||
|
/* 检查是否有新消息写入Rx FIFO 1或到达一定阈值 */
|
||||||
|
if ((RxFifo1ITs & FDCAN_IT_RX_FIFO1_NEW_MESSAGE) || (RxFifo1ITs & FDCAN_IT_RX_FIFO1_FULL) || (
|
||||||
|
RxFifo1ITs & FDCAN_IT_RX_FIFO1_WATERMARK))
|
||||||
|
{
|
||||||
|
FDCANFIFOxCallback(hfdcan, FDCAN_RX_FIFO1); // 调用我们自己写的函数来处理消息
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 此函数会被下面两个函数调用,用于处理FIFO0和FIFO1溢出中断(说明收到了新的数据)
|
||||||
|
* 所有的实例都会被遍历,找到can_handle和rx_id相等的实例时,调用该实例的回调函数
|
||||||
|
*
|
||||||
|
* @param _hcan
|
||||||
|
* @param fifox passed to HAL_CAN_GetRxMessage() to get mesg from a specific fifo
|
||||||
|
*/
|
||||||
|
static void CANFIFOxCallback(CAN_HandleTypeDef *_hcan, uint32_t fifox)
|
||||||
|
{
|
||||||
|
static CAN_RxHeaderTypeDef rxconf; // 同上
|
||||||
|
uint8_t can_rx_buff[8];
|
||||||
|
while (HAL_CAN_GetRxFifoFillLevel(_hcan, fifox)) // FIFO不为空,有可能在其他中断时有多帧数据进入
|
||||||
|
{
|
||||||
|
HAL_CAN_GetRxMessage(_hcan, fifox, &rxconf, can_rx_buff); // 从FIFO中获取数据
|
||||||
|
for (size_t i = 0; i < idx; ++i)
|
||||||
|
{
|
||||||
|
// 两者相等说明这是要找的实例
|
||||||
|
if (_hcan == fdcan_instance[i]->can_handle && rxconf.StdId == fdcan_instance[i]->rx_id)
|
||||||
|
{
|
||||||
|
if (fdcan_instance[i]->can_module_callback != NULL) // 回调函数不为空就调用
|
||||||
|
{
|
||||||
|
fdcan_instance[i]->rx_len = rxconf.DLC; // 保存接收到的数据长度
|
||||||
|
memcpy(fdcan_instance[i]->rx_buff, can_rx_buff, rxconf.DLC); // 消息拷贝到对应实例
|
||||||
|
fdcan_instance[i]->can_module_callback(fdcan_instance[i]); // 触发回调进行数据解析和处理
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 注意,STM32的两个CAN设备共享两个FIFO
|
||||||
|
* 下面两个函数是HAL库中的回调函数,他们被HAL声明为__weak,这里对他们进行重载(重写)
|
||||||
|
* 当FIFO0或FIFO1溢出时会调用这两个函数
|
||||||
|
*/
|
||||||
|
// 下面的函数会调用CANFIFOxCallback()来进一步处理来自特定CAN设备的消息
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief rx fifo callback. Once FIFO_0 is full,this func would be called
|
||||||
|
*
|
||||||
|
* @param hcan CAN handle indicate which device the oddest mesg in FIFO_0 comes from
|
||||||
|
*/
|
||||||
|
void HAL_CAN_RxFifo0MsgPendingCallback(CAN_HandleTypeDef *hcan)
|
||||||
|
{
|
||||||
|
CANFIFOxCallback(hcan, CAN_RX_FIFO0); // 调用我们自己写的函数来处理消息
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief rx fifo callback. Once FIFO_1 is full,this func would be called
|
||||||
|
*
|
||||||
|
* @param hcan CAN handle indicate which device the oddest mesg in FIFO_1 comes from
|
||||||
|
*/
|
||||||
|
void HAL_CAN_RxFifo1MsgPendingCallback(CAN_HandleTypeDef *hcan)
|
||||||
|
{
|
||||||
|
CANFIFOxCallback(hcan, CAN_RX_FIFO1); // 调用我们自己写的函数来处理消息
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
114
User_Code/bsp/fdcan/bsp_fdcan.h
Normal file
114
User_Code/bsp/fdcan/bsp_fdcan.h
Normal file
@@ -0,0 +1,114 @@
|
|||||||
|
#ifndef BSP_FDCAN_H
|
||||||
|
#define BSP_FDCAN_H
|
||||||
|
|
||||||
|
//在此选择CAN类型,两者只能选择一个!!!
|
||||||
|
#define FDCAN //G系列和H7系列使用FDCAN
|
||||||
|
//#define BXCAN //F系列使用BxCAN
|
||||||
|
|
||||||
|
//CAN类型宏定义检查,有错误停止编译
|
||||||
|
#if !defined(FDCAN) && !defined(BXCAN)
|
||||||
|
#error "Neither FDCAN nor BXCAN is defined. Please define one of them."
|
||||||
|
#elif defined(FDCAN) && defined(BXCAN)
|
||||||
|
#error "Both FDCAN and BXCAN are defined. Please define only one."
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#ifdef FDCAN
|
||||||
|
#include "fdcan.h"
|
||||||
|
#define hcan1 hfdcan1
|
||||||
|
#define hcan2 hfdcan2
|
||||||
|
#define hcan3 hfdcan3
|
||||||
|
|
||||||
|
#define CAN_MX_REGISTER_CNT 16 // 这个数量取决于CAN总线的负载
|
||||||
|
#define MX_CAN_FILTER_CNT (3 * 14) // 最多可以使用的CAN过滤器数量,目前远不会用到这么多
|
||||||
|
#define DEVICE_CAN_CNT 3 //H723VG有3个FDCAN
|
||||||
|
|
||||||
|
#endif
|
||||||
|
#ifdef BXCAN
|
||||||
|
#include "can.h"
|
||||||
|
// 最多能够支持的CAN设备数
|
||||||
|
#define CAN_MX_REGISTER_CNT 16 // 这个数量取决于CAN总线的负载
|
||||||
|
#define MX_CAN_FILTER_CNT (2 * 14) // 最多可以使用的CAN过滤器数量,目前远不会用到这么多
|
||||||
|
#define DEVICE_CAN_CNT 2 // 根据板子设定,F407IG有CAN1,CAN2,因此为2;F334只有一个,则设为1
|
||||||
|
// 如果只有1个CAN,还需要把bsp_can.c中所有的hcan2变量改为hcan1(别担心,主要是总线和FIFO的负载均衡,不影响功能)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// 定义查找表
|
||||||
|
static const uint32_t DLC_LookUp_Table[9] = {
|
||||||
|
FDCAN_DLC_BYTES_0,
|
||||||
|
FDCAN_DLC_BYTES_1,
|
||||||
|
FDCAN_DLC_BYTES_2,
|
||||||
|
FDCAN_DLC_BYTES_3,
|
||||||
|
FDCAN_DLC_BYTES_4,
|
||||||
|
FDCAN_DLC_BYTES_5,
|
||||||
|
FDCAN_DLC_BYTES_6,
|
||||||
|
FDCAN_DLC_BYTES_7,
|
||||||
|
FDCAN_DLC_BYTES_8
|
||||||
|
};
|
||||||
|
|
||||||
|
/* can instance typedef, every module registered to CAN should have this variable */
|
||||||
|
#pragma pack(1)
|
||||||
|
typedef struct _
|
||||||
|
{
|
||||||
|
#ifdef FDCAN
|
||||||
|
FDCAN_HandleTypeDef *can_handle; // can句柄
|
||||||
|
FDCAN_TxHeaderTypeDef txconf; // CAN报文发送配置
|
||||||
|
#else
|
||||||
|
CAN_HandleTypeDef *can_handle; // can句柄
|
||||||
|
CAN_TxHeaderTypeDef txconf; // CAN报文发送配置
|
||||||
|
#endif
|
||||||
|
uint32_t tx_id; // 发送id
|
||||||
|
uint32_t tx_mailbox; // CAN消息填入的邮箱号
|
||||||
|
uint8_t tx_buff[8]; // 发送缓存,发送消息长度可以通过CANSetDLC()设定,最大为8
|
||||||
|
uint8_t rx_buff[8]; // 接收缓存,最大消息长度为8
|
||||||
|
uint32_t rx_id; // 接收id
|
||||||
|
uint8_t rx_len; // 接收长度,可能为0-8
|
||||||
|
// 接收的回调函数,用于解析接收到的数据
|
||||||
|
void (*can_module_callback)(struct _ *); // callback needs an instance to tell among registered ones
|
||||||
|
void *id; // 使用can外设的模块指针(即id指向的模块拥有此can实例,是父子关系)
|
||||||
|
} FDCANInstance;
|
||||||
|
#pragma pack()
|
||||||
|
|
||||||
|
/* CAN实例初始化结构体,将此结构体指针传入注册函数 */
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
#ifdef FDCAN
|
||||||
|
FDCAN_HandleTypeDef *can_handle; // can句柄
|
||||||
|
#else
|
||||||
|
CAN_HandleTypeDef *can_handle; // can句柄
|
||||||
|
#endif
|
||||||
|
uint32_t tx_id; // 发送id
|
||||||
|
uint32_t rx_id; // 接收id
|
||||||
|
void (*can_module_callback)(FDCANInstance *); // 处理接收数据的回调函数
|
||||||
|
void *id; // 拥有can实例的模块地址,用于区分不同的模块(如果有需要的话),如果不需要可以不传入
|
||||||
|
} FDCAN_Init_Config_s;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Register a module to CAN service,remember to call this before using a CAN device
|
||||||
|
* 注册(初始化)一个can实例,需要传入初始化配置的指针.
|
||||||
|
* @param config init config
|
||||||
|
* @return CANInstance* can instance owned by module
|
||||||
|
*/
|
||||||
|
FDCANInstance *CANRegister(FDCAN_Init_Config_s *config);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 修改CAN发送报文的数据帧长度;注意最大长度为8,在没有进行修改的时候,默认长度为8
|
||||||
|
*
|
||||||
|
* @param _instance 要修改长度的can实例
|
||||||
|
* @param length 设定长度
|
||||||
|
*/
|
||||||
|
void CANSetDLC(FDCANInstance *_instance, uint8_t length);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief transmit mesg through CAN device,通过can实例发送消息
|
||||||
|
* 发送前需要向CAN实例的tx_buff写入发送数据
|
||||||
|
*
|
||||||
|
* @attention 超时时间不应该超过调用此函数的任务的周期,否则会导致任务阻塞
|
||||||
|
*
|
||||||
|
* @param timeout 超时时间,单位为ms;后续改为us,获得更精确的控制
|
||||||
|
* @param _instance* can instance owned by module
|
||||||
|
*/
|
||||||
|
uint8_t CANTransmit(FDCANInstance *_instance,float timeout);
|
||||||
|
|
||||||
|
#endif
|
||||||
168
User_Code/bsp/fdcan/bsp_fdcan.md
Normal file
168
User_Code/bsp/fdcan/bsp_fdcan.md
Normal file
@@ -0,0 +1,168 @@
|
|||||||
|
# bsp_fdcan.c/bsp_fdcan.h
|
||||||
|
|
||||||
|
> 请注意使用FDCAN设备的时候务必保证总线只接入了2个终端电阻!开发板一般都有一个,6020电机、c620/c610电调、LK电机也都有终端电阻,注意把多于2个的全部断开(通过拨码)
|
||||||
|
|
||||||
|
## 使用说明
|
||||||
|
|
||||||
|
若你希望新增一个基于FDCAN的module,首先在该模块下应该有一个包含`FDCANInstance`指针的module结构体(或当功能简单的时候,可以是单独存在的
|
||||||
|
`FDCANInstance`,但不推荐这样做)。
|
||||||
|
|
||||||
|
## 代码结构
|
||||||
|
|
||||||
|
.h文件内包括了外部接口和类型定义,以及模块对应的宏。c文件内为私有函数和外部接口的定义。
|
||||||
|
|
||||||
|
## 类型定义
|
||||||
|
|
||||||
|
```c
|
||||||
|
#define CAN_MX_REGISTER_CNT 16 // 最大FDCAN设备注册数量
|
||||||
|
#define MX_CAN_FILTER_CNT (3 * 14) // 最多可以使用的CAN过滤器数量,支持3个CAN
|
||||||
|
#define DEVICE_CAN_CNT 3 // FDCAN1, FDCAN2, FDCAN3
|
||||||
|
|
||||||
|
#define CAN_CLASS 0 // 经典CAN模式
|
||||||
|
#define CAN_FD_BRS 1 // CAN FD模式
|
||||||
|
|
||||||
|
#define CAN_BR_125K 0 // 125Kbps
|
||||||
|
#define CAN_BR_200K 1 // 200Kbps
|
||||||
|
#define CAN_BR_250K 2 // 250Kbps
|
||||||
|
#define CAN_BR_500K 3 // 500Kbps
|
||||||
|
#define CAN_BR_1M 4 // 1Mbps
|
||||||
|
#define CAN_BR_2M 5 // 2Mbps
|
||||||
|
#define CAN_BR_2M5 6 // 2.5Mbps
|
||||||
|
#define CAN_BR_3M2 7 // 3.2Mbps
|
||||||
|
#define CAN_BR_4M 8 // 4Mbps
|
||||||
|
#define CAN_BR_5M 9 // 5Mbps
|
||||||
|
|
||||||
|
/* FDCAN实例结构体,每个注册到FDCAN的模块都应该有这个变量 */
|
||||||
|
typedef struct _FDCANInstance
|
||||||
|
{
|
||||||
|
FDCAN_HandleTypeDef *can_handle; // FDCAN句柄
|
||||||
|
FDCAN_TxHeaderTypeDef txconf; // FDCAN报文发送配置
|
||||||
|
uint32_t tx_id; // 发送id
|
||||||
|
uint32_t tx_mailbox; // FDCAN消息填入的邮箱号
|
||||||
|
uint8_t tx_buff[64]; // 发送缓存,FDCAN最大支持64字节
|
||||||
|
uint8_t rx_buff[64]; // 接收缓存,FDCAN最大支持64字节
|
||||||
|
uint32_t rx_id; // 接收id
|
||||||
|
uint8_t rx_len; // 接收长度
|
||||||
|
// 接收的回调函数,用于解析接收到的数据
|
||||||
|
void (*can_module_callback)(struct _FDCANInstance *); // 回调函数需要实例来区分注册的设备
|
||||||
|
void *id; // 使用FDCAN外设的模块指针
|
||||||
|
} FDCANInstance;
|
||||||
|
|
||||||
|
/* FDCAN实例初始化结构体 */
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
FDCAN_HandleTypeDef *can_handle; // FDCAN句柄
|
||||||
|
uint32_t tx_id; // 发送id
|
||||||
|
uint32_t rx_id; // 接收id
|
||||||
|
void (*can_module_callback)(FDCANInstance *); // 处理接收数据的回调函数
|
||||||
|
void *id; // 拥有FDCAN实例的模块地址
|
||||||
|
} FDCAN_Init_Config_s;
|
||||||
|
|
||||||
|
typedef void (*fdcan_callback)(FDCANInstance *);
|
||||||
|
```
|
||||||
|
|
||||||
|
- `CAN_MX_REGISTER_CNT`是最大的FDCAN设备注册数量,当每个设备的发送频率都较高时,设备过多会产生总线拥塞从而出现丢包和数据错误的情况。
|
||||||
|
- `MX_CAN_FILTER_CNT`是最大的FDCAN接收过滤器数量,三个FDCAN共享多个过滤器。当前为简单起见,每个过滤器只设置一组规则用于控制一个id的过滤。
|
||||||
|
- `DEVICE_CAN_CNT`是MCU拥有的FDCAN硬件数量(H7有3个)。
|
||||||
|
|
||||||
|
- `FDCANInstance`
|
||||||
|
是一个FDCAN实例。注意,FDCAN作为一个总线设备,一条总线上可以挂载多个设备,因此多个设备可以共享同一个FDCAN硬件。其成员变量包括发送id,发送邮箱,发送buff以及接收buff,还有接收id和接收协议解析回调函数。
|
||||||
|
**FDCAN支持最大64字节的数据帧**,因此收发buff长度设置为64字节。
|
||||||
|
|
||||||
|
- `FDCAN_Init_Config_s`是用于初始化FDCAN实例的结构,在调用FDCAN实例的初始化函数时传入。
|
||||||
|
|
||||||
|
- `can_module_callback()`是模块提供给FDCAN接收中断回调函数使用的协议解析函数指针。对于每个需要FDCAN的模块,需要定义一个这样的函数用于解包数据。
|
||||||
|
- 每个使用FDCAN外设的module,都需要在其内部定义一个`FDCANInstance*`。
|
||||||
|
|
||||||
|
## 外部接口
|
||||||
|
|
||||||
|
```c
|
||||||
|
FDCANInstance *FDCANRegister(FDCAN_Init_Config_s *config);
|
||||||
|
void FDCANSetDLC(FDCANInstance *_instance, uint8_t length);
|
||||||
|
uint8_t FDCANTransmit(FDCANInstance *_instance, float timeout);
|
||||||
|
void bsp_fdcan_set_baud(FDCAN_HandleTypeDef *hfdcan, uint8_t mode, uint8_t baud);
|
||||||
|
```
|
||||||
|
|
||||||
|
`FDCANRegister`是用于初始化FDCAN实例的接口,module层的模块对象(也应当为一个结构体)内要包含一个`FDCANInstance`
|
||||||
|
。调用时传入初始化配置的指针。`FDCANRegister`应当在module的初始化函数内被调用,推荐config采用以下的方式定义,更加直观明了:
|
||||||
|
|
||||||
|
```c
|
||||||
|
FDCAN_Init_Config_s config = {
|
||||||
|
.can_handle = &hfdcan1,
|
||||||
|
.tx_id = 0x005,
|
||||||
|
.rx_id = 0x200,
|
||||||
|
.can_module_callback = MotorCallback,
|
||||||
|
.id = (void*)motor_ptr
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
`FDCANTransmit()`是通过模块通过其拥有的FDCAN实例发送数据的接口,调用时传入对应的instance。在发送之前,应当给instance内的
|
||||||
|
`tx_buff`赋值。
|
||||||
|
|
||||||
|
`bsp_fdcan_set_baud()`用于设置FDCAN的波特率和模式(经典CAN或CAN FD)。
|
||||||
|
|
||||||
|
## 私有函数和变量
|
||||||
|
|
||||||
|
在.c文件内设为static的函数和变量
|
||||||
|
|
||||||
|
```c
|
||||||
|
static FDCANInstance *fdcan_instance[CAN_MX_REGISTER_CNT] = {NULL};
|
||||||
|
```
|
||||||
|
|
||||||
|
这是bsp层管理所有FDCAN实例的入口。
|
||||||
|
|
||||||
|
```c
|
||||||
|
static void FDCANServiceInit()
|
||||||
|
static void FDCANAddFilter(FDCANInstance *_instance)
|
||||||
|
static void FDCANFIFOxCallback(FDCAN_HandleTypeDef *_hcan, uint32_t fifox)
|
||||||
|
static uint8_t FDCANDlcToLen(uint32_t dlc)
|
||||||
|
static uint32_t FDCANLenToDlc(uint8_t len)
|
||||||
|
void HAL_FDCAN_RxFifo0Callback(FDCAN_HandleTypeDef *hfdcan, uint32_t RxFifo0ITs)
|
||||||
|
void HAL_FDCAN_RxFifo1Callback(FDCAN_HandleTypeDef *hfdcan, uint32_t RxFifo1ITs)
|
||||||
|
void HAL_FDCAN_ErrorStatusCallback(FDCAN_HandleTypeDef *hfdcan, uint32_t ErrorStatusITs)
|
||||||
|
```
|
||||||
|
|
||||||
|
- `FDCANServiceInit()`会被`FDCANRegister()`调用,对FDCAN外设进行硬件初始化并开启接收中断和消息提醒。
|
||||||
|
|
||||||
|
- `FDCANAddFilter()`在每次使用`FDCANRegister()`的时候被调用,用于给当前注册的实例添加过滤器规则并设定处理对应`rx_id`
|
||||||
|
的接收FIFO。过滤器的作用是减小FDCAN收发器的压力,只接收符合过滤器规则的报文(否则不会产生接收中断)。
|
||||||
|
|
||||||
|
- `FDCANDlcToLen()`和`FDCANLenToDlc()`是FDCAN特有的数据长度码转换函数,用于在数据长度码和实际字节数之间转换。
|
||||||
|
|
||||||
|
- `HAL_FDCAN_RxFifo0Callback()`和`HAL_FDCAN_RxFifo1Callback()`都是对HAL的FDCAN回调函数的重定义(原本的callback是`__weak`
|
||||||
|
修饰的弱定义),当发生FIFO0或FIFO1有新消息到达的时候,对应的callback会被调用。`FDCANFIFOxCallback()`
|
||||||
|
随后被前两者调用,并根据接收id和硬件中断来源(哪一个FDCAN硬件)调用对应的instance的回调函数进行协议解析。
|
||||||
|
|
||||||
|
- `HAL_FDCAN_ErrorStatusCallback()`处理FDCAN的错误状态,包括总线关闭和错误被动状态的恢复。
|
||||||
|
|
||||||
|
- 当有一个模块注册了多个FDCAN实例时,通过`FDCANInstance.id`,使用强制类型转换将其转换成对应模块的实例指针,就可以对不同的模块实例进行回调处理了。
|
||||||
|
|
||||||
|
## 弱定义回调函数
|
||||||
|
|
||||||
|
```c
|
||||||
|
__weak void fdcan1_rx_callback(void);
|
||||||
|
__weak void fdcan2_rx_callback(void);
|
||||||
|
__weak void fdcan3_rx_callback(void);
|
||||||
|
```
|
||||||
|
|
||||||
|
这些是弱定义的FDCAN接收回调函数,用户可以根据需要重写这些函数来实现特定的功能。
|
||||||
|
|
||||||
|
## 注意事项
|
||||||
|
|
||||||
|
1. **终端电阻**:使用FDCAN设备时务必保证总线只接入了2个终端电阻!
|
||||||
|
|
||||||
|
2. **FDCAN特性**:
|
||||||
|
- FDCAN支持经典CAN和CAN FD模式
|
||||||
|
- CAN FD模式下支持最高64字节的数据帧
|
||||||
|
- 支持更高的通信速率(最高5Mbps)
|
||||||
|
|
||||||
|
3. **发送超时**:由于FDCAN总线自带发送检测,如果总线上没有挂载目标设备,那么发送FIFO会被占满而无法发送。在`FDCANTransmit()`
|
||||||
|
中会对发送FIFO是否已满进行检查。当超出`timeout`之后函数会返回零,说明发送失败。
|
||||||
|
|
||||||
|
4. **任务阻塞**:由于卡在`while(1)`处不断检查FIFO是否空闲,调用`FDCANTransmit()`
|
||||||
|
的任务可能无法按时挂起,导致任务定时不精确。建议在没有连接FDCAN进行调试时,按需注释掉有关FDCAN发送的代码部分,或设定一个较小的
|
||||||
|
`timeout`值,防止对其他需要精确定时的任务产生影响。
|
||||||
|
|
||||||
|
5. **模式选择**:使用`bsp_fdcan_set_baud()`函数可以在经典CAN模式和CAN FD模式之间切换,注意不同模式支持的波特率范围不同。
|
||||||
|
|
||||||
|
6. **数据长度**:FDCAN支持最大64字节的数据帧,使用`FDCANSetDLC()`函数设置数据长度时要注意不要超过64字节。
|
||||||
268
User_Code/bsp/flash/bsp_flash.c
Normal file
268
User_Code/bsp/flash/bsp_flash.c
Normal file
@@ -0,0 +1,268 @@
|
|||||||
|
#include "bsp_flash.h"
|
||||||
|
#include "main.h"
|
||||||
|
#include "string.h"
|
||||||
|
|
||||||
|
static uint32_t ger_sector(uint32_t address);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief erase flash
|
||||||
|
* @param[in] address: flash address
|
||||||
|
* @param[in] len: page num
|
||||||
|
* @retval none
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* @brief 擦除flash
|
||||||
|
* @param[in] address: flash 地址
|
||||||
|
* @param[in] len: 页数量
|
||||||
|
* @retval none
|
||||||
|
*/
|
||||||
|
void flash_erase_address(uint32_t address, uint16_t len)
|
||||||
|
{
|
||||||
|
FLASH_EraseInitTypeDef flash_erase;
|
||||||
|
uint32_t error;
|
||||||
|
|
||||||
|
flash_erase.Sector = ger_sector(address);
|
||||||
|
flash_erase.TypeErase = FLASH_TYPEERASE_SECTORS;
|
||||||
|
flash_erase.VoltageRange = FLASH_VOLTAGE_RANGE_3;
|
||||||
|
flash_erase.NbSectors = len;
|
||||||
|
|
||||||
|
HAL_FLASH_Unlock();
|
||||||
|
HAL_FLASHEx_Erase(&flash_erase, &error);
|
||||||
|
HAL_FLASH_Lock();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief write data to one page of flash
|
||||||
|
* @param[in] start_address: flash address
|
||||||
|
* @param[in] buf: data point
|
||||||
|
* @param[in] len: data num
|
||||||
|
* @retval success 0, fail -1
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* @brief 往一页flash写数据
|
||||||
|
* @param[in] start_address: flash 地址
|
||||||
|
* @param[in] buf: 数据指针
|
||||||
|
* @param[in] len: 数据长度
|
||||||
|
* @retval success 0, fail -1
|
||||||
|
*/
|
||||||
|
int8_t flash_write_single_address(uint32_t start_address, uint32_t *buf, uint32_t len)
|
||||||
|
{
|
||||||
|
static uint32_t uw_address;
|
||||||
|
static uint32_t end_address;
|
||||||
|
static uint32_t *data_buf;
|
||||||
|
static uint32_t data_len;
|
||||||
|
|
||||||
|
HAL_FLASH_Unlock();
|
||||||
|
|
||||||
|
uw_address = start_address;
|
||||||
|
end_address = get_next_flash_address(start_address);
|
||||||
|
data_buf = buf;
|
||||||
|
data_len = 0;
|
||||||
|
|
||||||
|
while (uw_address <= end_address)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (HAL_FLASH_Program(FLASH_TYPEPROGRAM_FLASHWORD, uw_address, *data_buf) == HAL_OK)
|
||||||
|
{
|
||||||
|
uw_address += 4;
|
||||||
|
data_buf++;
|
||||||
|
data_len++;
|
||||||
|
if (data_len == len)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
HAL_FLASH_Lock();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
HAL_FLASH_Lock();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief write data to some pages of flash
|
||||||
|
* @param[in] start_address: flash start address
|
||||||
|
* @param[in] end_address: flash end address
|
||||||
|
* @param[in] buf: data point
|
||||||
|
* @param[in] len: data num
|
||||||
|
* @retval success 0, fail -1
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* @brief 往几页flash写数据
|
||||||
|
* @param[in] start_address: flash 开始地址
|
||||||
|
* @param[in] end_address: flash 结束地址
|
||||||
|
* @param[in] buf: 数据指针
|
||||||
|
* @param[in] len: 数据长度
|
||||||
|
* @retval success 0, fail -1
|
||||||
|
*/
|
||||||
|
int8_t flash_write_muli_address(uint32_t start_address, uint32_t end_address, uint32_t *buf, uint32_t len)
|
||||||
|
{
|
||||||
|
uint32_t uw_address = 0;
|
||||||
|
uint32_t *data_buf;
|
||||||
|
uint32_t data_len;
|
||||||
|
|
||||||
|
HAL_FLASH_Unlock();
|
||||||
|
|
||||||
|
uw_address = start_address;
|
||||||
|
data_buf = buf;
|
||||||
|
data_len = 0;
|
||||||
|
while (uw_address <= end_address)
|
||||||
|
{
|
||||||
|
if (HAL_FLASH_Program(FLASH_TYPEPROGRAM_FLASHWORD, uw_address, *data_buf) == HAL_OK)
|
||||||
|
{
|
||||||
|
uw_address += 4;
|
||||||
|
data_buf++;
|
||||||
|
data_len++;
|
||||||
|
if (data_len == len)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
HAL_FLASH_Lock();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
HAL_FLASH_Lock();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief read data for flash
|
||||||
|
* @param[in] address: flash address
|
||||||
|
* @param[out] buf: data point
|
||||||
|
* @param[in] len: data num
|
||||||
|
* @retval none
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* @brief 从flash读数据
|
||||||
|
* @param[in] start_address: flash 地址
|
||||||
|
* @param[out] buf: 数据指针
|
||||||
|
* @param[in] len: 数据长度
|
||||||
|
* @retval none
|
||||||
|
*/
|
||||||
|
void flash_read(uint32_t address, uint32_t *buf, uint32_t len)
|
||||||
|
{
|
||||||
|
memcpy(buf, (void *) address, len * 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief get the sector number of flash
|
||||||
|
* @param[in] address: flash address
|
||||||
|
* @retval sector number
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* @brief 获取flash的sector号
|
||||||
|
* @param[in] address: flash 地址
|
||||||
|
* @retval sector号
|
||||||
|
*/
|
||||||
|
static uint32_t ger_sector(uint32_t address)
|
||||||
|
{
|
||||||
|
uint32_t sector = 0;
|
||||||
|
if ((address < ADDR_FLASH_SECTOR_1) && (address >= ADDR_FLASH_SECTOR_0))
|
||||||
|
{
|
||||||
|
sector = FLASH_SECTOR_0;
|
||||||
|
}
|
||||||
|
else if ((address < ADDR_FLASH_SECTOR_2) && (address >= ADDR_FLASH_SECTOR_1))
|
||||||
|
{
|
||||||
|
sector = FLASH_SECTOR_1;
|
||||||
|
}
|
||||||
|
else if ((address < ADDR_FLASH_SECTOR_3) && (address >= ADDR_FLASH_SECTOR_2))
|
||||||
|
{
|
||||||
|
sector = FLASH_SECTOR_2;
|
||||||
|
}
|
||||||
|
else if ((address < ADDR_FLASH_SECTOR_4) && (address >= ADDR_FLASH_SECTOR_3))
|
||||||
|
{
|
||||||
|
sector = FLASH_SECTOR_3;
|
||||||
|
}
|
||||||
|
else if ((address < ADDR_FLASH_SECTOR_5) && (address >= ADDR_FLASH_SECTOR_4))
|
||||||
|
{
|
||||||
|
sector = FLASH_SECTOR_4;
|
||||||
|
}
|
||||||
|
else if ((address < ADDR_FLASH_SECTOR_6) && (address >= ADDR_FLASH_SECTOR_5))
|
||||||
|
{
|
||||||
|
sector = FLASH_SECTOR_5;
|
||||||
|
}
|
||||||
|
else if ((address < ADDR_FLASH_SECTOR_7) && (address >= ADDR_FLASH_SECTOR_6))
|
||||||
|
{
|
||||||
|
sector = FLASH_SECTOR_6;
|
||||||
|
}
|
||||||
|
else if ((address < ADDR_FLASH_SECTOR_8) && (address >= ADDR_FLASH_SECTOR_7))
|
||||||
|
{
|
||||||
|
sector = FLASH_SECTOR_7;
|
||||||
|
}
|
||||||
|
return sector;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief get the next page flash address
|
||||||
|
* @param[in] address: flash address
|
||||||
|
* @retval next page flash address
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* @brief 获取下一页flash地址
|
||||||
|
* @param[in] address: flash 地址
|
||||||
|
* @retval 下一页flash地址
|
||||||
|
*/
|
||||||
|
uint32_t get_next_flash_address(uint32_t address)
|
||||||
|
{
|
||||||
|
uint32_t sector = 0;
|
||||||
|
|
||||||
|
if ((address < ADDR_FLASH_SECTOR_1) && (address >= ADDR_FLASH_SECTOR_0))
|
||||||
|
{
|
||||||
|
sector = ADDR_FLASH_SECTOR_1;
|
||||||
|
}
|
||||||
|
else if ((address < ADDR_FLASH_SECTOR_2) && (address >= ADDR_FLASH_SECTOR_1))
|
||||||
|
{
|
||||||
|
sector = ADDR_FLASH_SECTOR_2;
|
||||||
|
}
|
||||||
|
else if ((address < ADDR_FLASH_SECTOR_3) && (address >= ADDR_FLASH_SECTOR_2))
|
||||||
|
{
|
||||||
|
sector = ADDR_FLASH_SECTOR_3;
|
||||||
|
}
|
||||||
|
else if ((address < ADDR_FLASH_SECTOR_4) && (address >= ADDR_FLASH_SECTOR_3))
|
||||||
|
{
|
||||||
|
sector = ADDR_FLASH_SECTOR_4;
|
||||||
|
}
|
||||||
|
else if ((address < ADDR_FLASH_SECTOR_5) && (address >= ADDR_FLASH_SECTOR_4))
|
||||||
|
{
|
||||||
|
sector = ADDR_FLASH_SECTOR_5;
|
||||||
|
}
|
||||||
|
else if ((address < ADDR_FLASH_SECTOR_6) && (address >= ADDR_FLASH_SECTOR_5))
|
||||||
|
{
|
||||||
|
sector = ADDR_FLASH_SECTOR_6;
|
||||||
|
}
|
||||||
|
else if ((address < ADDR_FLASH_SECTOR_7) && (address >= ADDR_FLASH_SECTOR_6))
|
||||||
|
{
|
||||||
|
sector = ADDR_FLASH_SECTOR_7;
|
||||||
|
}
|
||||||
|
else if ((address < ADDR_FLASH_SECTOR_8) && (address >= ADDR_FLASH_SECTOR_7))
|
||||||
|
{
|
||||||
|
sector = ADDR_FLASH_SECTOR_8;
|
||||||
|
}
|
||||||
|
else if ((address < ADDR_FLASH_SECTOR_9) && (address >= ADDR_FLASH_SECTOR_8))
|
||||||
|
{
|
||||||
|
sector = ADDR_FLASH_SECTOR_9;
|
||||||
|
}
|
||||||
|
else if ((address < ADDR_FLASH_SECTOR_10) && (address >= ADDR_FLASH_SECTOR_9))
|
||||||
|
{
|
||||||
|
sector = ADDR_FLASH_SECTOR_10;
|
||||||
|
}
|
||||||
|
else if ((address < ADDR_FLASH_SECTOR_11) && (address >= ADDR_FLASH_SECTOR_10))
|
||||||
|
{
|
||||||
|
sector = ADDR_FLASH_SECTOR_11;
|
||||||
|
}
|
||||||
|
else /*(address < FLASH_END_ADDR) && (address >= ADDR_FLASH_SECTOR_23))*/
|
||||||
|
{
|
||||||
|
sector = FLASH_END_ADDR;
|
||||||
|
}
|
||||||
|
return sector;
|
||||||
|
}
|
||||||
79
User_Code/bsp/flash/bsp_flash.h
Normal file
79
User_Code/bsp/flash/bsp_flash.h
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
#ifndef _BSP_FLASH_H
|
||||||
|
#define _BSP_FLASH_H
|
||||||
|
#include "main.h"
|
||||||
|
|
||||||
|
/* Base address of the Flash sectors */
|
||||||
|
#define ADDR_FLASH_SECTOR_0 ((uint32_t)0x08000000) /* Base address of Sector 0, 16 Kbytes */
|
||||||
|
#define ADDR_FLASH_SECTOR_1 ((uint32_t)0x08004000) /* Base address of Sector 1, 16 Kbytes */
|
||||||
|
#define ADDR_FLASH_SECTOR_2 ((uint32_t)0x08008000) /* Base address of Sector 2, 16 Kbytes */
|
||||||
|
#define ADDR_FLASH_SECTOR_3 ((uint32_t)0x0800C000) /* Base address of Sector 3, 16 Kbytes */
|
||||||
|
#define ADDR_FLASH_SECTOR_4 ((uint32_t)0x08010000) /* Base address of Sector 4, 64 Kbytes */
|
||||||
|
#define ADDR_FLASH_SECTOR_5 ((uint32_t)0x08020000) /* Base address of Sector 5, 128 Kbytes */
|
||||||
|
#define ADDR_FLASH_SECTOR_6 ((uint32_t)0x08040000) /* Base address of Sector 6, 128 Kbytes */
|
||||||
|
#define ADDR_FLASH_SECTOR_7 ((uint32_t)0x08060000) /* Base address of Sector 7, 128 Kbytes */
|
||||||
|
#define ADDR_FLASH_SECTOR_8 ((uint32_t)0x08080000) /* Base address of Sector 8, 128 Kbytes */
|
||||||
|
#define ADDR_FLASH_SECTOR_9 ((uint32_t)0x080A0000) /* Base address of Sector 9, 128 Kbytes */
|
||||||
|
#define ADDR_FLASH_SECTOR_10 ((uint32_t)0x080C0000) /* Base address of Sector 10, 128 Kbytes */
|
||||||
|
#define ADDR_FLASH_SECTOR_11 ((uint32_t)0x080E0000) /* Base address of Sector 11, 128 Kbytes */
|
||||||
|
|
||||||
|
#define FLASH_END_ADDR ((uint32_t)0x08100000) /* Base address of Sector 23, 128 Kbytes */
|
||||||
|
|
||||||
|
|
||||||
|
#define ADDR_FLASH_SECTOR_12 ((uint32_t)0x08100000) /* Base address of Sector 12, 16 Kbytes */
|
||||||
|
#define ADDR_FLASH_SECTOR_13 ((uint32_t)0x08104000) /* Base address of Sector 13, 16 Kbytes */
|
||||||
|
#define ADDR_FLASH_SECTOR_14 ((uint32_t)0x08108000) /* Base address of Sector 14, 16 Kbytes */
|
||||||
|
#define ADDR_FLASH_SECTOR_15 ((uint32_t)0x0810C000) /* Base address of Sector 15, 16 Kbytes */
|
||||||
|
#define ADDR_FLASH_SECTOR_16 ((uint32_t)0x08110000) /* Base address of Sector 16, 64 Kbytes */
|
||||||
|
#define ADDR_FLASH_SECTOR_17 ((uint32_t)0x08120000) /* Base address of Sector 17, 128 Kbytes */
|
||||||
|
#define ADDR_FLASH_SECTOR_18 ((uint32_t)0x08140000) /* Base address of Sector 18, 128 Kbytes */
|
||||||
|
#define ADDR_FLASH_SECTOR_19 ((uint32_t)0x08160000) /* Base address of Sector 19, 128 Kbytes */
|
||||||
|
#define ADDR_FLASH_SECTOR_20 ((uint32_t)0x08180000) /* Base address of Sector 20, 128 Kbytes */
|
||||||
|
#define ADDR_FLASH_SECTOR_21 ((uint32_t)0x081A0000) /* Base address of Sector 21, 128 Kbytes */
|
||||||
|
#define ADDR_FLASH_SECTOR_22 ((uint32_t)0x081C0000) /* Base address of Sector 22, 128 Kbytes */
|
||||||
|
#define ADDR_FLASH_SECTOR_23 ((uint32_t)0x081E0000) /* Base address of Sector 23, 128 Kbytes */
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief erase flash
|
||||||
|
* @param[in] address: flash address
|
||||||
|
* @param[in] len: page num
|
||||||
|
* @retval none
|
||||||
|
*/
|
||||||
|
void flash_erase_address(uint32_t address, uint16_t len);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief write data to one page of flash
|
||||||
|
* @param[in] start_address: flash address
|
||||||
|
* @param[in] buf: data point
|
||||||
|
* @param[in] len: data num
|
||||||
|
* @retval success 0, fail -1
|
||||||
|
*/
|
||||||
|
int8_t flash_write_single_address(uint32_t start_address, uint32_t *buf, uint32_t len);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief write data to some pages of flash
|
||||||
|
* @param[in] start_address: flash start address
|
||||||
|
* @param[in] end_address: flash end address
|
||||||
|
* @param[in] buf: data point
|
||||||
|
* @param[in] len: data num
|
||||||
|
* @retval success 0, fail -1
|
||||||
|
*/
|
||||||
|
int8_t flash_write_muli_address(uint32_t start_address, uint32_t end_address, uint32_t *buf, uint32_t len);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief read data for flash
|
||||||
|
* @param[in] address: flash address
|
||||||
|
* @param[out] buf: data point
|
||||||
|
* @param[in] len: data num
|
||||||
|
* @retval none
|
||||||
|
*/
|
||||||
|
void flash_read(uint32_t address, uint32_t *buf, uint32_t len);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief get the next page flash address
|
||||||
|
* @param[in] address: flash address
|
||||||
|
* @retval next page flash address
|
||||||
|
*/
|
||||||
|
uint32_t get_next_flash_address(uint32_t address);
|
||||||
|
#endif
|
||||||
0
User_Code/bsp/flash/bsp_flash.md
Normal file
0
User_Code/bsp/flash/bsp_flash.md
Normal file
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user