调压器io设置

This commit is contained in:
stark1898y 2024-12-02 17:03:41 +08:00
parent 8058ad615e
commit 9d0e953107
13 changed files with 457 additions and 82 deletions

38
.clang-format Normal file
View File

@ -0,0 +1,38 @@
---
BasedOnStyle: Microsoft
Language: Cpp
###################################
# indent conf
###################################
UseTab: Never
IndentWidth: 4
TabWidth: 4
ColumnLimit: 0
AccessModifierOffset: -4
NamespaceIndentation: All
FixNamespaceComments: false
BreakBeforeBraces: Allman
###################################
# other styles
###################################
#
# for more conf, you can ref: https://clang.llvm.org/docs/ClangFormatStyleOptions.html
#
AllowShortIfStatementsOnASingleLine: true
AllowShortLoopsOnASingleLine: true
AllowShortBlocksOnASingleLine: true
IndentCaseLabels: true
SortIncludes: false
AlignConsecutiveMacros: AcrossEmptyLines
AlignConsecutiveAssignments: Consecutive

View File

@ -14,7 +14,7 @@
</extensions> </extensions>
</storageModule> </storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0"> <storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.release" cleanCommand="${cross_rm} -rf" description="" id="ilg.gnumcueclipse.managedbuild.cross.riscv.config.elf.release.1008047074" name="obj" parent="ilg.gnumcueclipse.managedbuild.cross.riscv.config.elf.release"> <configuration artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.release" cleanCommand="${cross_rm} -rf" description="" id="ilg.gnumcueclipse.managedbuild.cross.riscv.config.elf.release.1008047074" name="obj" parent="ilg.gnumcueclipse.managedbuild.cross.riscv.config.elf.release" postbuildStep=" ${cross_prefix}${cross_objcopy}${cross_suffix} -O ihex &quot;${ProjName}.elf&quot; &quot;${ProjName}.hex&quot; &amp;&amp; ${cross_prefix}${cross_objcopy}${cross_suffix} -O binary &quot;${ProjName}.elf&quot; &quot;${ProjName}.bin&quot;">
<folderInfo id="ilg.gnumcueclipse.managedbuild.cross.riscv.config.elf.release.1008047074." name="/" resourcePath=""> <folderInfo id="ilg.gnumcueclipse.managedbuild.cross.riscv.config.elf.release.1008047074." name="/" resourcePath="">
<toolChain id="ilg.gnumcueclipse.managedbuild.cross.riscv.toolchain.elf.release.231146001" name="RISC-V Cross GCC" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.toolchain.elf.release"> <toolChain id="ilg.gnumcueclipse.managedbuild.cross.riscv.toolchain.elf.release.231146001" name="RISC-V Cross GCC" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.toolchain.elf.release">
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.addtools.createflash.1311852988" name="Create flash image" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.addtools.createflash" useByScannerDiscovery="false" value="true" valueType="boolean"/> <option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.addtools.createflash.1311852988" name="Create flash image" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.addtools.createflash" useByScannerDiscovery="false" value="true" valueType="boolean"/>
@ -47,7 +47,7 @@
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.isa.atomic.985553432" name="Atomic extension (RVA)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.isa.atomic" useByScannerDiscovery="false" value="true" valueType="boolean"/> <option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.isa.atomic.985553432" name="Atomic extension (RVA)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.isa.atomic" useByScannerDiscovery="false" value="true" valueType="boolean"/>
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.optimization.nocommon.1193890948" name="No common unitialized (-fno-common)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.optimization.nocommon" value="true" valueType="boolean"/> <option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.optimization.nocommon.1193890948" name="No common unitialized (-fno-common)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.optimization.nocommon" value="true" valueType="boolean"/>
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="ilg.gnumcueclipse.managedbuild.cross.riscv.targetPlatform.1944008784" isAbstract="false" osList="all" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.targetPlatform"/> <targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="ilg.gnumcueclipse.managedbuild.cross.riscv.targetPlatform.1944008784" isAbstract="false" osList="all" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.targetPlatform"/>
<builder buildPath="${workspace_loc:/BLE_TYQ_CH592F}/obj" id="ilg.gnumcueclipse.managedbuild.cross.riscv.builder.1421508906" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.builder"/> <builder buildPath="${workspace_loc:/BLE_TYQ_CH592F}/obj" id="ilg.gnumcueclipse.managedbuild.cross.riscv.builder.1421508906" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="GNU Make 构建器" parallelBuildOn="true" parallelizationNumber="optimal" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.builder"/>
<tool id="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.assembler.1244756189" name="GNU RISC-V Cross Assembler" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.assembler"> <tool id="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.assembler.1244756189" name="GNU RISC-V Cross Assembler" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.assembler">
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.assembler.usepreprocessor.1692176068" name="Use preprocessor" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.assembler.usepreprocessor" useByScannerDiscovery="false" value="true" valueType="boolean"/> <option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.assembler.usepreprocessor.1692176068" name="Use preprocessor" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.assembler.usepreprocessor" useByScannerDiscovery="false" value="true" valueType="boolean"/>
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="true" id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.assembler.include.paths.1034038285" name="Include paths (-I)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.assembler.include.paths" useByScannerDiscovery="true" valueType="includePath"/> <option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="true" id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.assembler.include.paths.1034038285" name="Include paths (-I)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.assembler.include.paths" useByScannerDiscovery="true" valueType="includePath"/>
@ -56,8 +56,8 @@
<tool id="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.c.compiler.1731377187" name="GNU RISC-V Cross C Compiler" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.c.compiler"> <tool id="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.c.compiler.1731377187" name="GNU RISC-V Cross C Compiler" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.c.compiler">
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.compiler.include.paths.1567947810" name="Include paths (-I)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.compiler.include.paths" useByScannerDiscovery="true" valueType="includePath"> <option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.compiler.include.paths.1567947810" name="Include paths (-I)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.compiler.include.paths" useByScannerDiscovery="true" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/Startup}&quot;"/> <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/Startup}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/APP/include}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/Profile/include}&quot;"/> <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/Profile/include}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/APP/include}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/StdPeriphDriver/inc}&quot;"/> <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/StdPeriphDriver/inc}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/HAL/include}&quot;"/> <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/HAL/include}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/Ld}&quot;"/> <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/Ld}&quot;"/>
@ -66,7 +66,8 @@
</option> </option>
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.compiler.std.2020844713" name="Language standard" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.compiler.std" useByScannerDiscovery="true" value="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.compiler.std.gnu99" valueType="enumerated"/> <option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.compiler.std.2020844713" name="Language standard" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.compiler.std" useByScannerDiscovery="true" value="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.compiler.std.gnu99" valueType="enumerated"/>
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.compiler.defs.177116515" name="Defined symbols (-D)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.compiler.defs" useByScannerDiscovery="true" valueType="definedSymbols"> <option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.compiler.defs.177116515" name="Defined symbols (-D)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.compiler.defs" useByScannerDiscovery="true" valueType="definedSymbols">
<listOptionValue builtIn="false" value="DEBUG=1"/> <listOptionValue builtIn="false" value="DEBUG=0"/>
<listOptionValue builtIn="false" value="CLK_OSC32K=0"/>
</option> </option>
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="true" id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.compiler.include.files.288896968" name="Include files (-include)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.compiler.include.files" useByScannerDiscovery="true" valueType="includeFiles"/> <option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="true" id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.compiler.include.files.288896968" name="Include files (-include)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.compiler.include.files" useByScannerDiscovery="true" valueType="includeFiles"/>
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.compiler.preprocessonly.1594987158" name="Preprocess only (-E)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.compiler.preprocessonly" useByScannerDiscovery="false" value="false" valueType="boolean"/> <option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.compiler.preprocessonly.1594987158" name="Preprocess only (-E)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.compiler.preprocessonly" useByScannerDiscovery="false" value="false" valueType="boolean"/>
@ -115,7 +116,9 @@
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.cpp.linker.usenewlibnano.1540675679" name="Use newlib-nano (--specs=nano.specs)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.cpp.linker.usenewlibnano" value="true" valueType="boolean"/> <option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.cpp.linker.usenewlibnano.1540675679" name="Use newlib-nano (--specs=nano.specs)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.cpp.linker.usenewlibnano" value="true" valueType="boolean"/>
</tool> </tool>
<tool id="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.archiver.1292785366" name="GNU RISC-V Cross Archiver" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.archiver"/> <tool id="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.archiver.1292785366" name="GNU RISC-V Cross Archiver" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.archiver"/>
<tool id="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.createflash.1801165667" name="GNU RISC-V Cross Create Flash Image" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.createflash"/> <tool id="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.createflash.1801165667" name="GNU RISC-V Cross Create Flash Image" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.createflash">
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.createflash.choice.777102436" name="Output file format (-O)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.createflash.choice" useByScannerDiscovery="false" value="ilg.gnumcueclipse.managedbuild.cross.riscv.option.createflash.choice.ihexAndbinary" valueType="enumerated"/>
</tool>
<tool id="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.createlisting.1356766765" name="GNU RISC-V Cross Create Listing" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.createlisting"> <tool id="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.createlisting.1356766765" name="GNU RISC-V Cross Create Listing" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.createlisting">
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.createlisting.source.2052761852" name="Display source (--source|-S)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.createlisting.source" useByScannerDiscovery="false" value="true" valueType="boolean"/> <option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.createlisting.source.2052761852" name="Display source (--source|-S)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.createlisting.source" useByScannerDiscovery="false" value="true" valueType="boolean"/>
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.createlisting.allheaders.439659821" name="Display all headers (--all-headers|-x)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.createlisting.allheaders" useByScannerDiscovery="false" value="true" valueType="boolean"/> <option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.createlisting.allheaders.439659821" name="Display all headers (--all-headers|-x)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.createlisting.allheaders" useByScannerDiscovery="false" value="true" valueType="boolean"/>
@ -139,7 +142,7 @@
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Profile"/> <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Profile"/>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="RVMSIS"/> <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="RVMSIS"/>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Startup"/> <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Startup"/>
<entry excluding="CH59x_pwm.c|CH59x_usbdev.c|CH59x_usbhostClass.c|CH59x_usbhostBase.c|CH59x_spi0.c|CH59x_timer0.c|CH59x_timer1.c|CH59x_timer2.c|CH59x_timer3.c|CH59x_uart0.c|CH59x_uart2.c|CH59x_uart3.c" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="StdPeriphDriver"/> <entry excluding="CH59x_pwm.c|CH59x_usbdev.c|CH59x_usbhostClass.c|CH59x_usbhostBase.c|CH59x_spi0.c|CH59x_timer0.c|CH59x_timer1.c|CH59x_timer2.c|CH59x_timer3.c|CH59x_uart2.c|CH59x_uart3.c" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="StdPeriphDriver"/>
</sourceEntries> </sourceEntries>
</configuration> </configuration>
</storageModule> </storageModule>
@ -161,5 +164,5 @@
</storageModule> </storageModule>
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/> <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/> <storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
<storageModule moduleId="refreshScope"/>
</cproject> </cproject>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" encoding="UTF-8"?>
<projectDescription> <projectDescription>
<name>BLE_TYQ_CH592F</name> <name>BLE_TYQ_CH592F</name>
<comment/> <comment></comment>
<projects> <projects>
</projects> </projects>
<buildSpec> <buildSpec>
@ -23,42 +23,10 @@
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature> <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature> <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
</natures> </natures>
<linkedResources>
<link>
<name>HAL</name>
<type>2</type>
<locationURI>PARENT-1-PROJECT_LOC/HAL</locationURI>
</link>
<link>
<name>LIB</name>
<type>2</type>
<locationURI>PARENT-1-PROJECT_LOC/LIB</locationURI>
</link>
<link>
<name>Ld</name>
<type>2</type>
<locationURI>PARENT-2-PROJECT_LOC/SRC/Ld</locationURI>
</link>
<link>
<name>RVMSIS</name>
<type>2</type>
<locationURI>PARENT-2-PROJECT_LOC/SRC/RVMSIS</locationURI>
</link>
<link>
<name>Startup</name>
<type>2</type>
<locationURI>PARENT-2-PROJECT_LOC/SRC/Startup</locationURI>
</link>
<link>
<name>StdPeriphDriver</name>
<type>2</type>
<locationURI>PARENT-2-PROJECT_LOC/SRC/StdPeriphDriver</locationURI>
</link>
</linkedResources>
<filteredResources> <filteredResources>
<filter> <filter>
<id>1602468250279</id> <id>1602468250279</id>
<name/> <name></name>
<type>22</type> <type>22</type>
<matcher> <matcher>
<id>org.eclipse.ui.ide.multiFilter</id> <id>org.eclipse.ui.ide.multiFilter</id>

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project>
<configuration id="ilg.gnumcueclipse.managedbuild.cross.riscv.config.elf.release.1008047074" name="obj">
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="-714121590444630656" id="ilg.gnumcueclipse.managedbuild.cross.riscv.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT RISC-V Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>
</extension>
</configuration>
</project>

View File

@ -7,7 +7,7 @@
* *
********************************************************************************* *********************************************************************************
* Copyright (c) 2021 Nanjing Qinheng Microelectronics Co., Ltd. * Copyright (c) 2021 Nanjing Qinheng Microelectronics Co., Ltd.
* Attention: This software (modified or not) and binary are used for * Attention: This software (modified or not) and binary are used for
* microcontroller manufactured by Nanjing Qinheng Microelectronics. * microcontroller manufactured by Nanjing Qinheng Microelectronics.
*******************************************************************************/ *******************************************************************************/
@ -40,23 +40,23 @@
#define SBP_PHY_UPDATE_DELAY 2400 #define SBP_PHY_UPDATE_DELAY 2400
// What is the advertising interval when device is discoverable (units of 625us, 80=50ms) // What is the advertising interval when device is discoverable (units of 625us, 80=50ms)
#define DEFAULT_ADVERTISING_INTERVAL 80 #define DEFAULT_ADVERTISING_INTERVAL (160 * 10)
// Limited discoverable mode advertises for 30.72s, and then stops // Limited discoverable mode advertises for 30.72s, and then stops
// General discoverable mode advertises indefinitely // General discoverable mode advertises indefinitely
#define DEFAULT_DISCOVERABLE_MODE GAP_ADTYPE_FLAGS_GENERAL #define DEFAULT_DISCOVERABLE_MODE GAP_ADTYPE_FLAGS_GENERAL
// Minimum connection interval (units of 1.25ms, 6=7.5ms) // Minimum connection interval (units of 1.25ms, 6=7.5ms)
#define DEFAULT_DESIRED_MIN_CONN_INTERVAL 6 #define DEFAULT_DESIRED_MIN_CONN_INTERVAL (100)
// Maximum connection interval (units of 1.25ms, 100=125ms) // Maximum connection interval (units of 1.25ms, 100=125ms)
#define DEFAULT_DESIRED_MAX_CONN_INTERVAL 100 #define DEFAULT_DESIRED_MAX_CONN_INTERVAL 400
// Slave latency to use parameter update // Slave latency to use parameter update
#define DEFAULT_DESIRED_SLAVE_LATENCY 0 #define DEFAULT_DESIRED_SLAVE_LATENCY 5
// Supervision timeout value (units of 10ms, 100=1s) // Supervision timeout value (units of 10ms, 100=1s)
#define DEFAULT_DESIRED_CONN_TIMEOUT 100 #define DEFAULT_DESIRED_CONN_TIMEOUT 200
// Company Identifier: WCH // Company Identifier: WCH
#define WCH_COMPANY_ID 0x07D7 #define WCH_COMPANY_ID 0x07D7
@ -365,7 +365,7 @@ uint16_t Peripheral_ProcessEvent(uint8_t task_id, uint16_t events)
if(events & SBP_PHY_UPDATE_EVT) if(events & SBP_PHY_UPDATE_EVT)
{ {
// start phy update // start phy update
PRINT("PHY Update %x...\n", GAPRole_UpdatePHY(peripheralConnList.connHandle, 0, PRINT("PHY Update %x...\n", GAPRole_UpdatePHY(peripheralConnList.connHandle, 0,
GAP_PHY_BIT_LE_2M, GAP_PHY_BIT_LE_2M, 0)); GAP_PHY_BIT_LE_2M, GAP_PHY_BIT_LE_2M, 0));
return (events ^ SBP_PHY_UPDATE_EVT); return (events ^ SBP_PHY_UPDATE_EVT);

View File

@ -6,7 +6,7 @@
* Description : * Description :
********************************************************************************* *********************************************************************************
* Copyright (c) 2021 Nanjing Qinheng Microelectronics Co., Ltd. * Copyright (c) 2021 Nanjing Qinheng Microelectronics Co., Ltd.
* Attention: This software (modified or not) and binary are used for * Attention: This software (modified or not) and binary are used for
* microcontroller manufactured by Nanjing Qinheng Microelectronics. * microcontroller manufactured by Nanjing Qinheng Microelectronics.
*******************************************************************************/ *******************************************************************************/
@ -60,10 +60,37 @@ int main(void)
GPIOA_ModeCfg(GPIO_Pin_All, GPIO_ModeIN_PU); GPIOA_ModeCfg(GPIO_Pin_All, GPIO_ModeIN_PU);
GPIOB_ModeCfg(GPIO_Pin_All, GPIO_ModeIN_PU); GPIOB_ModeCfg(GPIO_Pin_All, GPIO_ModeIN_PU);
#endif #endif
// 12V_EN
GPIOA_ResetBits(GPIO_Pin_13);
GPIOA_ModeCfg(GPIO_Pin_13, GPIO_ModeOut_PP_5mA);
// EMV_CTRL
GPIOB_ResetBits(GPIO_Pin_13);
GPIOB_ModeCfg(GPIO_Pin_13, GPIO_ModeIN_PD);
// LED
GPIOA_ResetBits(GPIO_Pin_4 | GPIO_Pin_5 | GPIO_Pin_15);
GPIOA_ModeCfg(GPIO_Pin_4 | GPIO_Pin_5 | GPIO_Pin_15, GPIO_ModeIN_PD);
// KEY
GPIOB_SetBits(GPIO_Pin_14);
// ÓÉÍⲿÉÏÀ­µç×èÁË
GPIOB_ModeCfg(GPIO_Pin_14, GPIO_ModeIN_Floating);
// ADC_VBAT
// GPIOAGPPCfg(ENABLE, RB_PIN_PA4_15_DIS);
// R16_PIN_ANALOG_IE != RB_PIN_PA4_15_DIS;
// R32_PIN_CONFIG2
// GPIOA_ResetBits(GPIO_Pin_1);
GPIOA_ModeCfg(GPIO_Pin_14, GPIO_ModeIN_Floating);
#ifdef DEBUG #ifdef DEBUG
GPIOA_SetBits(bTXD1); GPIOB_SetBits(bTXD0);
GPIOA_ModeCfg(bTXD1, GPIO_ModeOut_PP_5mA); GPIOB_ModeCfg(bTXD0, GPIO_ModeOut_PP_5mA);
UART1_DefInit(); UART0_DefInit();
#endif #endif
PRINT("%s\n", VER_LIB); PRINT("%s\n", VER_LIB);
CH59x_BLEInit(); CH59x_BLEInit();

21
BSP/inc/bsp_tim.h Normal file
View File

@ -0,0 +1,21 @@
#ifndef __BSP_TIM_H__
#define __BSP_TIM_H__
#include "CH59x_common.h"
uint32_t BSP_Get_Tick(void);
#endif //!@__BSP_TIM_H__

37
BSP/inc/bsp_uart.h Normal file
View File

@ -0,0 +1,37 @@
#ifndef __BSP_UART_H__
#define __BSP_UART_H__
#include "CH585SFR.h"
#define UART3_RX_PIN GPIO_Pin_20 //PB20 ÈÕÖ¾´òÓ¡
#define UART3_TX_PIN GPIO_Pin_21 // PB21
void BSP_UART1_Init(void);
unsigned int BSP_Uart1_Receive_Data(void *buf, unsigned int len);
unsigned int BSP_Uart1_Send_Data(const void *buf, unsigned int len);
void BSP_UART3_Init(void);
unsigned int BSP_Uart3_Receive_Data(void *buf, unsigned int len);
unsigned int BSP_Uart3_Send_Data(const void *buf, unsigned int len);
void BSP_Shell_Loop(void);
#endif

27
BSP/src/bsp_tim.c Normal file
View File

@ -0,0 +1,27 @@
#include "bsp_tim.h"
// tick_1ms_cnt在SysTick_Handler()中1ms +1
volatile uint32_t tick_1ms_cnt = 0;
/**
* @description: SysTick1ms
* @return {uint32_t}
*/
uint32_t BSP_Get_Tick(void)
{
/* Platform implementation */
return tick_1ms_cnt;
}
// SysTick中断函数
__INTERRUPT
__HIGH_CODE
void SysTick_Handler()
{
static uint8_t cnt_ms = 0;
SysTick->SR = 0; // 清除中断标志
tick_1ms_cnt++;
cnt_ms++;
}

228
BSP/src/bsp_uart.c Normal file
View File

@ -0,0 +1,228 @@
#include "bsp_uart.h"
#include "bsp_ml307r.h"
#include "lwrb.h"
#include "CH58x_uart.h"
#include "shell_port.h"
#define UART1_RX_BUFFER_LENGTH 512U
#define UART1_TX_BUFFER_LENGTH 512U
#define UART3_RX_BUFFER_LENGTH 1024U
#define UART3_TX_BUFFER_LENGTH 1024U
lwrb_t uart1_rx_t;
lwrb_t uart1_tx_t;
uint8_t uart1_tx_buf[UART1_TX_BUFFER_LENGTH] = {0};
uint8_t uart1_rx_buf[UART1_RX_BUFFER_LENGTH] = {0};
lwrb_t uart3_rx_t;
lwrb_t uart3_tx_t;
uint8_t uart3_tx_buf[UART3_TX_BUFFER_LENGTH] = {0};
uint8_t uart3_rx_buf[UART3_RX_BUFFER_LENGTH] = {0};
//串口接收
unsigned int BSP_Uart1_Receive_Data(void *buf, unsigned int len)
{
return lwrb_read(&uart1_rx_t, buf, len);
}
//串口发送数据
unsigned int BSP_Uart1_Send_Data(const void *buf, unsigned int len)
{
unsigned int ret;
ret = lwrb_write(&uart1_tx_t, buf, len);
UART1_INTCfg(ENABLE, RB_IER_THR_EMPTY);
return ret;
}
//串口接收
unsigned int BSP_Uart3_Receive_Data(void *buf, unsigned int len)
{
return lwrb_write(&uart3_rx_t, buf, len);
}
//串口发送数据
unsigned int BSP_Uart3_Send_Data(const void *buf, unsigned int len)
{
unsigned int ret;
ret = lwrb_write(&uart3_tx_t, buf, len);
UART3_INTCfg(ENABLE, RB_IER_THR_EMPTY);
return ret;
}
/**
* \brief Buffer event function
*/
static void Uart1_evt_fn(struct lwrb* buff, lwrb_evt_type_t evt, lwrb_sz_t bp)
{
switch (evt)
{
case LWRB_EVT_RESET:
printf("[EVT] Buffer reset event!\r\n");
break;
case LWRB_EVT_READ:
printf("[EVT] Buffer read event: %d byte(s)!\r\n", (int)bp);
break;
case LWRB_EVT_WRITE:
printf("[EVT] Buffer write event: %d byte(s)!\r\n", (int)bp);
break;
default: break;
}
}
void UART1_FifoInit(void)
{
lwrb_init(&uart1_tx_t, uart1_tx_buf, sizeof(uart1_tx_buf));
lwrb_init(&uart1_rx_t, uart1_rx_buf, sizeof(uart1_rx_buf));
// lwrb_set_evt_fn(&uart1_rx_t, Uart1_evt_fn);
}
void UART3_FifoInit(void)
{
lwrb_init(&uart3_tx_t, uart3_tx_buf, sizeof(uart3_tx_buf));
lwrb_init(&uart3_rx_t, uart3_rx_buf, sizeof(uart3_rx_buf));
lwrb_set_evt_fn(&uart1_rx_t, Uart1_evt_fn);
}
/*4G接口*/
void BSP_UART1_Init(void)
{
GPIOPinRemap(ENABLE, RB_PIN_UART1);
/* 配置串口1先配置IO口模式再配置串口 */
GPIOB_SetBits(ML307_UART_RX_PIN);
GPIOB_ModeCfg(ML307_UART_RX_PIN, GPIO_ModeIN_PU); // RXD-配置上拉输入
GPIOB_ModeCfg(ML307_UART_TX_PIN, GPIO_ModeOut_PP_5mA); // TXD-配置推挽输出注意先让IO口输出高电平
UART1_DefInit();
UART1_ByteTrigCfg(UART_1BYTE_TRIG);
// 中断方式接收数据
UART1_INTCfg(ENABLE, RB_IER_LINE_STAT | RB_IER_RECV_RDY | RB_IER_THR_EMPTY);
PFIC_EnableIRQ(UART1_IRQn);
UART1_FifoInit();
}
/*调试接口*/
void BSP_UART3_Init(void)
{
GPIOPinRemap(ENABLE, RB_PIN_UART3);
/* 配置串口3先配置IO口模式再配置串口 */
GPIOB_SetBits(UART3_TX_PIN);
GPIOB_ModeCfg(UART3_RX_PIN, GPIO_ModeIN_PU); // RXD-配置上拉输入
GPIOB_ModeCfg(UART3_TX_PIN, GPIO_ModeOut_PP_5mA); // TXD-配置推挽输出注意先让IO口输出高电平
UART3_DefInit();
UART3_BaudRateCfg(460800);
UART3_ByteTrigCfg(UART_1BYTE_TRIG);
// 中断方式接收数据
UART3_INTCfg(ENABLE, RB_IER_LINE_STAT | RB_IER_RECV_RDY | RB_IER_THR_EMPTY);
PFIC_EnableIRQ(UART3_IRQn);
UART3_FifoInit();
userShellInit();
}
/*********************************************************************
* @fn UART1_IRQHandler
*
* @brief UART1中断函数
*
* @return none
*/
__INTERRUPT
__HIGH_CODE
void UART1_IRQHandler(void)
{
uint8_t data;
switch(UART1_GetITFlag())
{
case UART_II_LINE_STAT: // 线路状态错误
{
// UART1_GetLinSTA();
break;
}
case UART_II_RECV_RDY:
data = UART1_RecvByte();
lwrb_write(&uart1_rx_t, &data, 1);
break;
case UART_II_RECV_TOUT: // 接收数据
break;
case UART_II_THR_EMPTY: // 发送缓存区空,可继续发送
if(lwrb_read(&uart1_tx_t, &data, 1))
{
UART1_SendByte(data);
}
else
{
UART1_INTCfg(DISABLE, RB_IER_THR_EMPTY);
}
break;
case UART_II_MODEM_CHG: // 只支持串口0
break;
default:
break;
}
}
/*********************************************************************
* @fn UART3_IRQHandler
*
* @brief UART1中断函数
*
* @return none
*/
__INTERRUPT
__HIGH_CODE
void UART3_IRQHandler(void)
{
uint8_t data;
switch(UART3_GetITFlag())
{
case UART_II_LINE_STAT: // 线路状态错误
{
// UART1_GetLinSTA();
break;
}
case UART_II_RECV_RDY:
case UART_II_RECV_TOUT: //接收超时
while(R8_UART3_RFC)
{
shellHandler(&shell, R8_UART3_RBR);
}
break;
case UART_II_THR_EMPTY: // 发送缓存区空,可继续发送
if(lwrb_get_full(&uart3_tx_t))
{
lwrb_read(&uart3_tx_t, &data, 1);
UART3_SendByte(data);
}
else
{
UART3_INTCfg(DISABLE, RB_IER_THR_EMPTY);
}
break;
case UART_II_MODEM_CHG: // 只支持串口0
break;
default:
break;
}
}

View File

@ -6,7 +6,7 @@
* Description : * Description :
********************************************************************************* *********************************************************************************
* Copyright (c) 2021 Nanjing Qinheng Microelectronics Co., Ltd. * Copyright (c) 2021 Nanjing Qinheng Microelectronics Co., Ltd.
* Attention: This software (modified or not) and binary are used for * Attention: This software (modified or not) and binary are used for
* microcontroller manufactured by Nanjing Qinheng Microelectronics. * microcontroller manufactured by Nanjing Qinheng Microelectronics.
*******************************************************************************/ *******************************************************************************/
@ -25,49 +25,61 @@
*/ */
uint32_t CH59x_LowPower(uint32_t time) uint32_t CH59x_LowPower(uint32_t time)
{ {
#if(defined(HAL_SLEEP)) && (HAL_SLEEP == TRUE) #if (defined(HAL_SLEEP)) && (HAL_SLEEP == TRUE)
volatile uint32_t i; volatile uint32_t i;
uint32_t time_sleep, time_curr; uint32_t time_sleep, time_curr;
unsigned long irq_status; unsigned long irq_status;
// 提前唤醒 // 提前唤醒
if (time <= WAKE_UP_RTC_MAX_TIME) { if (time <= WAKE_UP_RTC_MAX_TIME)
{
time = time + (RTC_MAX_COUNT - WAKE_UP_RTC_MAX_TIME); time = time + (RTC_MAX_COUNT - WAKE_UP_RTC_MAX_TIME);
} else { }
else
{
time = time - WAKE_UP_RTC_MAX_TIME; time = time - WAKE_UP_RTC_MAX_TIME;
} }
SYS_DisableAllIrq(&irq_status); SYS_DisableAllIrq(&irq_status);
time_curr = RTC_GetCycle32k(); time_curr = RTC_GetCycle32k();
// 检测睡眠时间 // 检测睡眠时间
if (time < time_curr) { if (time < time_curr)
{
time_sleep = time + (RTC_MAX_COUNT - time_curr); time_sleep = time + (RTC_MAX_COUNT - time_curr);
} else { }
else
{
time_sleep = time - time_curr; time_sleep = time - time_curr;
} }
// 若睡眠时间小于最小睡眠时间或大于最大睡眠时间,则不睡眠 // 若睡眠时间小于最小睡眠时间或大于最大睡眠时间,则不睡眠
if ((time_sleep < SLEEP_RTC_MIN_TIME) || if ((time_sleep < SLEEP_RTC_MIN_TIME) ||
(time_sleep > SLEEP_RTC_MAX_TIME)) { (time_sleep > SLEEP_RTC_MAX_TIME))
{
SYS_RecoverIrq(irq_status); SYS_RecoverIrq(irq_status);
return 2; return 2;
} }
RTC_SetTignTime(time); RTC_SetTignTime(time);
SYS_RecoverIrq(irq_status); SYS_RecoverIrq(irq_status);
#if(DEBUG == Debug_UART1) // 使用其他串口输出打印信息需要修改这行代码 #if (DEBUG == Debug_UART0) // 使用其他串口输出打印信息需要修改这行代码
while((R8_UART1_LSR & RB_LSR_TX_ALL_EMP) == 0) while ((R8_UART0_LSR & RB_LSR_TX_ALL_EMP) == 0)
{ {
__nop(); __nop();
} }
#endif #elif (DEBUG == Debug_UART1) // 使用其他串口输出打印信息需要修改这行代码
// LOW POWER-sleep模式 while ((R8_UART1_LSR & RB_LSR_TX_ALL_EMP) == 0)
if(!RTCTigFlag)
{ {
LowPower_Sleep(RB_PWR_RAM2K | RB_PWR_RAM24K | RB_PWR_EXTEND | RB_XT_PRE_EN ); __nop();
}
#endif
// LOW POWER-sleep模式
if (!RTCTigFlag)
{
LowPower_Sleep(RB_PWR_RAM2K | RB_PWR_RAM24K | RB_PWR_EXTEND | RB_XT_PRE_EN);
HSECFG_Current(HSE_RCur_100); // 降为额定电流(低功耗函数中提升了HSE偏置电流) HSECFG_Current(HSE_RCur_100); // 降为额定电流(低功耗函数中提升了HSE偏置电流)
i = RTC_GetCycle32k(); i = RTC_GetCycle32k();
while(i == RTC_GetCycle32k()); while (i == RTC_GetCycle32k());
return 0; return 0;
} }
#endif #endif
@ -85,12 +97,12 @@ uint32_t CH59x_LowPower(uint32_t time)
*/ */
void HAL_SleepInit(void) void HAL_SleepInit(void)
{ {
#if(defined(HAL_SLEEP)) && (HAL_SLEEP == TRUE) #if (defined(HAL_SLEEP)) && (HAL_SLEEP == TRUE)
sys_safe_access_enable(); sys_safe_access_enable();
R8_SLP_WAKE_CTRL |= RB_SLP_RTC_WAKE; // RTC唤醒 R8_SLP_WAKE_CTRL |= RB_SLP_RTC_WAKE; // RTC唤醒
sys_safe_access_disable(); sys_safe_access_disable();
sys_safe_access_enable(); sys_safe_access_enable();
R8_RTC_MODE_CTRL |= RB_RTC_TRIG_EN; // 触发模式 R8_RTC_MODE_CTRL |= RB_RTC_TRIG_EN; // 触发模式
sys_safe_access_disable(); sys_safe_access_disable();
PFIC_EnableIRQ(RTC_IRQn); PFIC_EnableIRQ(RTC_IRQn);
#endif #endif

View File

@ -6,7 +6,7 @@
* Description : * Description :
********************************************************************************* *********************************************************************************
* Copyright (c) 2021 Nanjing Qinheng Microelectronics Co., Ltd. * Copyright (c) 2021 Nanjing Qinheng Microelectronics Co., Ltd.
* Attention: This software (modified or not) and binary are used for * Attention: This software (modified or not) and binary are used for
* microcontroller manufactured by Nanjing Qinheng Microelectronics. * microcontroller manufactured by Nanjing Qinheng Microelectronics.
*******************************************************************************/ *******************************************************************************/
@ -43,11 +43,11 @@
- 5 - 5
TEMPERATION TEMPERATION
TEM_SAMPLE - 10ms( :TRUE ) TEM_SAMPLE - 10ms( :TRUE )
CALIBRATION CALIBRATION
BLE_CALIBRATION_ENABLE - 10ms( :TRUE ) BLE_CALIBRATION_ENABLE - 10ms( :TRUE )
BLE_CALIBRATION_PERIOD - ms( :120000 ) BLE_CALIBRATION_PERIOD - ms( :120000 )
SNV SNV
BLE_SNV - SNV功能( :TRUE ) BLE_SNV - SNV功能( :TRUE )
BLE_SNV_ADDR - SNV信息保存地址使data flash最后512字节( :0x77E00 ) BLE_SNV_ADDR - SNV信息保存地址使data flash最后512字节( :0x77E00 )
@ -65,7 +65,7 @@
BLE_BUFF_NUM - ( :5 ) BLE_BUFF_NUM - ( :5 )
BLE_TX_NUM_EVENT - ( :1 ) BLE_TX_NUM_EVENT - ( :1 )
BLE_TX_POWER - ( :LL_TX_POWEER_0_DBM (0dBm) ) BLE_TX_POWER - ( :LL_TX_POWEER_0_DBM (0dBm) )
MULTICONN MULTICONN
PERIPHERAL_MAX_CONNECTION - ( :1 ) PERIPHERAL_MAX_CONNECTION - ( :1 )
CENTRAL_MAX_CONNECTION - ( :3 ) CENTRAL_MAX_CONNECTION - ( :3 )
@ -79,15 +79,15 @@
#define BLE_MAC FALSE #define BLE_MAC FALSE
#endif #endif
#ifndef DCDC_ENABLE #ifndef DCDC_ENABLE
#define DCDC_ENABLE FALSE #define DCDC_ENABLE TRUE
#endif #endif
#ifndef HAL_SLEEP #ifndef HAL_SLEEP
#define HAL_SLEEP FALSE #define HAL_SLEEP TRUE
#endif #endif
#ifndef SLEEP_RTC_MIN_TIME #ifndef SLEEP_RTC_MIN_TIME
#define SLEEP_RTC_MIN_TIME US_TO_RTC(1000) #define SLEEP_RTC_MIN_TIME US_TO_RTC(1000)
#endif #endif
#ifndef SLEEP_RTC_MAX_TIME #ifndef SLEEP_RTC_MAX_TIME
#define SLEEP_RTC_MAX_TIME (RTC_MAX_COUNT - 1000 * 1000 * 30) #define SLEEP_RTC_MAX_TIME (RTC_MAX_COUNT - 1000 * 1000 * 30)
#endif #endif
#ifndef WAKE_UP_RTC_MAX_TIME #ifndef WAKE_UP_RTC_MAX_TIME

View File

@ -6,7 +6,7 @@
* Description * Description
********************************************************************************* *********************************************************************************
* Copyright (c) 2021 Nanjing Qinheng Microelectronics Co., Ltd. * Copyright (c) 2021 Nanjing Qinheng Microelectronics Co., Ltd.
* Attention: This software (modified or not) and binary are used for * Attention: This software (modified or not) and binary are used for
* microcontroller manufactured by Nanjing Qinheng Microelectronics. * microcontroller manufactured by Nanjing Qinheng Microelectronics.
*******************************************************************************/ *******************************************************************************/
@ -23,7 +23,7 @@
*/ */
void UART0_DefInit(void) void UART0_DefInit(void)
{ {
UART0_BaudRateCfg(115200); UART0_BaudRateCfg(460800);
R8_UART0_FCR = (2 << 6) | RB_FCR_TX_FIFO_CLR | RB_FCR_RX_FIFO_CLR | RB_FCR_FIFO_EN; // FIFO´ò¿ª£¬´¥·¢µã4×Ö½Ú R8_UART0_FCR = (2 << 6) | RB_FCR_TX_FIFO_CLR | RB_FCR_RX_FIFO_CLR | RB_FCR_FIFO_EN; // FIFO´ò¿ª£¬´¥·¢µã4×Ö½Ú
R8_UART0_LCR = RB_LCR_WORD_SZ; R8_UART0_LCR = RB_LCR_WORD_SZ;
R8_UART0_IER = RB_IER_TXD_EN; R8_UART0_IER = RB_IER_TXD_EN;