Compare commits
19 Commits
5785093138
...
dht11-v2
| Author | SHA1 | Date | |
|---|---|---|---|
| 7844c8bdce | |||
| 4b467f6701 | |||
| 9370ddbadd | |||
| ac75969758 | |||
| c74299dc0d | |||
| 8d41a30bff | |||
| 8b5bbd3e9a | |||
| 107a454051 | |||
| 01d4b75921 | |||
| 8878d1fd10 | |||
| 3300c5eebd | |||
| 0f1d8b71d7 | |||
| 117ba3202c | |||
| 207f9c9ddf | |||
| 8112ed27e8 | |||
| 13db07642e | |||
| 9a40b5a6fb | |||
| c6f2048d22 | |||
| 5f23a03009 |
38
.cproject
38
.cproject
@@ -24,7 +24,7 @@
|
||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.floatabi.755606893" name="Floating-point ABI" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.floatabi" useByScannerDiscovery="true" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.floatabi.value.hard" valueType="enumerated"/>
|
||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_board.1771260818" name="Board" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_board" useByScannerDiscovery="false" value="genericBoard" valueType="string"/>
|
||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.defaults.1811760675" name="Defaults" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.defaults" useByScannerDiscovery="false" value="com.st.stm32cube.ide.common.services.build.inputs.revA.1.0.6 || Debug || true || Executable || com.st.stm32cube.ide.mcu.gnu.managedbuild.option.toolchain.value.workspace || STM32F407VGTx || 0 || 0 || arm-none-eabi- || ${gnu_tools_for_stm32_compiler_path} || ../Core/Inc | ../Drivers/STM32F4xx_HAL_Driver/Inc | ../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy | ../Drivers/CMSIS/Device/ST/STM32F4xx/Include | ../Drivers/CMSIS/Include || || || USE_HAL_DRIVER | STM32F407xx || || Drivers | Core/Startup | Core || || || ${workspace_loc:/${ProjName}/STM32F407VGTX_FLASH.ld} || true || NonSecure || || secure_nsclib.o || || None || || || " valueType="string"/>
|
||||
<option id="com.st.stm32cube.ide.mcu.debug.option.cpuclock.2006503660" superClass="com.st.stm32cube.ide.mcu.debug.option.cpuclock" useByScannerDiscovery="false" value="16" valueType="string"/>
|
||||
<option id="com.st.stm32cube.ide.mcu.debug.option.cpuclock.2006503660" name="Cpu clock frequence" superClass="com.st.stm32cube.ide.mcu.debug.option.cpuclock" useByScannerDiscovery="false" value="16" valueType="string"/>
|
||||
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.targetplatform.188797436" isAbstract="false" osList="all" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.targetplatform"/>
|
||||
<builder buildPath="${workspace_loc:/test1}/Debug" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.builder.901063855" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.builder"/>
|
||||
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.1851291017" name="MCU/MPU GCC Assembler" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler">
|
||||
@@ -36,7 +36,7 @@
|
||||
</tool>
|
||||
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.1285639549" name="MCU/MPU GCC Compiler" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler">
|
||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.debuglevel.75005491" name="Debug level" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.debuglevel" useByScannerDiscovery="false" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.debuglevel.value.g3" valueType="enumerated"/>
|
||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.optimization.level.1711938240" name="Optimization level" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.optimization.level" useByScannerDiscovery="false"/>
|
||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.optimization.level.1711938240" name="Optimization level" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.optimization.level" useByScannerDiscovery="false" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.optimization.level.value.o0" valueType="enumerated"/>
|
||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.definedsymbols.1662015804" name="Define symbols (-D)" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.definedsymbols" useByScannerDiscovery="false" valueType="definedSymbols">
|
||||
<listOptionValue builtIn="false" value="DEBUG"/>
|
||||
<listOptionValue builtIn="false" value="USE_HAL_DRIVER"/>
|
||||
@@ -97,28 +97,28 @@
|
||||
<configuration artifactExtension="elf" 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="rm -rf" description="" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.config.exe.release.603779794" name="Release" parent="com.st.stm32cube.ide.mcu.gnu.managedbuild.config.exe.release">
|
||||
<folderInfo id="com.st.stm32cube.ide.mcu.gnu.managedbuild.config.exe.release.603779794." name="/" resourcePath="">
|
||||
<toolChain id="com.st.stm32cube.ide.mcu.gnu.managedbuild.toolchain.exe.release.846299435" name="MCU ARM GCC" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.toolchain.exe.release">
|
||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_mcu.1996532596" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_mcu" useByScannerDiscovery="true" value="STM32F407VGTx" valueType="string"/>
|
||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_cpuid.1932354132" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_cpuid" useByScannerDiscovery="false" value="0" valueType="string"/>
|
||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_coreid.783288720" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_coreid" useByScannerDiscovery="false" value="0" valueType="string"/>
|
||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.fpu.619251655" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.fpu" useByScannerDiscovery="true" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.fpu.value.fpv4-sp-d16" valueType="enumerated"/>
|
||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.floatabi.1646548773" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.floatabi" useByScannerDiscovery="true" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.floatabi.value.hard" valueType="enumerated"/>
|
||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_board.1901965124" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_board" useByScannerDiscovery="false" value="genericBoard" valueType="string"/>
|
||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.defaults.859080388" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.defaults" useByScannerDiscovery="false" value="com.st.stm32cube.ide.common.services.build.inputs.revA.1.0.6 || Release || false || Executable || com.st.stm32cube.ide.mcu.gnu.managedbuild.option.toolchain.value.workspace || STM32F407VGTx || 0 || 0 || arm-none-eabi- || ${gnu_tools_for_stm32_compiler_path} || ../Core/Inc | ../Drivers/STM32F4xx_HAL_Driver/Inc | ../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy | ../Drivers/CMSIS/Device/ST/STM32F4xx/Include | ../Drivers/CMSIS/Include || || || USE_HAL_DRIVER | STM32F407xx || || Drivers | Core/Startup | Core || || || ${workspace_loc:/${ProjName}/STM32F407VGTX_FLASH.ld} || true || NonSecure || || secure_nsclib.o || || None || || || " valueType="string"/>
|
||||
<option id="com.st.stm32cube.ide.mcu.debug.option.cpuclock.1202403298" superClass="com.st.stm32cube.ide.mcu.debug.option.cpuclock" useByScannerDiscovery="false" value="16" valueType="string"/>
|
||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_mcu.1996532596" name="MCU" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_mcu" useByScannerDiscovery="true" value="STM32F407VGTx" valueType="string"/>
|
||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_cpuid.1932354132" name="CPU" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_cpuid" useByScannerDiscovery="false" value="0" valueType="string"/>
|
||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_coreid.783288720" name="Core" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_coreid" useByScannerDiscovery="false" value="0" valueType="string"/>
|
||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.fpu.619251655" name="Floating-point unit" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.fpu" useByScannerDiscovery="true" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.fpu.value.fpv4-sp-d16" valueType="enumerated"/>
|
||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.floatabi.1646548773" name="Floating-point ABI" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.floatabi" useByScannerDiscovery="true" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.floatabi.value.hard" valueType="enumerated"/>
|
||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_board.1901965124" name="Board" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_board" useByScannerDiscovery="false" value="genericBoard" valueType="string"/>
|
||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.defaults.859080388" name="Defaults" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.defaults" useByScannerDiscovery="false" value="com.st.stm32cube.ide.common.services.build.inputs.revA.1.0.6 || Release || false || Executable || com.st.stm32cube.ide.mcu.gnu.managedbuild.option.toolchain.value.workspace || STM32F407VGTx || 0 || 0 || arm-none-eabi- || ${gnu_tools_for_stm32_compiler_path} || ../Core/Inc | ../Drivers/STM32F4xx_HAL_Driver/Inc | ../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy | ../Drivers/CMSIS/Device/ST/STM32F4xx/Include | ../Drivers/CMSIS/Include || || || USE_HAL_DRIVER | STM32F407xx || || Drivers | Core/Startup | Core || || || ${workspace_loc:/${ProjName}/STM32F407VGTX_FLASH.ld} || true || NonSecure || || secure_nsclib.o || || None || || || " valueType="string"/>
|
||||
<option id="com.st.stm32cube.ide.mcu.debug.option.cpuclock.1202403298" name="Cpu clock frequence" superClass="com.st.stm32cube.ide.mcu.debug.option.cpuclock" useByScannerDiscovery="false" value="16" valueType="string"/>
|
||||
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.targetplatform.584865598" isAbstract="false" osList="all" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.targetplatform"/>
|
||||
<builder buildPath="${workspace_loc:/test1}/Release" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.builder.1873374287" managedBuildOn="true" name="Gnu Make Builder.Release" parallelBuildOn="true" parallelizationNumber="optimal" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.builder"/>
|
||||
<builder buildPath="${workspace_loc:/test1}/Release" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.builder.1873374287" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.builder"/>
|
||||
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.1806292512" name="MCU/MPU GCC Assembler" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler">
|
||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.option.debuglevel.623288838" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.option.debuglevel" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.option.debuglevel.value.g0" valueType="enumerated"/>
|
||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.option.debuglevel.623288838" name="Debug level" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.option.debuglevel" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.option.debuglevel.value.g0" valueType="enumerated"/>
|
||||
<inputType id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.input.2013577938" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.input"/>
|
||||
</tool>
|
||||
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.1063892447" name="MCU/MPU GCC Compiler" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler">
|
||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.debuglevel.318905510" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.debuglevel" useByScannerDiscovery="false" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.debuglevel.value.g0" valueType="enumerated"/>
|
||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.optimization.level.187906977" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.optimization.level" useByScannerDiscovery="false" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.optimization.level.value.os" valueType="enumerated"/>
|
||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.definedsymbols.516585832" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.definedsymbols" useByScannerDiscovery="false" valueType="definedSymbols">
|
||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.debuglevel.318905510" name="Debug level" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.debuglevel" useByScannerDiscovery="false" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.debuglevel.value.g0" valueType="enumerated"/>
|
||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.optimization.level.187906977" name="Optimization level" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.optimization.level" useByScannerDiscovery="false" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.optimization.level.value.os" valueType="enumerated"/>
|
||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.definedsymbols.516585832" name="Define symbols (-D)" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.definedsymbols" useByScannerDiscovery="false" valueType="definedSymbols">
|
||||
<listOptionValue builtIn="false" value="USE_HAL_DRIVER"/>
|
||||
<listOptionValue builtIn="false" value="STM32F407xx"/>
|
||||
</option>
|
||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.includepaths.1500062626" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.includepaths" useByScannerDiscovery="false" valueType="includePath">
|
||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.includepaths.1500062626" name="Include paths (-I)" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.includepaths" useByScannerDiscovery="false" valueType="includePath">
|
||||
<listOptionValue builtIn="false" value="../Core/Inc"/>
|
||||
<listOptionValue builtIn="false" value="../Drivers/STM32F4xx_HAL_Driver/Inc"/>
|
||||
<listOptionValue builtIn="false" value="../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy"/>
|
||||
@@ -128,11 +128,11 @@
|
||||
<inputType id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.input.c.219678164" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.input.c"/>
|
||||
</tool>
|
||||
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.compiler.1427603543" name="MCU/MPU G++ Compiler" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.compiler">
|
||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.compiler.option.debuglevel.130697829" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.compiler.option.debuglevel" useByScannerDiscovery="false" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.compiler.option.debuglevel.value.g0" valueType="enumerated"/>
|
||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.compiler.option.optimization.level.1547171342" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.compiler.option.optimization.level" useByScannerDiscovery="false" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.compiler.option.optimization.level.value.os" valueType="enumerated"/>
|
||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.compiler.option.debuglevel.130697829" name="Debug level" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.compiler.option.debuglevel" useByScannerDiscovery="false" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.compiler.option.debuglevel.value.g0" valueType="enumerated"/>
|
||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.compiler.option.optimization.level.1547171342" name="Optimization level" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.compiler.option.optimization.level" useByScannerDiscovery="false" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.compiler.option.optimization.level.value.os" valueType="enumerated"/>
|
||||
</tool>
|
||||
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.linker.1754531090" name="MCU/MPU GCC Linker" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.linker">
|
||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.linker.option.script.610449053" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.linker.option.script" value="${workspace_loc:/${ProjName}/STM32F407VGTX_FLASH.ld}" valueType="string"/>
|
||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.linker.option.script.610449053" name="Linker Script (-T)" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.linker.option.script" value="${workspace_loc:/${ProjName}/STM32F407VGTX_FLASH.ld}" valueType="string"/>
|
||||
<inputType id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.linker.input.1602204541" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.linker.input">
|
||||
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
|
||||
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
|
||||
|
||||
File diff suppressed because one or more lines are too long
6
Core/Inc/24AA02E48.h
Normal file
6
Core/Inc/24AA02E48.h
Normal file
@@ -0,0 +1,6 @@
|
||||
#ifndef __EEPROM_24AA02E48
|
||||
#define __EEPROM_24AA02E48
|
||||
|
||||
void EEPROM_24AA02E48_run_test(void);
|
||||
|
||||
#endif
|
||||
7
Core/Inc/CS43L22.h
Normal file
7
Core/Inc/CS43L22.h
Normal file
@@ -0,0 +1,7 @@
|
||||
#ifndef __CS43L22
|
||||
#define __CS43L22
|
||||
|
||||
void CS43L22_run_test(void);
|
||||
void CS43L22_cleanup(void);
|
||||
|
||||
#endif
|
||||
17
Core/Inc/DHT11.h
Normal file
17
Core/Inc/DHT11.h
Normal file
@@ -0,0 +1,17 @@
|
||||
#ifndef __DHT11
|
||||
#define __DHT11
|
||||
|
||||
#define SKIP_LOW while (!(GPIOD->IDR & 0x0800)) {}
|
||||
#define SKIP_HIGH while (GPIOD->IDR & 0x0800) {}
|
||||
|
||||
struct DHT11_Data {
|
||||
uint8_t humid_integral;
|
||||
uint8_t humid_decimal;
|
||||
uint8_t temp_integral;
|
||||
uint8_t temp_decimal;
|
||||
uint8_t crc;
|
||||
};
|
||||
|
||||
void DHT11_run_test(void);
|
||||
|
||||
#endif
|
||||
9
Core/Inc/DNI.h
Normal file
9
Core/Inc/DNI.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#ifndef __DNI
|
||||
#define __DNI
|
||||
|
||||
extern ADC_HandleTypeDef hadc1;
|
||||
|
||||
void DNI_show_celsius(void);
|
||||
void DNI_show_fahrenheit(void);
|
||||
|
||||
#endif
|
||||
7
Core/Inc/LIS302DL.h
Normal file
7
Core/Inc/LIS302DL.h
Normal file
@@ -0,0 +1,7 @@
|
||||
#ifndef __LIS302DL
|
||||
#define __LIS302DL
|
||||
|
||||
void LIS302DL_run_test(void);
|
||||
void LIS302DL_run_test_dynamic(void);
|
||||
|
||||
#endif
|
||||
8
Core/Inc/LSM9DS1.h
Normal file
8
Core/Inc/LSM9DS1.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#ifndef __LSM9DS1
|
||||
#define __LSM9DS1
|
||||
|
||||
void LSM9DS1_test_accel(void);
|
||||
void LSM9DS1_cleanup_accel(void);
|
||||
void LSM9DS1_test_magnet(void);
|
||||
|
||||
#endif
|
||||
6
Core/Inc/MP45DT02.h
Normal file
6
Core/Inc/MP45DT02.h
Normal file
@@ -0,0 +1,6 @@
|
||||
#ifndef __MP45DT02
|
||||
#define __MP45DT02
|
||||
|
||||
void MP45DT02_run_test(void);
|
||||
|
||||
#endif
|
||||
@@ -1,2 +1,7 @@
|
||||
#ifndef __PCA9685
|
||||
#define __PCA9685
|
||||
|
||||
void PCA9685_run_test(void);
|
||||
void PCA9685_cleanup(void);
|
||||
|
||||
#endif
|
||||
|
||||
6
Core/Inc/SST25VF016B.h
Normal file
6
Core/Inc/SST25VF016B.h
Normal file
@@ -0,0 +1,6 @@
|
||||
#ifndef __SST25VF016B
|
||||
#define __SST25VF016B
|
||||
|
||||
void SST25VF016B_run_test(void);
|
||||
|
||||
#endif
|
||||
@@ -1,11 +0,0 @@
|
||||
#ifndef __EXTERNAL_TEMP
|
||||
#define __EXTERNAL_TEMP
|
||||
|
||||
extern ADC_HandleTypeDef hadc1;
|
||||
|
||||
|
||||
|
||||
void external_temp_show_celsius(void);
|
||||
void external_temp_show_fahrenheit(void);
|
||||
|
||||
#endif
|
||||
@@ -54,7 +54,7 @@
|
||||
/* #define HAL_SDRAM_MODULE_ENABLED */
|
||||
/* #define HAL_HASH_MODULE_ENABLED */
|
||||
#define HAL_I2C_MODULE_ENABLED
|
||||
/* #define HAL_I2S_MODULE_ENABLED */
|
||||
#define HAL_I2S_MODULE_ENABLED
|
||||
/* #define HAL_IWDG_MODULE_ENABLED */
|
||||
/* #define HAL_LTDC_MODULE_ENABLED */
|
||||
/* #define HAL_RNG_MODULE_ENABLED */
|
||||
@@ -62,8 +62,8 @@
|
||||
/* #define HAL_SAI_MODULE_ENABLED */
|
||||
/* #define HAL_SD_MODULE_ENABLED */
|
||||
/* #define HAL_MMC_MODULE_ENABLED */
|
||||
/* #define HAL_SPI_MODULE_ENABLED */
|
||||
/* #define HAL_TIM_MODULE_ENABLED */
|
||||
#define HAL_SPI_MODULE_ENABLED
|
||||
#define HAL_TIM_MODULE_ENABLED
|
||||
/* #define HAL_UART_MODULE_ENABLED */
|
||||
/* #define HAL_USART_MODULE_ENABLED */
|
||||
/* #define HAL_IRDA_MODULE_ENABLED */
|
||||
|
||||
102
Core/Src/24AA02E48.c
Normal file
102
Core/Src/24AA02E48.c
Normal file
@@ -0,0 +1,102 @@
|
||||
#include "main.h"
|
||||
#include "lcd.h"
|
||||
#include "24AA02E48.h"
|
||||
|
||||
extern I2C_HandleTypeDef hi2c1;
|
||||
|
||||
void EEPROM_24AA02E48_run_test(void)
|
||||
{
|
||||
DISPLAY_CLEAR;
|
||||
display_write_data_seq("24AA02E48 EEPROM");
|
||||
|
||||
HAL_StatusTypeDef op_result;
|
||||
size_t err_count = 0;
|
||||
|
||||
// write the Address Pointer register
|
||||
uint8_t data_buffer[13];
|
||||
data_buffer[12] = '\0';
|
||||
data_buffer[0] = 0xF4;
|
||||
|
||||
for (size_t t = 0; t < 5; t++) {
|
||||
op_result = HAL_I2C_Master_Transmit(&hi2c1, 0xA0, data_buffer, 1, 2000);
|
||||
|
||||
if (op_result) {
|
||||
err_count++;
|
||||
|
||||
DISPLAY_CLEAR;
|
||||
display_write_data_seq("24AA02E48 EEPROM");
|
||||
|
||||
DISPLAY_SET_CURSOR(1, 0);
|
||||
display_write_data_seq("W ");
|
||||
display_write_data_byte('1' + t);
|
||||
display_write_data_seq("/5 ");
|
||||
|
||||
switch (op_result) {
|
||||
case HAL_OK:
|
||||
break;
|
||||
case HAL_ERROR:
|
||||
display_write_data_seq("ERROR");
|
||||
break;
|
||||
case HAL_BUSY:
|
||||
display_write_data_seq("BUSY");
|
||||
break;
|
||||
case HAL_TIMEOUT:
|
||||
display_write_data_seq("TIMEOUT");
|
||||
break;
|
||||
}
|
||||
|
||||
HAL_Delay(2000);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (size_t t = 0; t < 5; t++) {
|
||||
op_result = HAL_I2C_Master_Receive(&hi2c1, 0xA1, data_buffer, 12, 2000);
|
||||
|
||||
if (op_result) {
|
||||
err_count++;
|
||||
|
||||
DISPLAY_CLEAR;
|
||||
display_write_data_seq("24AA02E48 EEPROM");
|
||||
|
||||
DISPLAY_SET_CURSOR(1, 0);
|
||||
display_write_data_seq("R ");
|
||||
display_write_data_byte('1' + t);
|
||||
display_write_data_seq("/5 ");
|
||||
|
||||
switch (op_result) {
|
||||
case HAL_OK:
|
||||
break;
|
||||
case HAL_ERROR:
|
||||
display_write_data_seq("ERROR");
|
||||
break;
|
||||
case HAL_BUSY:
|
||||
display_write_data_seq("BUSY");
|
||||
break;
|
||||
case HAL_TIMEOUT:
|
||||
display_write_data_seq("TIMEOUT");
|
||||
break;
|
||||
}
|
||||
|
||||
HAL_Delay(2000);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
DISPLAY_CLEAR;
|
||||
display_write_data_seq("24AA02E48 EEPROM");
|
||||
|
||||
if (err_count) {
|
||||
DISPLAY_SET_CURSOR(1, 0);
|
||||
display_write_data_byte('0' + err_count / 10 % 10);
|
||||
display_write_data_byte('0' + err_count % 10);
|
||||
display_write_data_seq("E ");
|
||||
display_write_data_seq((char *) data_buffer);
|
||||
} else {
|
||||
DISPLAY_SET_CURSOR(1, 1);
|
||||
display_write_data_seq("OK ");
|
||||
display_write_data_seq((char *) data_buffer);
|
||||
}
|
||||
}
|
||||
69
Core/Src/CS43L22.c
Normal file
69
Core/Src/CS43L22.c
Normal file
@@ -0,0 +1,69 @@
|
||||
#include "main.h"
|
||||
#include "lcd.h"
|
||||
#include "CS43L22.h"
|
||||
|
||||
extern I2C_HandleTypeDef hi2c1;
|
||||
|
||||
void CS43L22_run_test(void)
|
||||
{
|
||||
DISPLAY_CLEAR;
|
||||
display_write_data_seq("CS43L22 Audio");
|
||||
|
||||
HAL_StatusTypeDef op_result;
|
||||
size_t err_count = 0;
|
||||
|
||||
HAL_GPIO_WritePin(GPIOD, GPIO_PIN_4, GPIO_PIN_SET);
|
||||
|
||||
uint8_t data_buffer[2] = {0x0D, 0x01};
|
||||
|
||||
for (size_t t = 0; t < 5; t++) {
|
||||
op_result = HAL_I2C_Master_Transmit(&hi2c1, 0x94, data_buffer, 2, 2000);
|
||||
|
||||
if (op_result) {
|
||||
err_count++;
|
||||
|
||||
DISPLAY_CLEAR;
|
||||
display_write_data_seq("CS43L22 Audio");
|
||||
|
||||
DISPLAY_SET_CURSOR(1, 0);
|
||||
display_write_data_seq("W ");
|
||||
display_write_data_byte('1' + t);
|
||||
display_write_data_seq("/5 ");
|
||||
|
||||
switch (op_result) {
|
||||
case HAL_OK:
|
||||
break;
|
||||
case HAL_ERROR:
|
||||
display_write_data_seq("ERROR");
|
||||
break;
|
||||
case HAL_BUSY:
|
||||
display_write_data_seq("BUSY");
|
||||
break;
|
||||
case HAL_TIMEOUT:
|
||||
display_write_data_seq("TIMEOUT");
|
||||
break;
|
||||
}
|
||||
|
||||
HAL_Delay(2000);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
DISPLAY_CLEAR;
|
||||
display_write_data_seq("CS43L22 Audio");
|
||||
|
||||
if (err_count) {
|
||||
DISPLAY_SET_CURSOR(1, 1);
|
||||
display_write_data_byte('0' + err_count % 10);
|
||||
display_write_data_seq(" Errors");
|
||||
} else {
|
||||
DISPLAY_SET_CURSOR(1, 1);
|
||||
display_write_data_seq("OK");
|
||||
}
|
||||
}
|
||||
|
||||
void CS43L22_cleanup(void)
|
||||
{
|
||||
HAL_GPIO_WritePin(GPIOD, GPIO_PIN_4, GPIO_PIN_RESET);
|
||||
}
|
||||
90
Core/Src/DHT11.c
Normal file
90
Core/Src/DHT11.c
Normal file
@@ -0,0 +1,90 @@
|
||||
#include "main.h"
|
||||
#include "generic_macros.h"
|
||||
#include "lcd.h"
|
||||
#include "DHT11.h"
|
||||
|
||||
extern TIM_HandleTypeDef htim2;
|
||||
|
||||
static void wait(uint32_t wait_us)
|
||||
{
|
||||
uint32_t target_time = TIM2->CNT;
|
||||
target_time += wait_us << 4;
|
||||
|
||||
while (TIM2->CNT < target_time) {}
|
||||
}
|
||||
|
||||
static size_t dht11_measure_high_duration(void)
|
||||
{
|
||||
SKIP_LOW;
|
||||
uint32_t start_time = TIM2->CNT;
|
||||
SKIP_HIGH;
|
||||
uint32_t end_time = TIM2->CNT;
|
||||
|
||||
// elapsed_time > 49us ? 1 : 0
|
||||
return (end_time - start_time) > (49 << 4);
|
||||
}
|
||||
|
||||
static size_t dht11_read_value(struct DHT11_Data *data)
|
||||
{
|
||||
// treat data as a normal array to simplify read loop
|
||||
uint8_t *buffer = (uint8_t *) data;
|
||||
|
||||
register uint32_t read_register = 0;
|
||||
|
||||
TIM2->CNT = 0;
|
||||
HAL_TIM_Base_Start(&htim2);
|
||||
|
||||
GPIOD->MODER |= 0x00400000; // enable output mode on GPIOD 11
|
||||
|
||||
GPIOD->BSRR = GPIO_PIN_11; // enable DHT11
|
||||
wait(18000); // hold HIGH for 18 ms
|
||||
GPIOD->BSRR = GPIO_PIN_11 << 16; // start signal
|
||||
wait(20); // hold it for 20 us
|
||||
GPIOD->BSRR = GPIO_PIN_11; // pull up, DHT will now take control over the connection
|
||||
wait(40);
|
||||
|
||||
GPIOD->MODER &= 0xFF3FFFFF; // switch GPIOD 11 to input mode
|
||||
|
||||
// reading pull down from DHT11
|
||||
SKIP_LOW;
|
||||
|
||||
// waiting for 500ms max
|
||||
for (size_t i = TIM2->CNT + (500000 << 4); TIM2->CNT <= i; )
|
||||
if (!(GPIOD->IDR & 0x0800))
|
||||
goto reading_data;
|
||||
|
||||
// if didn't exit through goto, then DHT11 awaiting has timed out
|
||||
return 1;
|
||||
|
||||
reading_data:
|
||||
// read 5 bytes of data
|
||||
for (size_t i = 0; i < 5; i++) {
|
||||
for (register size_t j = 0; j < 8; j++) {
|
||||
read_register <<= 1;
|
||||
read_register |= dht11_measure_high_duration();
|
||||
}
|
||||
|
||||
buffer[i] = (uint8_t) read_register;
|
||||
}
|
||||
|
||||
HAL_TIM_Base_Stop(&htim2);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void DHT11_run_test(void)
|
||||
{
|
||||
DISPLAY_CLEAR;
|
||||
display_write_data_seq("DHT11 Temp+Humid");
|
||||
|
||||
struct DHT11_Data data;
|
||||
size_t result = dht11_read_value(&data);
|
||||
|
||||
if (result == 1) {
|
||||
DISPLAY_SET_CURSOR(1, 1);
|
||||
display_write_data_seq("START TIMEOUT");
|
||||
} else {
|
||||
DISPLAY_SET_CURSOR(1, 1);
|
||||
display_write_data_seq("OK");
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
#include "main.h"
|
||||
#include "generic_macros.h"
|
||||
#include "lcd.h"
|
||||
#include "external_temp.h"
|
||||
#include "DNI.h"
|
||||
|
||||
static uint32_t external_temp_read(void)
|
||||
static uint32_t DNI_read(void)
|
||||
{
|
||||
HAL_ADC_Start(&hadc1);
|
||||
if (HAL_ADC_PollForConversion(&hadc1, 100) != HAL_OK)
|
||||
@@ -12,17 +12,17 @@ static uint32_t external_temp_read(void)
|
||||
return HAL_ADC_GetValue(&hadc1);
|
||||
}
|
||||
|
||||
static int external_temp_convert_to_celsius(uint32_t value)
|
||||
static int DNI_convert_to_celsius(uint32_t value)
|
||||
{
|
||||
return (2512 - value) << 2;
|
||||
}
|
||||
|
||||
static int external_temp_convert_to_fahrenheit(uint32_t value)
|
||||
static int DNI_convert_to_fahrenheit(uint32_t value)
|
||||
{
|
||||
return (2953 - value) * 50 / 7;
|
||||
}
|
||||
|
||||
static void external_temp_print(int temperature)
|
||||
static void DNI_print(int temperature)
|
||||
{
|
||||
int add_sign = temperature < 0;
|
||||
if (add_sign)
|
||||
@@ -55,44 +55,44 @@ static void external_temp_print(int temperature)
|
||||
}
|
||||
}
|
||||
|
||||
static void external_temp_print_celsius(int temperature)
|
||||
static void DNI_print_celsius(int temperature)
|
||||
{
|
||||
DISPLAY_SET_CURSOR(1, 7);
|
||||
DISPLAY_SET_DECREMENT;
|
||||
display_write_data_seq("C ");
|
||||
|
||||
external_temp_print(temperature);
|
||||
DNI_print(temperature);
|
||||
}
|
||||
|
||||
static void external_temp_print_fahrenheit(int temperature)
|
||||
static void DNI_print_fahrenheit(int temperature)
|
||||
{
|
||||
DISPLAY_SET_CURSOR(1, 7);
|
||||
DISPLAY_SET_DECREMENT;
|
||||
display_write_data_seq("F ");
|
||||
|
||||
external_temp_print(temperature);
|
||||
DNI_print(temperature);
|
||||
}
|
||||
|
||||
void external_temp_show_celsius(void)
|
||||
void DNI_show_celsius(void)
|
||||
{
|
||||
DISPLAY_CLEAR;
|
||||
DISPLAY_SET_INCREMENT;
|
||||
|
||||
display_write_data_seq("Temperature");
|
||||
display_write_data_seq("DNI Temperature");
|
||||
|
||||
uint32_t value = external_temp_read();
|
||||
int temp = external_temp_convert_to_celsius(value);
|
||||
external_temp_print_celsius(temp);
|
||||
uint32_t value = DNI_read();
|
||||
int temp = DNI_convert_to_celsius(value);
|
||||
DNI_print_celsius(temp);
|
||||
}
|
||||
|
||||
void external_temp_show_fahrenheit(void)
|
||||
void DNI_show_fahrenheit(void)
|
||||
{
|
||||
DISPLAY_CLEAR;
|
||||
DISPLAY_SET_INCREMENT;
|
||||
|
||||
display_write_data_seq("Temperature");
|
||||
display_write_data_seq("DNI Temperature");
|
||||
|
||||
uint32_t value = external_temp_read();
|
||||
int temp = external_temp_convert_to_fahrenheit(value);
|
||||
external_temp_print_fahrenheit(temp);
|
||||
uint32_t value = DNI_read();
|
||||
int temp = DNI_convert_to_fahrenheit(value);
|
||||
DNI_print_fahrenheit(temp);
|
||||
}
|
||||
166
Core/Src/LIS302DL.c
Normal file
166
Core/Src/LIS302DL.c
Normal file
@@ -0,0 +1,166 @@
|
||||
#include "main.h"
|
||||
#include "lcd.h"
|
||||
#include "LIS302DL.h"
|
||||
|
||||
#define FAILSAFE_PRE_OP for (size_t t = 0; t < 5; t++) {
|
||||
#define FAILSAFE_POST_OP(prefix) if (op_result) print_error_message(op_result, err_count, t, prefix, postfix); else break; }
|
||||
|
||||
extern I2C_HandleTypeDef hi2c1;
|
||||
|
||||
static char convert_char_at(uint8_t value, size_t position)
|
||||
{
|
||||
char d = (value >> (4 * position)) % 16;
|
||||
|
||||
if (d > 9)
|
||||
d += 7;
|
||||
|
||||
return '0' + d;
|
||||
}
|
||||
|
||||
static void print_at(uint8_t value, size_t offset)
|
||||
{
|
||||
DISPLAY_SET_CURSOR(1, offset);
|
||||
|
||||
// most significant digit
|
||||
display_write_data_byte(convert_char_at(value, 1));
|
||||
|
||||
// least significant digit
|
||||
display_write_data_byte(convert_char_at(value, 0));
|
||||
}
|
||||
|
||||
static void print_error_message(HAL_StatusTypeDef result, size_t *err_count, size_t t, char *prefix, char *postfix)
|
||||
{
|
||||
DISPLAY_CLEAR;
|
||||
display_write_data_seq("LIS302DL Accel ");
|
||||
display_write_data_seq(postfix);
|
||||
DISPLAY_SET_CURSOR(1, 0);
|
||||
display_write_data_seq(prefix);
|
||||
display_write_data_byte(' ');
|
||||
|
||||
(*err_count)++;
|
||||
|
||||
display_write_data_byte('1' + t);
|
||||
display_write_data_seq("/5 ");
|
||||
|
||||
switch (result) {
|
||||
case HAL_OK:
|
||||
break;
|
||||
case HAL_ERROR:
|
||||
display_write_data_seq("ERROR");
|
||||
break;
|
||||
case HAL_BUSY:
|
||||
display_write_data_seq("BUSY");
|
||||
break;
|
||||
case HAL_TIMEOUT:
|
||||
display_write_data_seq("TIMEOUT");
|
||||
break;
|
||||
}
|
||||
|
||||
HAL_Delay(2000);
|
||||
}
|
||||
|
||||
static void retrieve_data(size_t *err_count, uint8_t *data_xyz, char *postfix)
|
||||
{
|
||||
HAL_StatusTypeDef op_result;
|
||||
uint8_t data_buffer[2];
|
||||
|
||||
// enable device
|
||||
data_buffer[0] = 0x20;
|
||||
data_buffer[1] = 0x47;
|
||||
FAILSAFE_PRE_OP;
|
||||
op_result = HAL_I2C_Master_Transmit(&hi2c1, 0xD6, data_buffer, 2, 2000);
|
||||
FAILSAFE_POST_OP("E");
|
||||
|
||||
// select OutX register
|
||||
data_buffer[0] = 0x29;
|
||||
FAILSAFE_PRE_OP;
|
||||
op_result = HAL_I2C_Master_Transmit(&hi2c1, 0xD6 | 0x1, data_buffer, 1, 2000);
|
||||
FAILSAFE_POST_OP("SX");
|
||||
|
||||
// receive data from it
|
||||
FAILSAFE_PRE_OP;
|
||||
op_result = HAL_I2C_Master_Receive(&hi2c1, 0xD6 | 0x1, data_xyz, 1, 2000);
|
||||
FAILSAFE_POST_OP("RX");
|
||||
|
||||
// select OutY register
|
||||
data_buffer[0] = 0x2B;
|
||||
FAILSAFE_PRE_OP;
|
||||
op_result = HAL_I2C_Master_Transmit(&hi2c1, 0xD6 | 0x1, data_buffer, 1, 2000);
|
||||
FAILSAFE_POST_OP("SY");
|
||||
|
||||
// receive data from it
|
||||
FAILSAFE_PRE_OP;
|
||||
op_result = HAL_I2C_Master_Receive(&hi2c1, 0xD6 | 0x1, &(data_xyz[1]), 1, 2000);
|
||||
FAILSAFE_POST_OP("RY");
|
||||
|
||||
// select OutZ register
|
||||
data_buffer[0] = 0x2D;
|
||||
FAILSAFE_PRE_OP;
|
||||
op_result = HAL_I2C_Master_Transmit(&hi2c1, 0xD6 | 0x1, data_buffer, 1, 2000);
|
||||
FAILSAFE_POST_OP("SZ");
|
||||
|
||||
// receive data from it
|
||||
FAILSAFE_PRE_OP;
|
||||
op_result = HAL_I2C_Master_Receive(&hi2c1, 0xD6 | 0x1, &(data_xyz[2]), 1, 2000);
|
||||
FAILSAFE_POST_OP("RZ");
|
||||
}
|
||||
|
||||
void LIS302DL_run_test(void)
|
||||
{
|
||||
DISPLAY_CLEAR;
|
||||
display_write_data_seq("LIS302DL Accel");
|
||||
|
||||
size_t err_count = 0;
|
||||
uint8_t data_xyz[3];
|
||||
|
||||
retrieve_data(&err_count, data_xyz, "");
|
||||
|
||||
DISPLAY_CLEAR;
|
||||
display_write_data_seq("LIS302DL Accel");
|
||||
|
||||
// output retrieved values
|
||||
print_at(data_xyz[2], 14);
|
||||
print_at(data_xyz[1], 11);
|
||||
print_at(data_xyz[0], 8);
|
||||
|
||||
// print the execution stats
|
||||
if (err_count) {
|
||||
DISPLAY_SET_CURSOR(1, 0);
|
||||
display_write_data_byte('0' + err_count / 10 % 10);
|
||||
display_write_data_byte('0' + err_count % 10);
|
||||
display_write_data_seq(" errs");
|
||||
} else {
|
||||
DISPLAY_SET_CURSOR(1, 1);
|
||||
display_write_data_seq("OK");
|
||||
}
|
||||
}
|
||||
|
||||
void LIS302DL_run_test_dynamic(void)
|
||||
{
|
||||
DISPLAY_CLEAR;
|
||||
display_write_data_seq("LIS302DL Accel D");
|
||||
|
||||
size_t err_count = 0;
|
||||
uint8_t data_xyz[3];
|
||||
|
||||
retrieve_data(&err_count, data_xyz, "D");
|
||||
|
||||
DISPLAY_CLEAR;
|
||||
display_write_data_seq("LIS302DL Accel D");
|
||||
|
||||
// output retrieved values
|
||||
print_at(data_xyz[2], 14);
|
||||
print_at(data_xyz[1], 11);
|
||||
print_at(data_xyz[0], 8);
|
||||
|
||||
// print the execution stats
|
||||
if (err_count) {
|
||||
DISPLAY_SET_CURSOR(1, 0);
|
||||
display_write_data_byte('0' + err_count / 10 % 10);
|
||||
display_write_data_byte('0' + err_count % 10);
|
||||
display_write_data_seq(" errs");
|
||||
} else {
|
||||
DISPLAY_SET_CURSOR(1, 1);
|
||||
display_write_data_seq("OK");
|
||||
}
|
||||
}
|
||||
131
Core/Src/LSM9DS1.c
Normal file
131
Core/Src/LSM9DS1.c
Normal file
@@ -0,0 +1,131 @@
|
||||
#include "main.h"
|
||||
#include "LSM9DS1.h"
|
||||
#include "lcd.h"
|
||||
|
||||
#define FAILSAFE_PRE_OP for (size_t t = 0; t < 5; t++) {
|
||||
#define FAILSAFE_POST_OP_ACCEL(prefix) if (op_result) print_error_accel(op_result, &err_count, t, prefix); else break; }
|
||||
#define FAILSAFE_POST_OP_MAGNET(prefix) if (op_result) print_error_magnet(op_result, &err_count, t, prefix); else break; }
|
||||
|
||||
extern I2C_HandleTypeDef hi2c1;
|
||||
|
||||
static void print_error_message(HAL_StatusTypeDef result, size_t *err_count, size_t t, char *prefix)
|
||||
{
|
||||
DISPLAY_SET_CURSOR(1, 0);
|
||||
display_write_data_seq(prefix);
|
||||
display_write_data_byte(' ');
|
||||
|
||||
(*err_count)++;
|
||||
|
||||
display_write_data_byte('1' + t);
|
||||
display_write_data_seq("/5 ");
|
||||
|
||||
switch (result) {
|
||||
case HAL_OK:
|
||||
break;
|
||||
case HAL_ERROR:
|
||||
display_write_data_seq("ERROR");
|
||||
break;
|
||||
case HAL_BUSY:
|
||||
display_write_data_seq("BUSY");
|
||||
break;
|
||||
case HAL_TIMEOUT:
|
||||
display_write_data_seq("TIMEOUT");
|
||||
break;
|
||||
}
|
||||
|
||||
HAL_Delay(1000);
|
||||
}
|
||||
|
||||
static void print_error_accel(HAL_StatusTypeDef result, size_t *err_count, size_t t, char *prefix)
|
||||
{
|
||||
DISPLAY_CLEAR;
|
||||
display_write_data_seq("LSM9DS1 Accel");
|
||||
|
||||
print_error_message(result, err_count, t, prefix);
|
||||
}
|
||||
|
||||
static void print_error_magnet(HAL_StatusTypeDef result, size_t *err_count, size_t t, char *prefix)
|
||||
{
|
||||
DISPLAY_CLEAR;
|
||||
display_write_data_seq("LSM9DS1 Magnet");
|
||||
|
||||
print_error_message(result, err_count, t, prefix);
|
||||
}
|
||||
|
||||
void LSM9DS1_test_accel(void)
|
||||
{
|
||||
DISPLAY_CLEAR;
|
||||
display_write_data_seq("LSM9DS1 Accel");
|
||||
|
||||
HAL_StatusTypeDef op_result;
|
||||
uint8_t buffer[6];
|
||||
size_t err_count = 0;
|
||||
|
||||
// enable sampling at 10 Hz
|
||||
buffer[0] = 0x20;
|
||||
buffer[1] = 0x20;
|
||||
FAILSAFE_PRE_OP;
|
||||
op_result = HAL_I2C_Master_Transmit(&hi2c1, 0xD6, buffer, 2, 1000);
|
||||
FAILSAFE_POST_OP_ACCEL("E");
|
||||
|
||||
HAL_Delay(100);
|
||||
|
||||
// set future read address
|
||||
buffer[0] = 0x28;
|
||||
FAILSAFE_PRE_OP;
|
||||
op_result = HAL_I2C_Master_Transmit(&hi2c1, 0xD6, buffer, 1, 1000);
|
||||
FAILSAFE_POST_OP_ACCEL("A");
|
||||
|
||||
// read from registers sequentially
|
||||
FAILSAFE_PRE_OP;
|
||||
op_result = HAL_I2C_Master_Receive(&hi2c1, 0xD7, buffer, 6, 1000);
|
||||
FAILSAFE_POST_OP_ACCEL("R");
|
||||
|
||||
if (!err_count) {
|
||||
DISPLAY_SET_CURSOR(1, 1);
|
||||
display_write_data_seq("OK");
|
||||
} else {
|
||||
DISPLAY_SET_CURSOR(1, 0);
|
||||
display_write_data_byte('0' + ((err_count / 10) % 10));
|
||||
display_write_data_byte('0' + (err_count % 10));
|
||||
display_write_data_seq(" errors");
|
||||
}
|
||||
}
|
||||
|
||||
void LSM9DS1_cleanup_accel(void)
|
||||
{
|
||||
// power down the accelerometer
|
||||
uint8_t buffer[2] = {0x20, 0x00};
|
||||
HAL_I2C_Master_Transmit(&hi2c1, 0xD6, buffer, 2, 1000);
|
||||
}
|
||||
|
||||
void LSM9DS1_test_magnet(void)
|
||||
{
|
||||
DISPLAY_CLEAR;
|
||||
display_write_data_seq("LSM9DS1 Magnet");
|
||||
|
||||
HAL_StatusTypeDef op_result;
|
||||
uint8_t buffer[6];
|
||||
size_t err_count = 0;
|
||||
|
||||
// set future read address
|
||||
buffer[0] = 0x28;
|
||||
FAILSAFE_PRE_OP;
|
||||
op_result = HAL_I2C_Master_Transmit(&hi2c1, 0x3C, buffer, 1, 1000);
|
||||
FAILSAFE_POST_OP_MAGNET("A");
|
||||
|
||||
// read from registers sequentially
|
||||
FAILSAFE_PRE_OP;
|
||||
op_result = HAL_I2C_Master_Receive(&hi2c1, 0x3D, buffer, 6, 1000);
|
||||
FAILSAFE_POST_OP_MAGNET("R");
|
||||
|
||||
if (!err_count) {
|
||||
DISPLAY_SET_CURSOR(1, 1);
|
||||
display_write_data_seq("OK");
|
||||
} else {
|
||||
DISPLAY_SET_CURSOR(1, 0);
|
||||
display_write_data_byte('0' + ((err_count / 10) % 10));
|
||||
display_write_data_byte('0' + (err_count % 10));
|
||||
display_write_data_seq(" errors");
|
||||
}
|
||||
}
|
||||
53
Core/Src/MP45DT02.c
Normal file
53
Core/Src/MP45DT02.c
Normal file
@@ -0,0 +1,53 @@
|
||||
#include "main.h"
|
||||
#include "MP45DT02.h"
|
||||
#include "lcd.h"
|
||||
|
||||
#define SAMPLE_AMOUNT 256
|
||||
|
||||
extern I2S_HandleTypeDef hi2s2;
|
||||
|
||||
void MP45DT02_run_test(void)
|
||||
{
|
||||
DISPLAY_CLEAR;
|
||||
display_write_data_seq("MP45DT02 Mic");
|
||||
|
||||
uint16_t sample_buffer[SAMPLE_AMOUNT];
|
||||
|
||||
for (size_t t = 0; t < 5; t++) {
|
||||
HAL_I2S_Receive(&hi2s2, sample_buffer, SAMPLE_AMOUNT, 1000);
|
||||
|
||||
for (size_t i = 0; i < SAMPLE_AMOUNT / 2; i++)
|
||||
if (((uint32_t *) sample_buffer)[i]) {
|
||||
DISPLAY_CLEAR;
|
||||
display_write_data_seq("MP45DT02 Mic");
|
||||
|
||||
if (!t) {
|
||||
DISPLAY_SET_CURSOR(1, 1);
|
||||
display_write_data_seq("OK");
|
||||
} else {
|
||||
DISPLAY_SET_CURSOR(1, 0);
|
||||
display_write_data_byte('0' + t);
|
||||
display_write_data_seq(" full 0 samples");
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// if ended up here, then no samples equaled to 1; that is not a good sign
|
||||
DISPLAY_CLEAR;
|
||||
display_write_data_seq("MP45DT02 Mic");
|
||||
|
||||
DISPLAY_SET_CURSOR(1, 0);
|
||||
display_write_data_byte('1' + t);
|
||||
display_write_data_seq("/5: no 1 sampled");
|
||||
|
||||
HAL_Delay(1000);
|
||||
}
|
||||
|
||||
// t = 5, not a single 1 was recorded; microphone might be broken
|
||||
DISPLAY_CLEAR;
|
||||
display_write_data_seq("MP45DT02 Mic");
|
||||
|
||||
DISPLAY_SET_CURSOR(1, 0);
|
||||
display_write_data_seq("No good samples!");
|
||||
}
|
||||
@@ -40,6 +40,8 @@ void PCA9685_run_test(void)
|
||||
display_write_data_seq("/5 ");
|
||||
|
||||
switch (op_result) {
|
||||
case HAL_OK:
|
||||
break;
|
||||
case HAL_ERROR:
|
||||
display_write_data_seq("ERROR");
|
||||
break;
|
||||
@@ -68,7 +70,7 @@ void PCA9685_run_test(void)
|
||||
display_write_data_seq(" errors");
|
||||
} else {
|
||||
DISPLAY_SET_CURSOR(1, 1);
|
||||
display_write_data_seq("OK");
|
||||
display_write_data_seq("OK OUT ENABLED");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
97
Core/Src/SST25VF016B.c
Normal file
97
Core/Src/SST25VF016B.c
Normal file
@@ -0,0 +1,97 @@
|
||||
#include "main.h"
|
||||
#include "lcd.h"
|
||||
#include "SST25VF016B.h"
|
||||
|
||||
extern SPI_HandleTypeDef hspi1;
|
||||
|
||||
void SST25VF016B_run_test(void)
|
||||
{
|
||||
DISPLAY_CLEAR;
|
||||
display_write_data_seq("SST25VF016B Flas");
|
||||
|
||||
HAL_StatusTypeDef op_result;
|
||||
size_t err_count = 0;
|
||||
|
||||
uint8_t tx_buffer[8] = {0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
uint8_t rx_buffer[9];
|
||||
rx_buffer[8] = '\0';
|
||||
|
||||
HAL_GPIO_WritePin(GPIOD, GPIO_PIN_7, GPIO_PIN_SET);
|
||||
HAL_Delay(50);
|
||||
HAL_GPIO_WritePin(GPIOD, GPIO_PIN_7, GPIO_PIN_RESET);
|
||||
|
||||
for (size_t t = 0; t < 5; t++) {
|
||||
op_result = HAL_SPI_TransmitReceive(&hspi1, tx_buffer, rx_buffer, 8, 2000);
|
||||
|
||||
if (op_result) {
|
||||
err_count++;
|
||||
|
||||
DISPLAY_CLEAR;
|
||||
display_write_data_seq("SST25VF016B Flas");
|
||||
|
||||
DISPLAY_SET_CURSOR(1, 0);
|
||||
display_write_data_byte('1' + t);
|
||||
display_write_data_seq("/5 ");
|
||||
|
||||
switch (op_result) {
|
||||
case HAL_OK:
|
||||
break;
|
||||
case HAL_ERROR:
|
||||
display_write_data_seq("ERROR");
|
||||
break;
|
||||
case HAL_BUSY:
|
||||
display_write_data_seq("BUSY");
|
||||
break;
|
||||
case HAL_TIMEOUT:
|
||||
display_write_data_seq("TIMEOUT");
|
||||
break;
|
||||
}
|
||||
|
||||
HAL_Delay(2000);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
HAL_GPIO_WritePin(GPIOD, GPIO_PIN_7, GPIO_PIN_SET);
|
||||
|
||||
DISPLAY_CLEAR;
|
||||
display_write_data_seq("SST25VF016B Flas");
|
||||
|
||||
if (err_count) {
|
||||
DISPLAY_SET_CURSOR(1, 1);
|
||||
display_write_data_byte('0' + err_count % 10);
|
||||
display_write_data_seq(" Errors");
|
||||
} else {
|
||||
for (size_t i = 0; i < 4; i += 2) {
|
||||
// odd reads MUST result in 0xBF
|
||||
if (rx_buffer[4+i] != 0xBF) {
|
||||
DISPLAY_SET_CURSOR(1, 0);
|
||||
display_write_data_byte('B');
|
||||
display_write_data_byte('1'+i);
|
||||
display_write_data_seq(" WRONG");
|
||||
goto write_retrieved_data;
|
||||
}
|
||||
}
|
||||
|
||||
for (size_t i = 1; i < 4; i += 2) {
|
||||
// even reads MUST result in 0x41
|
||||
if (rx_buffer[4+i] != 0x41) {
|
||||
DISPLAY_SET_CURSOR(1, 0);
|
||||
display_write_data_byte('B');
|
||||
display_write_data_byte('1'+i);
|
||||
display_write_data_seq(" WRONG");
|
||||
goto write_retrieved_data;
|
||||
}
|
||||
}
|
||||
|
||||
DISPLAY_SET_CURSOR(1, 1);
|
||||
display_write_data_seq("OK");
|
||||
}
|
||||
|
||||
write_retrieved_data:
|
||||
DISPLAY_SET_CURSOR(1, 12);
|
||||
display_write_data_seq((char *) &(rx_buffer[4]));
|
||||
|
||||
HAL_GPIO_WritePin(GPIOD, GPIO_PIN_7, GPIO_PIN_SET);
|
||||
}
|
||||
228
Core/Src/main.c
228
Core/Src/main.c
@@ -24,8 +24,15 @@
|
||||
|
||||
#include "generic_macros.h"
|
||||
#include "lcd.h"
|
||||
#include "external_temp.h"
|
||||
#include "DNI.h"
|
||||
#include "PCA9685.h"
|
||||
#include "24AA02E48.h"
|
||||
#include "CS43L22.h"
|
||||
#include "SST25VF016B.h"
|
||||
#include "LIS302DL.h"
|
||||
#include "DHT11.h"
|
||||
#include "MP45DT02.h"
|
||||
#include "LSM9DS1.h"
|
||||
|
||||
/* USER CODE END Includes */
|
||||
|
||||
@@ -52,23 +59,60 @@ ADC_HandleTypeDef hadc1;
|
||||
|
||||
I2C_HandleTypeDef hi2c1;
|
||||
|
||||
I2S_HandleTypeDef hi2s2;
|
||||
|
||||
SPI_HandleTypeDef hspi1;
|
||||
|
||||
TIM_HandleTypeDef htim2;
|
||||
|
||||
/* USER CODE BEGIN PV */
|
||||
|
||||
void ((*executors[])(void)) = {
|
||||
external_temp_show_celsius,
|
||||
external_temp_show_fahrenheit,
|
||||
PCA9685_run_test
|
||||
DNI_show_celsius,
|
||||
DNI_show_fahrenheit,
|
||||
PCA9685_run_test,
|
||||
EEPROM_24AA02E48_run_test,
|
||||
CS43L22_run_test,
|
||||
SST25VF016B_run_test,
|
||||
LIS302DL_run_test,
|
||||
LIS302DL_run_test_dynamic,
|
||||
MP45DT02_run_test,
|
||||
LSM9DS1_test_accel,
|
||||
LSM9DS1_test_magnet,
|
||||
DHT11_run_test
|
||||
};
|
||||
|
||||
void ((*cleanup_functions[])(void)) = {
|
||||
NULL,
|
||||
NULL,
|
||||
PCA9685_cleanup
|
||||
PCA9685_cleanup,
|
||||
NULL,
|
||||
CS43L22_cleanup,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
LSM9DS1_cleanup_accel,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
int delay_between_runs[] = {250, 250, -1};
|
||||
int delay_between_runs[] = {
|
||||
250,
|
||||
250,
|
||||
-1,
|
||||
-1,
|
||||
-1,
|
||||
-1,
|
||||
-1,
|
||||
200,
|
||||
-1,
|
||||
-1,
|
||||
-1,
|
||||
-1
|
||||
};
|
||||
|
||||
size_t current_executor_id = 0;
|
||||
size_t current_executor_id = 11;
|
||||
|
||||
size_t buttons_interrupt_enabled;
|
||||
|
||||
@@ -79,6 +123,9 @@ void SystemClock_Config(void);
|
||||
static void MX_GPIO_Init(void);
|
||||
static void MX_ADC1_Init(void);
|
||||
static void MX_I2C1_Init(void);
|
||||
static void MX_SPI1_Init(void);
|
||||
static void MX_TIM2_Init(void);
|
||||
static void MX_I2S2_Init(void);
|
||||
/* USER CODE BEGIN PFP */
|
||||
|
||||
/* USER CODE END PFP */
|
||||
@@ -86,6 +133,12 @@ static void MX_I2C1_Init(void);
|
||||
/* Private user code ---------------------------------------------------------*/
|
||||
/* USER CODE BEGIN 0 */
|
||||
|
||||
void switch_to_next_test(void)
|
||||
{
|
||||
current_executor_id += 1;
|
||||
current_executor_id %= 12;
|
||||
}
|
||||
|
||||
void buttons_switch_to_interrupt(void)
|
||||
{
|
||||
// save current executor ID
|
||||
@@ -206,12 +259,6 @@ void button_init_and_test(void)
|
||||
HAL_Delay(200);
|
||||
}
|
||||
|
||||
void switch_to_next_test(void)
|
||||
{
|
||||
current_executor_id += 1;
|
||||
current_executor_id %= 3;
|
||||
}
|
||||
|
||||
/* USER CODE END 0 */
|
||||
|
||||
/**
|
||||
@@ -245,9 +292,16 @@ int main(void)
|
||||
MX_GPIO_Init();
|
||||
MX_ADC1_Init();
|
||||
MX_I2C1_Init();
|
||||
MX_SPI1_Init();
|
||||
MX_TIM2_Init();
|
||||
MX_I2S2_Init();
|
||||
/* USER CODE BEGIN 2 */
|
||||
buttons_interrupt_enabled = 0;
|
||||
|
||||
HAL_TIM_Base_Start(&htim2);
|
||||
TIM2->CNT = 0;
|
||||
HAL_TIM_Base_Stop(&htim2);
|
||||
|
||||
GPIOD->ODR = 0x1000;
|
||||
display_init();
|
||||
|
||||
@@ -270,11 +324,11 @@ int main(void)
|
||||
if (delay_between_runs[current_executor_id] == -1) {
|
||||
WAIT_UNTIL_CB_PRESSED;
|
||||
HAL_Delay(150);
|
||||
GPIOD->ODR = 0x1000;
|
||||
GPIOD->BSRR = 0x1000;
|
||||
|
||||
WAIT_UNTIL_CB_RELEASED;
|
||||
HAL_Delay(150);
|
||||
GPIOD->ODR = 0x0000;
|
||||
GPIOD->BSRR = 0x1000 << 16;
|
||||
|
||||
if (cleanup_functions[current_executor_id])
|
||||
cleanup_functions[current_executor_id]();
|
||||
@@ -299,6 +353,14 @@ void SystemClock_Config(void)
|
||||
RCC_OscInitTypeDef RCC_OscInitStruct = {0};
|
||||
RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
|
||||
|
||||
/** Macro to configure the PLL multiplication factor
|
||||
*/
|
||||
__HAL_RCC_PLL_PLLM_CONFIG(16);
|
||||
|
||||
/** Macro to configure the PLL clock source
|
||||
*/
|
||||
__HAL_RCC_PLL_PLLSOURCE_CONFIG(RCC_PLLSOURCE_HSI);
|
||||
|
||||
/** Configure the main internal regulator output voltage
|
||||
*/
|
||||
__HAL_RCC_PWR_CLK_ENABLE();
|
||||
@@ -311,6 +373,7 @@ void SystemClock_Config(void)
|
||||
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
|
||||
RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;
|
||||
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE;
|
||||
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI;
|
||||
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
@@ -417,6 +480,123 @@ static void MX_I2C1_Init(void)
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief I2S2 Initialization Function
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
static void MX_I2S2_Init(void)
|
||||
{
|
||||
|
||||
/* USER CODE BEGIN I2S2_Init 0 */
|
||||
|
||||
/* USER CODE END I2S2_Init 0 */
|
||||
|
||||
/* USER CODE BEGIN I2S2_Init 1 */
|
||||
|
||||
/* USER CODE END I2S2_Init 1 */
|
||||
hi2s2.Instance = SPI2;
|
||||
hi2s2.Init.Mode = I2S_MODE_MASTER_RX;
|
||||
hi2s2.Init.Standard = I2S_STANDARD_PHILIPS;
|
||||
hi2s2.Init.DataFormat = I2S_DATAFORMAT_16B;
|
||||
hi2s2.Init.MCLKOutput = I2S_MCLKOUTPUT_DISABLE;
|
||||
hi2s2.Init.AudioFreq = I2S_AUDIOFREQ_48K;
|
||||
hi2s2.Init.CPOL = I2S_CPOL_LOW;
|
||||
hi2s2.Init.ClockSource = I2S_CLOCK_PLL;
|
||||
hi2s2.Init.FullDuplexMode = I2S_FULLDUPLEXMODE_DISABLE;
|
||||
if (HAL_I2S_Init(&hi2s2) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
/* USER CODE BEGIN I2S2_Init 2 */
|
||||
|
||||
/* USER CODE END I2S2_Init 2 */
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SPI1 Initialization Function
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
static void MX_SPI1_Init(void)
|
||||
{
|
||||
|
||||
/* USER CODE BEGIN SPI1_Init 0 */
|
||||
|
||||
/* USER CODE END SPI1_Init 0 */
|
||||
|
||||
/* USER CODE BEGIN SPI1_Init 1 */
|
||||
|
||||
/* USER CODE END SPI1_Init 1 */
|
||||
/* SPI1 parameter configuration*/
|
||||
hspi1.Instance = SPI1;
|
||||
hspi1.Init.Mode = SPI_MODE_MASTER;
|
||||
hspi1.Init.Direction = SPI_DIRECTION_2LINES;
|
||||
hspi1.Init.DataSize = SPI_DATASIZE_8BIT;
|
||||
hspi1.Init.CLKPolarity = SPI_POLARITY_LOW;
|
||||
hspi1.Init.CLKPhase = SPI_PHASE_1EDGE;
|
||||
hspi1.Init.NSS = SPI_NSS_SOFT;
|
||||
hspi1.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_16;
|
||||
hspi1.Init.FirstBit = SPI_FIRSTBIT_MSB;
|
||||
hspi1.Init.TIMode = SPI_TIMODE_DISABLE;
|
||||
hspi1.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLE;
|
||||
hspi1.Init.CRCPolynomial = 10;
|
||||
if (HAL_SPI_Init(&hspi1) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
/* USER CODE BEGIN SPI1_Init 2 */
|
||||
|
||||
/* USER CODE END SPI1_Init 2 */
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief TIM2 Initialization Function
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
static void MX_TIM2_Init(void)
|
||||
{
|
||||
|
||||
/* USER CODE BEGIN TIM2_Init 0 */
|
||||
|
||||
/* USER CODE END TIM2_Init 0 */
|
||||
|
||||
TIM_ClockConfigTypeDef sClockSourceConfig = {0};
|
||||
TIM_MasterConfigTypeDef sMasterConfig = {0};
|
||||
|
||||
/* USER CODE BEGIN TIM2_Init 1 */
|
||||
|
||||
/* USER CODE END TIM2_Init 1 */
|
||||
htim2.Instance = TIM2;
|
||||
htim2.Init.Prescaler = 0;
|
||||
htim2.Init.CounterMode = TIM_COUNTERMODE_UP;
|
||||
htim2.Init.Period = 0xffffffff;
|
||||
htim2.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
|
||||
htim2.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;
|
||||
if (HAL_TIM_Base_Init(&htim2) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
sClockSourceConfig.ClockSource = TIM_CLOCKSOURCE_INTERNAL;
|
||||
if (HAL_TIM_ConfigClockSource(&htim2, &sClockSourceConfig) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
sMasterConfig.MasterOutputTrigger = TIM_TRGO_RESET;
|
||||
sMasterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE;
|
||||
if (HAL_TIMEx_MasterConfigSynchronization(&htim2, &sMasterConfig) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
/* USER CODE BEGIN TIM2_Init 2 */
|
||||
|
||||
/* USER CODE END TIM2_Init 2 */
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief GPIO Initialization Function
|
||||
* @param None
|
||||
@@ -429,18 +609,19 @@ static void MX_GPIO_Init(void)
|
||||
/* USER CODE END MX_GPIO_Init_1 */
|
||||
|
||||
/* GPIO Ports Clock Enable */
|
||||
__HAL_RCC_GPIOC_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOA_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOB_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOE_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOD_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOC_CLK_ENABLE();
|
||||
|
||||
/*Configure GPIO pin Output Level */
|
||||
HAL_GPIO_WritePin(GPIOE, GPIO_PIN_7|GPIO_PIN_10|GPIO_PIN_11|GPIO_PIN_12
|
||||
|GPIO_PIN_13|GPIO_PIN_14|GPIO_PIN_15, GPIO_PIN_RESET);
|
||||
|
||||
/*Configure GPIO pin Output Level */
|
||||
HAL_GPIO_WritePin(GPIOD, GPIO_PIN_12|GPIO_PIN_13|GPIO_PIN_14|GPIO_PIN_15, GPIO_PIN_RESET);
|
||||
HAL_GPIO_WritePin(GPIOD, GPIO_PIN_11|GPIO_PIN_12|GPIO_PIN_13|GPIO_PIN_14
|
||||
|GPIO_PIN_15|GPIO_PIN_4|GPIO_PIN_7, GPIO_PIN_RESET);
|
||||
|
||||
/*Configure GPIO pin Output Level */
|
||||
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_7, GPIO_PIN_RESET);
|
||||
@@ -460,8 +641,17 @@ static void MX_GPIO_Init(void)
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||
HAL_GPIO_Init(GPIOE, &GPIO_InitStruct);
|
||||
|
||||
/*Configure GPIO pins : PD12 PD13 PD14 PD15 */
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_12|GPIO_PIN_13|GPIO_PIN_14|GPIO_PIN_15;
|
||||
/*Configure GPIO pin : PD11 */
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_11;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||
HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
|
||||
|
||||
/*Configure GPIO pins : PD12 PD13 PD14 PD15
|
||||
PD4 PD7 */
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_12|GPIO_PIN_13|GPIO_PIN_14|GPIO_PIN_15
|
||||
|GPIO_PIN_4|GPIO_PIN_7;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||
|
||||
@@ -208,6 +208,219 @@ void HAL_I2C_MspDeInit(I2C_HandleTypeDef* hi2c)
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief I2S MSP Initialization
|
||||
* This function configures the hardware resources used in this example
|
||||
* @param hi2s: I2S handle pointer
|
||||
* @retval None
|
||||
*/
|
||||
void HAL_I2S_MspInit(I2S_HandleTypeDef* hi2s)
|
||||
{
|
||||
GPIO_InitTypeDef GPIO_InitStruct = {0};
|
||||
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0};
|
||||
if(hi2s->Instance==SPI2)
|
||||
{
|
||||
/* USER CODE BEGIN SPI2_MspInit 0 */
|
||||
|
||||
/* USER CODE END SPI2_MspInit 0 */
|
||||
|
||||
/** Initializes the peripherals clock
|
||||
*/
|
||||
PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_I2S;
|
||||
PeriphClkInitStruct.PLLI2S.PLLI2SN = 192;
|
||||
PeriphClkInitStruct.PLLI2S.PLLI2SR = 2;
|
||||
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
|
||||
/* Peripheral clock enable */
|
||||
__HAL_RCC_SPI2_CLK_ENABLE();
|
||||
|
||||
__HAL_RCC_GPIOC_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOB_CLK_ENABLE();
|
||||
/**I2S2 GPIO Configuration
|
||||
PC3 ------> I2S2_SD
|
||||
PB10 ------> I2S2_CK
|
||||
PB12 ------> I2S2_WS
|
||||
*/
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_3;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||
GPIO_InitStruct.Alternate = GPIO_AF5_SPI2;
|
||||
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
|
||||
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_10|GPIO_PIN_12;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||
GPIO_InitStruct.Alternate = GPIO_AF5_SPI2;
|
||||
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
||||
|
||||
/* USER CODE BEGIN SPI2_MspInit 1 */
|
||||
|
||||
/* USER CODE END SPI2_MspInit 1 */
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief I2S MSP De-Initialization
|
||||
* This function freeze the hardware resources used in this example
|
||||
* @param hi2s: I2S handle pointer
|
||||
* @retval None
|
||||
*/
|
||||
void HAL_I2S_MspDeInit(I2S_HandleTypeDef* hi2s)
|
||||
{
|
||||
if(hi2s->Instance==SPI2)
|
||||
{
|
||||
/* USER CODE BEGIN SPI2_MspDeInit 0 */
|
||||
|
||||
/* USER CODE END SPI2_MspDeInit 0 */
|
||||
/* Peripheral clock disable */
|
||||
__HAL_RCC_SPI2_CLK_DISABLE();
|
||||
|
||||
/**I2S2 GPIO Configuration
|
||||
PC3 ------> I2S2_SD
|
||||
PB10 ------> I2S2_CK
|
||||
PB12 ------> I2S2_WS
|
||||
*/
|
||||
HAL_GPIO_DeInit(GPIOC, GPIO_PIN_3);
|
||||
|
||||
HAL_GPIO_DeInit(GPIOB, GPIO_PIN_10|GPIO_PIN_12);
|
||||
|
||||
/* USER CODE BEGIN SPI2_MspDeInit 1 */
|
||||
|
||||
/* USER CODE END SPI2_MspDeInit 1 */
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SPI MSP Initialization
|
||||
* This function configures the hardware resources used in this example
|
||||
* @param hspi: SPI handle pointer
|
||||
* @retval None
|
||||
*/
|
||||
void HAL_SPI_MspInit(SPI_HandleTypeDef* hspi)
|
||||
{
|
||||
GPIO_InitTypeDef GPIO_InitStruct = {0};
|
||||
if(hspi->Instance==SPI1)
|
||||
{
|
||||
/* USER CODE BEGIN SPI1_MspInit 0 */
|
||||
|
||||
/* USER CODE END SPI1_MspInit 0 */
|
||||
/* Peripheral clock enable */
|
||||
__HAL_RCC_SPI1_CLK_ENABLE();
|
||||
|
||||
__HAL_RCC_GPIOA_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOB_CLK_ENABLE();
|
||||
/**SPI1 GPIO Configuration
|
||||
PA5 ------> SPI1_SCK
|
||||
PB4 ------> SPI1_MISO
|
||||
PB5 ------> SPI1_MOSI
|
||||
*/
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_5;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||
GPIO_InitStruct.Alternate = GPIO_AF5_SPI1;
|
||||
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
||||
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_4|GPIO_PIN_5;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||
GPIO_InitStruct.Alternate = GPIO_AF5_SPI1;
|
||||
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
||||
|
||||
/* USER CODE BEGIN SPI1_MspInit 1 */
|
||||
|
||||
/* USER CODE END SPI1_MspInit 1 */
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SPI MSP De-Initialization
|
||||
* This function freeze the hardware resources used in this example
|
||||
* @param hspi: SPI handle pointer
|
||||
* @retval None
|
||||
*/
|
||||
void HAL_SPI_MspDeInit(SPI_HandleTypeDef* hspi)
|
||||
{
|
||||
if(hspi->Instance==SPI1)
|
||||
{
|
||||
/* USER CODE BEGIN SPI1_MspDeInit 0 */
|
||||
|
||||
/* USER CODE END SPI1_MspDeInit 0 */
|
||||
/* Peripheral clock disable */
|
||||
__HAL_RCC_SPI1_CLK_DISABLE();
|
||||
|
||||
/**SPI1 GPIO Configuration
|
||||
PA5 ------> SPI1_SCK
|
||||
PB4 ------> SPI1_MISO
|
||||
PB5 ------> SPI1_MOSI
|
||||
*/
|
||||
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_5);
|
||||
|
||||
HAL_GPIO_DeInit(GPIOB, GPIO_PIN_4|GPIO_PIN_5);
|
||||
|
||||
/* USER CODE BEGIN SPI1_MspDeInit 1 */
|
||||
|
||||
/* USER CODE END SPI1_MspDeInit 1 */
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief TIM_Base MSP Initialization
|
||||
* This function configures the hardware resources used in this example
|
||||
* @param htim_base: TIM_Base handle pointer
|
||||
* @retval None
|
||||
*/
|
||||
void HAL_TIM_Base_MspInit(TIM_HandleTypeDef* htim_base)
|
||||
{
|
||||
if(htim_base->Instance==TIM2)
|
||||
{
|
||||
/* USER CODE BEGIN TIM2_MspInit 0 */
|
||||
|
||||
/* USER CODE END TIM2_MspInit 0 */
|
||||
/* Peripheral clock enable */
|
||||
__HAL_RCC_TIM2_CLK_ENABLE();
|
||||
/* USER CODE BEGIN TIM2_MspInit 1 */
|
||||
|
||||
/* USER CODE END TIM2_MspInit 1 */
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief TIM_Base MSP De-Initialization
|
||||
* This function freeze the hardware resources used in this example
|
||||
* @param htim_base: TIM_Base handle pointer
|
||||
* @retval None
|
||||
*/
|
||||
void HAL_TIM_Base_MspDeInit(TIM_HandleTypeDef* htim_base)
|
||||
{
|
||||
if(htim_base->Instance==TIM2)
|
||||
{
|
||||
/* USER CODE BEGIN TIM2_MspDeInit 0 */
|
||||
|
||||
/* USER CODE END TIM2_MspDeInit 0 */
|
||||
/* Peripheral clock disable */
|
||||
__HAL_RCC_TIM2_CLK_DISABLE();
|
||||
/* USER CODE BEGIN TIM2_MspDeInit 1 */
|
||||
|
||||
/* USER CODE END TIM2_MspDeInit 1 */
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* USER CODE BEGIN 1 */
|
||||
|
||||
/* USER CODE END 1 */
|
||||
|
||||
@@ -5,8 +5,15 @@
|
||||
|
||||
# Add inputs and outputs from these tool invocations to the build variables
|
||||
C_SRCS += \
|
||||
../Core/Src/24AA02E48.c \
|
||||
../Core/Src/CS43L22.c \
|
||||
../Core/Src/DHT11.c \
|
||||
../Core/Src/DNI.c \
|
||||
../Core/Src/LIS302DL.c \
|
||||
../Core/Src/LSM9DS1.c \
|
||||
../Core/Src/MP45DT02.c \
|
||||
../Core/Src/PCA9685.c \
|
||||
../Core/Src/external_temp.c \
|
||||
../Core/Src/SST25VF016B.c \
|
||||
../Core/Src/lcd.c \
|
||||
../Core/Src/main.c \
|
||||
../Core/Src/stm32f4xx_hal_msp.c \
|
||||
@@ -16,8 +23,15 @@ C_SRCS += \
|
||||
../Core/Src/system_stm32f4xx.c
|
||||
|
||||
OBJS += \
|
||||
./Core/Src/24AA02E48.o \
|
||||
./Core/Src/CS43L22.o \
|
||||
./Core/Src/DHT11.o \
|
||||
./Core/Src/DNI.o \
|
||||
./Core/Src/LIS302DL.o \
|
||||
./Core/Src/LSM9DS1.o \
|
||||
./Core/Src/MP45DT02.o \
|
||||
./Core/Src/PCA9685.o \
|
||||
./Core/Src/external_temp.o \
|
||||
./Core/Src/SST25VF016B.o \
|
||||
./Core/Src/lcd.o \
|
||||
./Core/Src/main.o \
|
||||
./Core/Src/stm32f4xx_hal_msp.o \
|
||||
@@ -27,8 +41,15 @@ OBJS += \
|
||||
./Core/Src/system_stm32f4xx.o
|
||||
|
||||
C_DEPS += \
|
||||
./Core/Src/24AA02E48.d \
|
||||
./Core/Src/CS43L22.d \
|
||||
./Core/Src/DHT11.d \
|
||||
./Core/Src/DNI.d \
|
||||
./Core/Src/LIS302DL.d \
|
||||
./Core/Src/LSM9DS1.d \
|
||||
./Core/Src/MP45DT02.d \
|
||||
./Core/Src/PCA9685.d \
|
||||
./Core/Src/external_temp.d \
|
||||
./Core/Src/SST25VF016B.d \
|
||||
./Core/Src/lcd.d \
|
||||
./Core/Src/main.d \
|
||||
./Core/Src/stm32f4xx_hal_msp.d \
|
||||
@@ -45,7 +66,7 @@ Core/Src/%.o Core/Src/%.su Core/Src/%.cyclo: ../Core/Src/%.c Core/Src/subdir.mk
|
||||
clean: clean-Core-2f-Src
|
||||
|
||||
clean-Core-2f-Src:
|
||||
-$(RM) ./Core/Src/PCA9685.cyclo ./Core/Src/PCA9685.d ./Core/Src/PCA9685.o ./Core/Src/PCA9685.su ./Core/Src/external_temp.cyclo ./Core/Src/external_temp.d ./Core/Src/external_temp.o ./Core/Src/external_temp.su ./Core/Src/lcd.cyclo ./Core/Src/lcd.d ./Core/Src/lcd.o ./Core/Src/lcd.su ./Core/Src/main.cyclo ./Core/Src/main.d ./Core/Src/main.o ./Core/Src/main.su ./Core/Src/stm32f4xx_hal_msp.cyclo ./Core/Src/stm32f4xx_hal_msp.d ./Core/Src/stm32f4xx_hal_msp.o ./Core/Src/stm32f4xx_hal_msp.su ./Core/Src/stm32f4xx_it.cyclo ./Core/Src/stm32f4xx_it.d ./Core/Src/stm32f4xx_it.o ./Core/Src/stm32f4xx_it.su ./Core/Src/syscalls.cyclo ./Core/Src/syscalls.d ./Core/Src/syscalls.o ./Core/Src/syscalls.su ./Core/Src/sysmem.cyclo ./Core/Src/sysmem.d ./Core/Src/sysmem.o ./Core/Src/sysmem.su ./Core/Src/system_stm32f4xx.cyclo ./Core/Src/system_stm32f4xx.d ./Core/Src/system_stm32f4xx.o ./Core/Src/system_stm32f4xx.su
|
||||
-$(RM) ./Core/Src/24AA02E48.cyclo ./Core/Src/24AA02E48.d ./Core/Src/24AA02E48.o ./Core/Src/24AA02E48.su ./Core/Src/CS43L22.cyclo ./Core/Src/CS43L22.d ./Core/Src/CS43L22.o ./Core/Src/CS43L22.su ./Core/Src/DHT11.cyclo ./Core/Src/DHT11.d ./Core/Src/DHT11.o ./Core/Src/DHT11.su ./Core/Src/DNI.cyclo ./Core/Src/DNI.d ./Core/Src/DNI.o ./Core/Src/DNI.su ./Core/Src/LIS302DL.cyclo ./Core/Src/LIS302DL.d ./Core/Src/LIS302DL.o ./Core/Src/LIS302DL.su ./Core/Src/LSM9DS1.cyclo ./Core/Src/LSM9DS1.d ./Core/Src/LSM9DS1.o ./Core/Src/LSM9DS1.su ./Core/Src/MP45DT02.cyclo ./Core/Src/MP45DT02.d ./Core/Src/MP45DT02.o ./Core/Src/MP45DT02.su ./Core/Src/PCA9685.cyclo ./Core/Src/PCA9685.d ./Core/Src/PCA9685.o ./Core/Src/PCA9685.su ./Core/Src/SST25VF016B.cyclo ./Core/Src/SST25VF016B.d ./Core/Src/SST25VF016B.o ./Core/Src/SST25VF016B.su ./Core/Src/lcd.cyclo ./Core/Src/lcd.d ./Core/Src/lcd.o ./Core/Src/lcd.su ./Core/Src/main.cyclo ./Core/Src/main.d ./Core/Src/main.o ./Core/Src/main.su ./Core/Src/stm32f4xx_hal_msp.cyclo ./Core/Src/stm32f4xx_hal_msp.d ./Core/Src/stm32f4xx_hal_msp.o ./Core/Src/stm32f4xx_hal_msp.su ./Core/Src/stm32f4xx_it.cyclo ./Core/Src/stm32f4xx_it.d ./Core/Src/stm32f4xx_it.o ./Core/Src/stm32f4xx_it.su ./Core/Src/syscalls.cyclo ./Core/Src/syscalls.d ./Core/Src/syscalls.o ./Core/Src/syscalls.su ./Core/Src/sysmem.cyclo ./Core/Src/sysmem.d ./Core/Src/sysmem.o ./Core/Src/sysmem.su ./Core/Src/system_stm32f4xx.cyclo ./Core/Src/system_stm32f4xx.d ./Core/Src/system_stm32f4xx.o ./Core/Src/system_stm32f4xx.su
|
||||
|
||||
.PHONY: clean-Core-2f-Src
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,4 +1,12 @@
|
||||
"./Core/Src/external_temp.o"
|
||||
"./Core/Src/24AA02E48.o"
|
||||
"./Core/Src/CS43L22.o"
|
||||
"./Core/Src/DHT11.o"
|
||||
"./Core/Src/DNI.o"
|
||||
"./Core/Src/LIS302DL.o"
|
||||
"./Core/Src/LSM9DS1.o"
|
||||
"./Core/Src/MP45DT02.o"
|
||||
"./Core/Src/PCA9685.o"
|
||||
"./Core/Src/SST25VF016B.o"
|
||||
"./Core/Src/lcd.o"
|
||||
"./Core/Src/main.o"
|
||||
"./Core/Src/stm32f4xx_hal_msp.o"
|
||||
@@ -18,10 +26,15 @@
|
||||
"./Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ex.o"
|
||||
"./Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ramfunc.o"
|
||||
"./Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_gpio.o"
|
||||
"./Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_i2c.o"
|
||||
"./Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_i2c_ex.o"
|
||||
"./Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_i2s.o"
|
||||
"./Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_i2s_ex.o"
|
||||
"./Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr.o"
|
||||
"./Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr_ex.o"
|
||||
"./Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc.o"
|
||||
"./Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc_ex.o"
|
||||
"./Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_spi.o"
|
||||
"./Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim.o"
|
||||
"./Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim_ex.o"
|
||||
"./Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_adc.o"
|
||||
|
||||
618
Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_i2s.h
Normal file
618
Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_i2s.h
Normal file
@@ -0,0 +1,618 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file stm32f4xx_hal_i2s.h
|
||||
* @author MCD Application Team
|
||||
* @brief Header file of I2S HAL module.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2016 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 STM32F4xx_HAL_I2S_H
|
||||
#define STM32F4xx_HAL_I2S_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32f4xx_hal_def.h"
|
||||
|
||||
/** @addtogroup STM32F4xx_HAL_Driver
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup I2S
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
/** @defgroup I2S_Exported_Types I2S Exported Types
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief I2S Init structure definition
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint32_t Mode; /*!< Specifies the I2S operating mode.
|
||||
This parameter can be a value of @ref I2S_Mode */
|
||||
|
||||
uint32_t Standard; /*!< Specifies the standard used for the I2S communication.
|
||||
This parameter can be a value of @ref I2S_Standard */
|
||||
|
||||
uint32_t DataFormat; /*!< Specifies the data format for the I2S communication.
|
||||
This parameter can be a value of @ref I2S_Data_Format */
|
||||
|
||||
uint32_t MCLKOutput; /*!< Specifies whether the I2S MCLK output is enabled or not.
|
||||
This parameter can be a value of @ref I2S_MCLK_Output */
|
||||
|
||||
uint32_t AudioFreq; /*!< Specifies the frequency selected for the I2S communication.
|
||||
This parameter can be a value of @ref I2S_Audio_Frequency */
|
||||
|
||||
uint32_t CPOL; /*!< Specifies the idle state of the I2S clock.
|
||||
This parameter can be a value of @ref I2S_Clock_Polarity */
|
||||
|
||||
uint32_t ClockSource; /*!< Specifies the I2S Clock Source.
|
||||
This parameter can be a value of @ref I2S_Clock_Source */
|
||||
uint32_t FullDuplexMode; /*!< Specifies the I2S FullDuplex mode.
|
||||
This parameter can be a value of @ref I2S_FullDuplex_Mode */
|
||||
} I2S_InitTypeDef;
|
||||
|
||||
/**
|
||||
* @brief HAL State structures definition
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
HAL_I2S_STATE_RESET = 0x00U, /*!< I2S not yet initialized or disabled */
|
||||
HAL_I2S_STATE_READY = 0x01U, /*!< I2S initialized and ready for use */
|
||||
HAL_I2S_STATE_BUSY = 0x02U, /*!< I2S internal process is ongoing */
|
||||
HAL_I2S_STATE_BUSY_TX = 0x03U, /*!< Data Transmission process is ongoing */
|
||||
HAL_I2S_STATE_BUSY_RX = 0x04U, /*!< Data Reception process is ongoing */
|
||||
HAL_I2S_STATE_BUSY_TX_RX = 0x05U, /*!< Data Transmission and Reception process is ongoing */
|
||||
HAL_I2S_STATE_TIMEOUT = 0x06U, /*!< I2S timeout state */
|
||||
HAL_I2S_STATE_ERROR = 0x07U /*!< I2S error state */
|
||||
} HAL_I2S_StateTypeDef;
|
||||
|
||||
/**
|
||||
* @brief I2S handle Structure definition
|
||||
*/
|
||||
typedef struct __I2S_HandleTypeDef
|
||||
{
|
||||
SPI_TypeDef *Instance; /*!< I2S registers base address */
|
||||
|
||||
I2S_InitTypeDef Init; /*!< I2S communication parameters */
|
||||
|
||||
uint16_t *pTxBuffPtr; /*!< Pointer to I2S Tx transfer buffer */
|
||||
|
||||
__IO uint16_t TxXferSize; /*!< I2S Tx transfer size */
|
||||
|
||||
__IO uint16_t TxXferCount; /*!< I2S Tx transfer Counter */
|
||||
|
||||
uint16_t *pRxBuffPtr; /*!< Pointer to I2S Rx transfer buffer */
|
||||
|
||||
__IO uint16_t RxXferSize; /*!< I2S Rx transfer size */
|
||||
|
||||
__IO uint16_t RxXferCount; /*!< I2S Rx transfer counter
|
||||
(This field is initialized at the
|
||||
same value as transfer size at the
|
||||
beginning of the transfer and
|
||||
decremented when a sample is received
|
||||
NbSamplesReceived = RxBufferSize-RxBufferCount) */
|
||||
void (*IrqHandlerISR)(struct __I2S_HandleTypeDef *hi2s); /*!< I2S function pointer on IrqHandler */
|
||||
|
||||
DMA_HandleTypeDef *hdmatx; /*!< I2S Tx DMA handle parameters */
|
||||
|
||||
DMA_HandleTypeDef *hdmarx; /*!< I2S Rx DMA handle parameters */
|
||||
|
||||
__IO HAL_LockTypeDef Lock; /*!< I2S locking object */
|
||||
|
||||
__IO HAL_I2S_StateTypeDef State; /*!< I2S communication state */
|
||||
|
||||
__IO uint32_t ErrorCode; /*!< I2S Error code
|
||||
This parameter can be a value of @ref I2S_Error */
|
||||
|
||||
#if (USE_HAL_I2S_REGISTER_CALLBACKS == 1U)
|
||||
void (* TxCpltCallback)(struct __I2S_HandleTypeDef *hi2s); /*!< I2S Tx Completed callback */
|
||||
void (* RxCpltCallback)(struct __I2S_HandleTypeDef *hi2s); /*!< I2S Rx Completed callback */
|
||||
void (* TxRxCpltCallback)(struct __I2S_HandleTypeDef *hi2s); /*!< I2S TxRx Completed callback */
|
||||
void (* TxHalfCpltCallback)(struct __I2S_HandleTypeDef *hi2s); /*!< I2S Tx Half Completed callback */
|
||||
void (* RxHalfCpltCallback)(struct __I2S_HandleTypeDef *hi2s); /*!< I2S Rx Half Completed callback */
|
||||
void (* TxRxHalfCpltCallback)(struct __I2S_HandleTypeDef *hi2s); /*!< I2S TxRx Half Completed callback */
|
||||
void (* ErrorCallback)(struct __I2S_HandleTypeDef *hi2s); /*!< I2S Error callback */
|
||||
void (* MspInitCallback)(struct __I2S_HandleTypeDef *hi2s); /*!< I2S Msp Init callback */
|
||||
void (* MspDeInitCallback)(struct __I2S_HandleTypeDef *hi2s); /*!< I2S Msp DeInit callback */
|
||||
|
||||
#endif /* USE_HAL_I2S_REGISTER_CALLBACKS */
|
||||
} I2S_HandleTypeDef;
|
||||
|
||||
#if (USE_HAL_I2S_REGISTER_CALLBACKS == 1U)
|
||||
/**
|
||||
* @brief HAL I2S Callback ID enumeration definition
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
HAL_I2S_TX_COMPLETE_CB_ID = 0x00U, /*!< I2S Tx Completed callback ID */
|
||||
HAL_I2S_RX_COMPLETE_CB_ID = 0x01U, /*!< I2S Rx Completed callback ID */
|
||||
HAL_I2S_TX_RX_COMPLETE_CB_ID = 0x02U, /*!< I2S TxRx Completed callback ID */
|
||||
HAL_I2S_TX_HALF_COMPLETE_CB_ID = 0x03U, /*!< I2S Tx Half Completed callback ID */
|
||||
HAL_I2S_RX_HALF_COMPLETE_CB_ID = 0x04U, /*!< I2S Rx Half Completed callback ID */
|
||||
HAL_I2S_TX_RX_HALF_COMPLETE_CB_ID = 0x05U, /*!< I2S TxRx Half Completed callback ID */
|
||||
HAL_I2S_ERROR_CB_ID = 0x06U, /*!< I2S Error callback ID */
|
||||
HAL_I2S_MSPINIT_CB_ID = 0x07U, /*!< I2S Msp Init callback ID */
|
||||
HAL_I2S_MSPDEINIT_CB_ID = 0x08U /*!< I2S Msp DeInit callback ID */
|
||||
|
||||
} HAL_I2S_CallbackIDTypeDef;
|
||||
|
||||
/**
|
||||
* @brief HAL I2S Callback pointer definition
|
||||
*/
|
||||
typedef void (*pI2S_CallbackTypeDef)(I2S_HandleTypeDef *hi2s); /*!< pointer to an I2S callback function */
|
||||
|
||||
#endif /* USE_HAL_I2S_REGISTER_CALLBACKS */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
/** @defgroup I2S_Exported_Constants I2S Exported Constants
|
||||
* @{
|
||||
*/
|
||||
/** @defgroup I2S_Error I2S Error
|
||||
* @{
|
||||
*/
|
||||
#define HAL_I2S_ERROR_NONE (0x00000000U) /*!< No error */
|
||||
#define HAL_I2S_ERROR_TIMEOUT (0x00000001U) /*!< Timeout error */
|
||||
#define HAL_I2S_ERROR_OVR (0x00000002U) /*!< OVR error */
|
||||
#define HAL_I2S_ERROR_UDR (0x00000004U) /*!< UDR error */
|
||||
#define HAL_I2S_ERROR_DMA (0x00000008U) /*!< DMA transfer error */
|
||||
#define HAL_I2S_ERROR_PRESCALER (0x00000010U) /*!< Prescaler Calculation error */
|
||||
#if (USE_HAL_I2S_REGISTER_CALLBACKS == 1U)
|
||||
#define HAL_I2S_ERROR_INVALID_CALLBACK (0x00000020U) /*!< Invalid Callback error */
|
||||
#endif /* USE_HAL_I2S_REGISTER_CALLBACKS */
|
||||
#define HAL_I2S_ERROR_BUSY_LINE_RX (0x00000040U) /*!< Busy Rx Line error */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup I2S_Mode I2S Mode
|
||||
* @{
|
||||
*/
|
||||
#define I2S_MODE_SLAVE_TX (0x00000000U)
|
||||
#define I2S_MODE_SLAVE_RX (SPI_I2SCFGR_I2SCFG_0)
|
||||
#define I2S_MODE_MASTER_TX (SPI_I2SCFGR_I2SCFG_1)
|
||||
#define I2S_MODE_MASTER_RX ((SPI_I2SCFGR_I2SCFG_0 | SPI_I2SCFGR_I2SCFG_1))
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup I2S_Standard I2S Standard
|
||||
* @{
|
||||
*/
|
||||
#define I2S_STANDARD_PHILIPS (0x00000000U)
|
||||
#define I2S_STANDARD_MSB (SPI_I2SCFGR_I2SSTD_0)
|
||||
#define I2S_STANDARD_LSB (SPI_I2SCFGR_I2SSTD_1)
|
||||
#define I2S_STANDARD_PCM_SHORT ((SPI_I2SCFGR_I2SSTD_0 | SPI_I2SCFGR_I2SSTD_1))
|
||||
#define I2S_STANDARD_PCM_LONG ((SPI_I2SCFGR_I2SSTD_0 | SPI_I2SCFGR_I2SSTD_1 | SPI_I2SCFGR_PCMSYNC))
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup I2S_Data_Format I2S Data Format
|
||||
* @{
|
||||
*/
|
||||
#define I2S_DATAFORMAT_16B (0x00000000U)
|
||||
#define I2S_DATAFORMAT_16B_EXTENDED (SPI_I2SCFGR_CHLEN)
|
||||
#define I2S_DATAFORMAT_24B ((SPI_I2SCFGR_CHLEN | SPI_I2SCFGR_DATLEN_0))
|
||||
#define I2S_DATAFORMAT_32B ((SPI_I2SCFGR_CHLEN | SPI_I2SCFGR_DATLEN_1))
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup I2S_MCLK_Output I2S MCLK Output
|
||||
* @{
|
||||
*/
|
||||
#define I2S_MCLKOUTPUT_ENABLE (SPI_I2SPR_MCKOE)
|
||||
#define I2S_MCLKOUTPUT_DISABLE (0x00000000U)
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup I2S_Audio_Frequency I2S Audio Frequency
|
||||
* @{
|
||||
*/
|
||||
#define I2S_AUDIOFREQ_192K (192000U)
|
||||
#define I2S_AUDIOFREQ_96K (96000U)
|
||||
#define I2S_AUDIOFREQ_48K (48000U)
|
||||
#define I2S_AUDIOFREQ_44K (44100U)
|
||||
#define I2S_AUDIOFREQ_32K (32000U)
|
||||
#define I2S_AUDIOFREQ_22K (22050U)
|
||||
#define I2S_AUDIOFREQ_16K (16000U)
|
||||
#define I2S_AUDIOFREQ_11K (11025U)
|
||||
#define I2S_AUDIOFREQ_8K (8000U)
|
||||
#define I2S_AUDIOFREQ_DEFAULT (2U)
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup I2S_FullDuplex_Mode I2S FullDuplex Mode
|
||||
* @{
|
||||
*/
|
||||
#define I2S_FULLDUPLEXMODE_DISABLE (0x00000000U)
|
||||
#define I2S_FULLDUPLEXMODE_ENABLE (0x00000001U)
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup I2S_Clock_Polarity I2S Clock Polarity
|
||||
* @{
|
||||
*/
|
||||
#define I2S_CPOL_LOW (0x00000000U)
|
||||
#define I2S_CPOL_HIGH (SPI_I2SCFGR_CKPOL)
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup I2S_Interrupts_Definition I2S Interrupts Definition
|
||||
* @{
|
||||
*/
|
||||
#define I2S_IT_TXE SPI_CR2_TXEIE
|
||||
#define I2S_IT_RXNE SPI_CR2_RXNEIE
|
||||
#define I2S_IT_ERR SPI_CR2_ERRIE
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup I2S_Flags_Definition I2S Flags Definition
|
||||
* @{
|
||||
*/
|
||||
#define I2S_FLAG_TXE SPI_SR_TXE
|
||||
#define I2S_FLAG_RXNE SPI_SR_RXNE
|
||||
|
||||
#define I2S_FLAG_UDR SPI_SR_UDR
|
||||
#define I2S_FLAG_OVR SPI_SR_OVR
|
||||
#define I2S_FLAG_FRE SPI_SR_FRE
|
||||
|
||||
#define I2S_FLAG_CHSIDE SPI_SR_CHSIDE
|
||||
#define I2S_FLAG_BSY SPI_SR_BSY
|
||||
|
||||
#define I2S_FLAG_MASK (SPI_SR_RXNE\
|
||||
| SPI_SR_TXE | SPI_SR_UDR | SPI_SR_OVR | SPI_SR_FRE | SPI_SR_CHSIDE | SPI_SR_BSY)
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup I2S_Clock_Source I2S Clock Source Definition
|
||||
* @{
|
||||
*/
|
||||
#if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) || defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F411xE) || defined(STM32F469xx) || defined(STM32F479xx)
|
||||
#define I2S_CLOCK_PLL (0x00000000U)
|
||||
#define I2S_CLOCK_EXTERNAL (0x00000001U)
|
||||
#endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx ||
|
||||
STM32F401xC || STM32F401xE || STM32F411xE || STM32F469xx || STM32F479xx */
|
||||
|
||||
#if defined(STM32F446xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx)
|
||||
#define I2S_CLOCK_PLL (0x00000000U)
|
||||
#define I2S_CLOCK_EXTERNAL (0x00000001U)
|
||||
#define I2S_CLOCK_PLLR (0x00000002U)
|
||||
#define I2S_CLOCK_PLLSRC (0x00000003U)
|
||||
#endif /* STM32F446xx || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx */
|
||||
|
||||
#if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx)
|
||||
#define I2S_CLOCK_PLLSRC (0x00000000U)
|
||||
#define I2S_CLOCK_EXTERNAL (0x00000001U)
|
||||
#define I2S_CLOCK_PLLR (0x00000002U)
|
||||
#endif /* STM32F410Tx || STM32F410Cx || STM32F410Rx */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Exported macros -----------------------------------------------------------*/
|
||||
/** @defgroup I2S_Exported_macros I2S Exported Macros
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @brief Reset I2S handle state
|
||||
* @param __HANDLE__ specifies the I2S Handle.
|
||||
* @retval None
|
||||
*/
|
||||
#if (USE_HAL_I2S_REGISTER_CALLBACKS == 1U)
|
||||
#define __HAL_I2S_RESET_HANDLE_STATE(__HANDLE__) do{ \
|
||||
(__HANDLE__)->State = HAL_I2S_STATE_RESET; \
|
||||
(__HANDLE__)->MspInitCallback = NULL; \
|
||||
(__HANDLE__)->MspDeInitCallback = NULL; \
|
||||
} while(0)
|
||||
#else
|
||||
#define __HAL_I2S_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_I2S_STATE_RESET)
|
||||
#endif /* USE_HAL_I2S_REGISTER_CALLBACKS */
|
||||
|
||||
/** @brief Enable the specified SPI peripheral (in I2S mode).
|
||||
* @param __HANDLE__ specifies the I2S Handle.
|
||||
* @retval None
|
||||
*/
|
||||
#define __HAL_I2S_ENABLE(__HANDLE__) (SET_BIT((__HANDLE__)->Instance->I2SCFGR, SPI_I2SCFGR_I2SE))
|
||||
|
||||
/** @brief Disable the specified SPI peripheral (in I2S mode).
|
||||
* @param __HANDLE__ specifies the I2S Handle.
|
||||
* @retval None
|
||||
*/
|
||||
#define __HAL_I2S_DISABLE(__HANDLE__) (CLEAR_BIT((__HANDLE__)->Instance->I2SCFGR, SPI_I2SCFGR_I2SE))
|
||||
|
||||
/** @brief Enable the specified I2S interrupts.
|
||||
* @param __HANDLE__ specifies the I2S Handle.
|
||||
* @param __INTERRUPT__ specifies the interrupt source to enable or disable.
|
||||
* This parameter can be one of the following values:
|
||||
* @arg I2S_IT_TXE: Tx buffer empty interrupt enable
|
||||
* @arg I2S_IT_RXNE: RX buffer not empty interrupt enable
|
||||
* @arg I2S_IT_ERR: Error interrupt enable
|
||||
* @retval None
|
||||
*/
|
||||
#define __HAL_I2S_ENABLE_IT(__HANDLE__, __INTERRUPT__) (SET_BIT((__HANDLE__)->Instance->CR2,(__INTERRUPT__)))
|
||||
|
||||
/** @brief Disable the specified I2S interrupts.
|
||||
* @param __HANDLE__ specifies the I2S Handle.
|
||||
* @param __INTERRUPT__ specifies the interrupt source to enable or disable.
|
||||
* This parameter can be one of the following values:
|
||||
* @arg I2S_IT_TXE: Tx buffer empty interrupt enable
|
||||
* @arg I2S_IT_RXNE: RX buffer not empty interrupt enable
|
||||
* @arg I2S_IT_ERR: Error interrupt enable
|
||||
* @retval None
|
||||
*/
|
||||
#define __HAL_I2S_DISABLE_IT(__HANDLE__, __INTERRUPT__) (CLEAR_BIT((__HANDLE__)->Instance->CR2,(__INTERRUPT__)))
|
||||
|
||||
/** @brief Checks if the specified I2S interrupt source is enabled or disabled.
|
||||
* @param __HANDLE__ specifies the I2S Handle.
|
||||
* This parameter can be I2S where x: 1, 2, or 3 to select the I2S peripheral.
|
||||
* @param __INTERRUPT__ specifies the I2S interrupt source to check.
|
||||
* This parameter can be one of the following values:
|
||||
* @arg I2S_IT_TXE: Tx buffer empty interrupt enable
|
||||
* @arg I2S_IT_RXNE: RX buffer not empty interrupt enable
|
||||
* @arg I2S_IT_ERR: Error interrupt enable
|
||||
* @retval The new state of __IT__ (TRUE or FALSE).
|
||||
*/
|
||||
#define __HAL_I2S_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((__HANDLE__)->Instance->CR2\
|
||||
& (__INTERRUPT__)) == (__INTERRUPT__)) ? SET : RESET)
|
||||
|
||||
/** @brief Checks whether the specified I2S flag is set or not.
|
||||
* @param __HANDLE__ specifies the I2S Handle.
|
||||
* @param __FLAG__ specifies the flag to check.
|
||||
* This parameter can be one of the following values:
|
||||
* @arg I2S_FLAG_RXNE: Receive buffer not empty flag
|
||||
* @arg I2S_FLAG_TXE: Transmit buffer empty flag
|
||||
* @arg I2S_FLAG_UDR: Underrun flag
|
||||
* @arg I2S_FLAG_OVR: Overrun flag
|
||||
* @arg I2S_FLAG_FRE: Frame error flag
|
||||
* @arg I2S_FLAG_CHSIDE: Channel Side flag
|
||||
* @arg I2S_FLAG_BSY: Busy flag
|
||||
* @retval The new state of __FLAG__ (TRUE or FALSE).
|
||||
*/
|
||||
#define __HAL_I2S_GET_FLAG(__HANDLE__, __FLAG__) ((((__HANDLE__)->Instance->SR) & (__FLAG__)) == (__FLAG__))
|
||||
|
||||
/** @brief Clears the I2S OVR pending flag.
|
||||
* @param __HANDLE__ specifies the I2S Handle.
|
||||
* @retval None
|
||||
*/
|
||||
#define __HAL_I2S_CLEAR_OVRFLAG(__HANDLE__) do{ \
|
||||
__IO uint32_t tmpreg_ovr = 0x00U; \
|
||||
tmpreg_ovr = (__HANDLE__)->Instance->DR; \
|
||||
tmpreg_ovr = (__HANDLE__)->Instance->SR; \
|
||||
UNUSED(tmpreg_ovr); \
|
||||
}while(0U)
|
||||
/** @brief Clears the I2S UDR pending flag.
|
||||
* @param __HANDLE__ specifies the I2S Handle.
|
||||
* @retval None
|
||||
*/
|
||||
#define __HAL_I2S_CLEAR_UDRFLAG(__HANDLE__) do{\
|
||||
__IO uint32_t tmpreg_udr = 0x00U;\
|
||||
tmpreg_udr = ((__HANDLE__)->Instance->SR);\
|
||||
UNUSED(tmpreg_udr); \
|
||||
}while(0U)
|
||||
/** @brief Flush the I2S DR Register.
|
||||
* @param __HANDLE__ specifies the I2S Handle.
|
||||
* @retval None
|
||||
*/
|
||||
#define __HAL_I2S_FLUSH_RX_DR(__HANDLE__) do{\
|
||||
__IO uint32_t tmpreg_dr = 0x00U;\
|
||||
tmpreg_dr = ((__HANDLE__)->Instance->DR);\
|
||||
UNUSED(tmpreg_dr); \
|
||||
}while(0U)
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Include I2S Extension module */
|
||||
#include "stm32f4xx_hal_i2s_ex.h"
|
||||
|
||||
/* Exported functions --------------------------------------------------------*/
|
||||
/** @addtogroup I2S_Exported_Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup I2S_Exported_Functions_Group1
|
||||
* @{
|
||||
*/
|
||||
/* Initialization/de-initialization functions ********************************/
|
||||
HAL_StatusTypeDef HAL_I2S_Init(I2S_HandleTypeDef *hi2s);
|
||||
HAL_StatusTypeDef HAL_I2S_DeInit(I2S_HandleTypeDef *hi2s);
|
||||
void HAL_I2S_MspInit(I2S_HandleTypeDef *hi2s);
|
||||
void HAL_I2S_MspDeInit(I2S_HandleTypeDef *hi2s);
|
||||
|
||||
/* Callbacks Register/UnRegister functions ***********************************/
|
||||
#if (USE_HAL_I2S_REGISTER_CALLBACKS == 1U)
|
||||
HAL_StatusTypeDef HAL_I2S_RegisterCallback(I2S_HandleTypeDef *hi2s, HAL_I2S_CallbackIDTypeDef CallbackID,
|
||||
pI2S_CallbackTypeDef pCallback);
|
||||
HAL_StatusTypeDef HAL_I2S_UnRegisterCallback(I2S_HandleTypeDef *hi2s, HAL_I2S_CallbackIDTypeDef CallbackID);
|
||||
#endif /* USE_HAL_I2S_REGISTER_CALLBACKS */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @addtogroup I2S_Exported_Functions_Group2
|
||||
* @{
|
||||
*/
|
||||
/* I/O operation functions ***************************************************/
|
||||
/* Blocking mode: Polling */
|
||||
HAL_StatusTypeDef HAL_I2S_Transmit(I2S_HandleTypeDef *hi2s, uint16_t *pData, uint16_t Size, uint32_t Timeout);
|
||||
HAL_StatusTypeDef HAL_I2S_Receive(I2S_HandleTypeDef *hi2s, uint16_t *pData, uint16_t Size, uint32_t Timeout);
|
||||
|
||||
/* Non-Blocking mode: Interrupt */
|
||||
HAL_StatusTypeDef HAL_I2S_Transmit_IT(I2S_HandleTypeDef *hi2s, uint16_t *pData, uint16_t Size);
|
||||
HAL_StatusTypeDef HAL_I2S_Receive_IT(I2S_HandleTypeDef *hi2s, uint16_t *pData, uint16_t Size);
|
||||
void HAL_I2S_IRQHandler(I2S_HandleTypeDef *hi2s);
|
||||
|
||||
/* Non-Blocking mode: DMA */
|
||||
HAL_StatusTypeDef HAL_I2S_Transmit_DMA(I2S_HandleTypeDef *hi2s, uint16_t *pData, uint16_t Size);
|
||||
HAL_StatusTypeDef HAL_I2S_Receive_DMA(I2S_HandleTypeDef *hi2s, uint16_t *pData, uint16_t Size);
|
||||
|
||||
HAL_StatusTypeDef HAL_I2S_DMAPause(I2S_HandleTypeDef *hi2s);
|
||||
HAL_StatusTypeDef HAL_I2S_DMAResume(I2S_HandleTypeDef *hi2s);
|
||||
HAL_StatusTypeDef HAL_I2S_DMAStop(I2S_HandleTypeDef *hi2s);
|
||||
|
||||
/* Callbacks used in non blocking modes (Interrupt and DMA) *******************/
|
||||
void HAL_I2S_TxHalfCpltCallback(I2S_HandleTypeDef *hi2s);
|
||||
void HAL_I2S_TxCpltCallback(I2S_HandleTypeDef *hi2s);
|
||||
void HAL_I2S_RxHalfCpltCallback(I2S_HandleTypeDef *hi2s);
|
||||
void HAL_I2S_RxCpltCallback(I2S_HandleTypeDef *hi2s);
|
||||
void HAL_I2S_ErrorCallback(I2S_HandleTypeDef *hi2s);
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @addtogroup I2S_Exported_Functions_Group3
|
||||
* @{
|
||||
*/
|
||||
/* Peripheral Control and State functions ************************************/
|
||||
HAL_I2S_StateTypeDef HAL_I2S_GetState(I2S_HandleTypeDef *hi2s);
|
||||
uint32_t HAL_I2S_GetError(I2S_HandleTypeDef *hi2s);
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Private types -------------------------------------------------------------*/
|
||||
/* Private variables ---------------------------------------------------------*/
|
||||
/* Private constants ---------------------------------------------------------*/
|
||||
/* Private macros ------------------------------------------------------------*/
|
||||
/** @defgroup I2S_Private_Macros I2S Private Macros
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @brief Check whether the specified SPI flag is set or not.
|
||||
* @param __SR__ copy of I2S SR register.
|
||||
* @param __FLAG__ specifies the flag to check.
|
||||
* This parameter can be one of the following values:
|
||||
* @arg I2S_FLAG_RXNE: Receive buffer not empty flag
|
||||
* @arg I2S_FLAG_TXE: Transmit buffer empty flag
|
||||
* @arg I2S_FLAG_UDR: Underrun error flag
|
||||
* @arg I2S_FLAG_OVR: Overrun flag
|
||||
* @arg I2S_FLAG_CHSIDE: Channel side flag
|
||||
* @arg I2S_FLAG_BSY: Busy flag
|
||||
* @retval SET or RESET.
|
||||
*/
|
||||
#define I2S_CHECK_FLAG(__SR__, __FLAG__) ((((__SR__)\
|
||||
& ((__FLAG__) & I2S_FLAG_MASK)) == ((__FLAG__) & I2S_FLAG_MASK)) ? SET : RESET)
|
||||
|
||||
/** @brief Check whether the specified SPI Interrupt is set or not.
|
||||
* @param __CR2__ copy of I2S CR2 register.
|
||||
* @param __INTERRUPT__ specifies the SPI interrupt source to check.
|
||||
* This parameter can be one of the following values:
|
||||
* @arg I2S_IT_TXE: Tx buffer empty interrupt enable
|
||||
* @arg I2S_IT_RXNE: RX buffer not empty interrupt enable
|
||||
* @arg I2S_IT_ERR: Error interrupt enable
|
||||
* @retval SET or RESET.
|
||||
*/
|
||||
#define I2S_CHECK_IT_SOURCE(__CR2__, __INTERRUPT__) ((((__CR2__)\
|
||||
& (__INTERRUPT__)) == (__INTERRUPT__)) ? SET : RESET)
|
||||
|
||||
/** @brief Checks if I2S Mode parameter is in allowed range.
|
||||
* @param __MODE__ specifies the I2S Mode.
|
||||
* This parameter can be a value of @ref I2S_Mode
|
||||
* @retval None
|
||||
*/
|
||||
#define IS_I2S_MODE(__MODE__) (((__MODE__) == I2S_MODE_SLAVE_TX) || \
|
||||
((__MODE__) == I2S_MODE_SLAVE_RX) || \
|
||||
((__MODE__) == I2S_MODE_MASTER_TX) || \
|
||||
((__MODE__) == I2S_MODE_MASTER_RX))
|
||||
|
||||
#define IS_I2S_STANDARD(__STANDARD__) (((__STANDARD__) == I2S_STANDARD_PHILIPS) || \
|
||||
((__STANDARD__) == I2S_STANDARD_MSB) || \
|
||||
((__STANDARD__) == I2S_STANDARD_LSB) || \
|
||||
((__STANDARD__) == I2S_STANDARD_PCM_SHORT) || \
|
||||
((__STANDARD__) == I2S_STANDARD_PCM_LONG))
|
||||
|
||||
#define IS_I2S_DATA_FORMAT(__FORMAT__) (((__FORMAT__) == I2S_DATAFORMAT_16B) || \
|
||||
((__FORMAT__) == I2S_DATAFORMAT_16B_EXTENDED) || \
|
||||
((__FORMAT__) == I2S_DATAFORMAT_24B) || \
|
||||
((__FORMAT__) == I2S_DATAFORMAT_32B))
|
||||
|
||||
#define IS_I2S_MCLK_OUTPUT(__OUTPUT__) (((__OUTPUT__) == I2S_MCLKOUTPUT_ENABLE) || \
|
||||
((__OUTPUT__) == I2S_MCLKOUTPUT_DISABLE))
|
||||
|
||||
#define IS_I2S_AUDIO_FREQ(__FREQ__) ((((__FREQ__) >= I2S_AUDIOFREQ_8K) && \
|
||||
((__FREQ__) <= I2S_AUDIOFREQ_192K)) || \
|
||||
((__FREQ__) == I2S_AUDIOFREQ_DEFAULT))
|
||||
|
||||
#define IS_I2S_FULLDUPLEX_MODE(MODE) (((MODE) == I2S_FULLDUPLEXMODE_DISABLE) || \
|
||||
((MODE) == I2S_FULLDUPLEXMODE_ENABLE))
|
||||
|
||||
/** @brief Checks if I2S Serial clock steady state parameter is in allowed range.
|
||||
* @param __CPOL__ specifies the I2S serial clock steady state.
|
||||
* This parameter can be a value of @ref I2S_Clock_Polarity
|
||||
* @retval None
|
||||
*/
|
||||
#define IS_I2S_CPOL(__CPOL__) (((__CPOL__) == I2S_CPOL_LOW) || \
|
||||
((__CPOL__) == I2S_CPOL_HIGH))
|
||||
|
||||
#if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) || defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F411xE) || defined(STM32F469xx) || defined(STM32F479xx)
|
||||
#define IS_I2S_CLOCKSOURCE(CLOCK) (((CLOCK) == I2S_CLOCK_EXTERNAL) ||\
|
||||
((CLOCK) == I2S_CLOCK_PLL))
|
||||
#endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx ||
|
||||
STM32F401xC || STM32F401xE || STM32F411xE || STM32F469xx || STM32F479xx */
|
||||
|
||||
#if defined(STM32F446xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) || defined (STM32F413xx) || defined(STM32F423xx)
|
||||
#define IS_I2S_CLOCKSOURCE(CLOCK) (((CLOCK) == I2S_CLOCK_EXTERNAL) ||\
|
||||
((CLOCK) == I2S_CLOCK_PLL) ||\
|
||||
((CLOCK) == I2S_CLOCK_PLLSRC) ||\
|
||||
((CLOCK) == I2S_CLOCK_PLLR))
|
||||
#endif /* STM32F446xx || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx */
|
||||
|
||||
#if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx)
|
||||
#define IS_I2S_CLOCKSOURCE(CLOCK) (((CLOCK) == I2S_CLOCK_EXTERNAL) ||\
|
||||
((CLOCK) == I2S_CLOCK_PLLSRC) ||\
|
||||
((CLOCK) == I2S_CLOCK_PLLR))
|
||||
#endif /* STM32F410Tx || STM32F410Cx || STM32F410Rx */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* STM32F4xx_HAL_I2S_H */
|
||||
|
||||
183
Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_i2s_ex.h
Normal file
183
Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_i2s_ex.h
Normal file
@@ -0,0 +1,183 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file stm32f4xx_hal_i2s_ex.h
|
||||
* @author MCD Application Team
|
||||
* @brief Header file of I2S HAL module.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2016 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 STM32F4xx_HAL_I2S_EX_H
|
||||
#define STM32F4xx_HAL_I2S_EX_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32f4xx_hal_def.h"
|
||||
|
||||
/** @addtogroup STM32F4xx_HAL_Driver
|
||||
* @{
|
||||
*/
|
||||
#if defined(SPI_I2S_FULLDUPLEX_SUPPORT)
|
||||
/** @addtogroup I2SEx I2SEx
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
/* Exported macros -----------------------------------------------------------*/
|
||||
/** @defgroup I2SEx_Exported_Macros I2S Extended Exported Macros
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define I2SxEXT(__INSTANCE__) ((__INSTANCE__) == (SPI2)? (SPI_TypeDef *)(I2S2ext_BASE): (SPI_TypeDef *)(I2S3ext_BASE))
|
||||
|
||||
/** @brief Enable or disable the specified I2SExt peripheral.
|
||||
* @param __HANDLE__ specifies the I2S Handle.
|
||||
* @retval None
|
||||
*/
|
||||
#define __HAL_I2SEXT_ENABLE(__HANDLE__) (I2SxEXT((__HANDLE__)->Instance)->I2SCFGR |= SPI_I2SCFGR_I2SE)
|
||||
#define __HAL_I2SEXT_DISABLE(__HANDLE__) (I2SxEXT((__HANDLE__)->Instance)->I2SCFGR &= ~SPI_I2SCFGR_I2SE)
|
||||
|
||||
/** @brief Enable or disable the specified I2SExt interrupts.
|
||||
* @param __HANDLE__ specifies the I2S Handle.
|
||||
* @param __INTERRUPT__ specifies the interrupt source to enable or disable.
|
||||
* This parameter can be one of the following values:
|
||||
* @arg I2S_IT_TXE: Tx buffer empty interrupt enable
|
||||
* @arg I2S_IT_RXNE: RX buffer not empty interrupt enable
|
||||
* @arg I2S_IT_ERR: Error interrupt enable
|
||||
* @retval None
|
||||
*/
|
||||
#define __HAL_I2SEXT_ENABLE_IT(__HANDLE__, __INTERRUPT__) (I2SxEXT((__HANDLE__)->Instance)->CR2 |= (__INTERRUPT__))
|
||||
#define __HAL_I2SEXT_DISABLE_IT(__HANDLE__, __INTERRUPT__) (I2SxEXT((__HANDLE__)->Instance)->CR2 &= ~(__INTERRUPT__))
|
||||
|
||||
/** @brief Checks if the specified I2SExt interrupt source is enabled or disabled.
|
||||
* @param __HANDLE__ specifies the I2S Handle.
|
||||
* This parameter can be I2S where x: 1, 2, or 3 to select the I2S peripheral.
|
||||
* @param __INTERRUPT__ specifies the I2S interrupt source to check.
|
||||
* This parameter can be one of the following values:
|
||||
* @arg I2S_IT_TXE: Tx buffer empty interrupt enable
|
||||
* @arg I2S_IT_RXNE: RX buffer not empty interrupt enable
|
||||
* @arg I2S_IT_ERR: Error interrupt enable
|
||||
* @retval The new state of __IT__ (TRUE or FALSE).
|
||||
*/
|
||||
#define __HAL_I2SEXT_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((I2SxEXT((__HANDLE__)->Instance)->CR2\
|
||||
& (__INTERRUPT__)) == (__INTERRUPT__)) ? SET : RESET)
|
||||
|
||||
/** @brief Checks whether the specified I2SExt flag is set or not.
|
||||
* @param __HANDLE__ specifies the I2S Handle.
|
||||
* @param __FLAG__ specifies the flag to check.
|
||||
* This parameter can be one of the following values:
|
||||
* @arg I2S_FLAG_RXNE: Receive buffer not empty flag
|
||||
* @arg I2S_FLAG_TXE: Transmit buffer empty flag
|
||||
* @arg I2S_FLAG_UDR: Underrun flag
|
||||
* @arg I2S_FLAG_OVR: Overrun flag
|
||||
* @arg I2S_FLAG_FRE: Frame error flag
|
||||
* @arg I2S_FLAG_CHSIDE: Channel Side flag
|
||||
* @arg I2S_FLAG_BSY: Busy flag
|
||||
* @retval The new state of __FLAG__ (TRUE or FALSE).
|
||||
*/
|
||||
#define __HAL_I2SEXT_GET_FLAG(__HANDLE__, __FLAG__) (((I2SxEXT((__HANDLE__)->Instance)->SR) & (__FLAG__)) == (__FLAG__))
|
||||
|
||||
/** @brief Clears the I2SExt OVR pending flag.
|
||||
* @param __HANDLE__ specifies the I2S Handle.
|
||||
* @retval None
|
||||
*/
|
||||
#define __HAL_I2SEXT_CLEAR_OVRFLAG(__HANDLE__) do{ \
|
||||
__IO uint32_t tmpreg_ovr = 0x00U; \
|
||||
tmpreg_ovr = I2SxEXT((__HANDLE__)->Instance)->DR;\
|
||||
tmpreg_ovr = I2SxEXT((__HANDLE__)->Instance)->SR;\
|
||||
UNUSED(tmpreg_ovr); \
|
||||
}while(0U)
|
||||
/** @brief Clears the I2SExt UDR pending flag.
|
||||
* @param __HANDLE__ specifies the I2S Handle.
|
||||
* @retval None
|
||||
*/
|
||||
#define __HAL_I2SEXT_CLEAR_UDRFLAG(__HANDLE__) do{ \
|
||||
__IO uint32_t tmpreg_udr = 0x00U; \
|
||||
tmpreg_udr = I2SxEXT((__HANDLE__)->Instance)->SR;\
|
||||
UNUSED(tmpreg_udr); \
|
||||
}while(0U)
|
||||
/** @brief Flush the I2S and I2SExt DR Registers.
|
||||
* @param __HANDLE__ specifies the I2S Handle.
|
||||
* @retval None
|
||||
*/
|
||||
#define __HAL_I2SEXT_FLUSH_RX_DR(__HANDLE__) do{ \
|
||||
__IO uint32_t tmpreg_dr = 0x00U; \
|
||||
tmpreg_dr = I2SxEXT((__HANDLE__)->Instance)->DR; \
|
||||
tmpreg_dr = ((__HANDLE__)->Instance->DR); \
|
||||
UNUSED(tmpreg_dr); \
|
||||
}while(0U)
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Exported functions --------------------------------------------------------*/
|
||||
/** @addtogroup I2SEx_Exported_Functions I2S Extended Exported Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup I2SEx_Exported_Functions_Group1 I2S Extended IO operation functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* Extended features functions *************************************************/
|
||||
/* Blocking mode: Polling */
|
||||
HAL_StatusTypeDef HAL_I2SEx_TransmitReceive(I2S_HandleTypeDef *hi2s, uint16_t *pTxData, uint16_t *pRxData,
|
||||
uint16_t Size, uint32_t Timeout);
|
||||
/* Non-Blocking mode: Interrupt */
|
||||
HAL_StatusTypeDef HAL_I2SEx_TransmitReceive_IT(I2S_HandleTypeDef *hi2s, uint16_t *pTxData, uint16_t *pRxData,
|
||||
uint16_t Size);
|
||||
/* Non-Blocking mode: DMA */
|
||||
HAL_StatusTypeDef HAL_I2SEx_TransmitReceive_DMA(I2S_HandleTypeDef *hi2s, uint16_t *pTxData, uint16_t *pRxData,
|
||||
uint16_t Size);
|
||||
/* I2S IRQHandler and Callbacks used in non blocking modes (Interrupt and DMA) */
|
||||
void HAL_I2SEx_FullDuplex_IRQHandler(I2S_HandleTypeDef *hi2s);
|
||||
void HAL_I2SEx_TxRxHalfCpltCallback(I2S_HandleTypeDef *hi2s);
|
||||
void HAL_I2SEx_TxRxCpltCallback(I2S_HandleTypeDef *hi2s);
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
/* Private types -------------------------------------------------------------*/
|
||||
/* Private variables ---------------------------------------------------------*/
|
||||
/* Private constants ---------------------------------------------------------*/
|
||||
/* Private macros ------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Private functions ---------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif /* SPI_I2S_FULLDUPLEX_SUPPORT */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* STM32F4xx_HAL_I2S_EX_H */
|
||||
|
||||
729
Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_spi.h
Normal file
729
Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_spi.h
Normal file
@@ -0,0 +1,729 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file stm32f4xx_hal_spi.h
|
||||
* @author MCD Application Team
|
||||
* @brief Header file of SPI HAL module.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2016 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 STM32F4xx_HAL_SPI_H
|
||||
#define STM32F4xx_HAL_SPI_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32f4xx_hal_def.h"
|
||||
|
||||
/** @addtogroup STM32F4xx_HAL_Driver
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup SPI
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
/** @defgroup SPI_Exported_Types SPI Exported Types
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief SPI Configuration Structure definition
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint32_t Mode; /*!< Specifies the SPI operating mode.
|
||||
This parameter can be a value of @ref SPI_Mode */
|
||||
|
||||
uint32_t Direction; /*!< Specifies the SPI bidirectional mode state.
|
||||
This parameter can be a value of @ref SPI_Direction */
|
||||
|
||||
uint32_t DataSize; /*!< Specifies the SPI data size.
|
||||
This parameter can be a value of @ref SPI_Data_Size */
|
||||
|
||||
uint32_t CLKPolarity; /*!< Specifies the serial clock steady state.
|
||||
This parameter can be a value of @ref SPI_Clock_Polarity */
|
||||
|
||||
uint32_t CLKPhase; /*!< Specifies the clock active edge for the bit capture.
|
||||
This parameter can be a value of @ref SPI_Clock_Phase */
|
||||
|
||||
uint32_t NSS; /*!< Specifies whether the NSS signal is managed by
|
||||
hardware (NSS pin) or by software using the SSI bit.
|
||||
This parameter can be a value of @ref SPI_Slave_Select_management */
|
||||
|
||||
uint32_t BaudRatePrescaler; /*!< Specifies the Baud Rate prescaler value which will be
|
||||
used to configure the transmit and receive SCK clock.
|
||||
This parameter can be a value of @ref SPI_BaudRate_Prescaler
|
||||
@note The communication clock is derived from the master
|
||||
clock. The slave clock does not need to be set. */
|
||||
|
||||
uint32_t FirstBit; /*!< Specifies whether data transfers start from MSB or LSB bit.
|
||||
This parameter can be a value of @ref SPI_MSB_LSB_transmission */
|
||||
|
||||
uint32_t TIMode; /*!< Specifies if the TI mode is enabled or not.
|
||||
This parameter can be a value of @ref SPI_TI_mode */
|
||||
|
||||
uint32_t CRCCalculation; /*!< Specifies if the CRC calculation is enabled or not.
|
||||
This parameter can be a value of @ref SPI_CRC_Calculation */
|
||||
|
||||
uint32_t CRCPolynomial; /*!< Specifies the polynomial used for the CRC calculation.
|
||||
This parameter must be an odd number between Min_Data = 1 and Max_Data = 65535 */
|
||||
} SPI_InitTypeDef;
|
||||
|
||||
/**
|
||||
* @brief HAL SPI State structure definition
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
HAL_SPI_STATE_RESET = 0x00U, /*!< Peripheral not Initialized */
|
||||
HAL_SPI_STATE_READY = 0x01U, /*!< Peripheral Initialized and ready for use */
|
||||
HAL_SPI_STATE_BUSY = 0x02U, /*!< an internal process is ongoing */
|
||||
HAL_SPI_STATE_BUSY_TX = 0x03U, /*!< Data Transmission process is ongoing */
|
||||
HAL_SPI_STATE_BUSY_RX = 0x04U, /*!< Data Reception process is ongoing */
|
||||
HAL_SPI_STATE_BUSY_TX_RX = 0x05U, /*!< Data Transmission and Reception process is ongoing */
|
||||
HAL_SPI_STATE_ERROR = 0x06U, /*!< SPI error state */
|
||||
HAL_SPI_STATE_ABORT = 0x07U /*!< SPI abort is ongoing */
|
||||
} HAL_SPI_StateTypeDef;
|
||||
|
||||
/**
|
||||
* @brief SPI handle Structure definition
|
||||
*/
|
||||
typedef struct __SPI_HandleTypeDef
|
||||
{
|
||||
SPI_TypeDef *Instance; /*!< SPI registers base address */
|
||||
|
||||
SPI_InitTypeDef Init; /*!< SPI communication parameters */
|
||||
|
||||
const uint8_t *pTxBuffPtr; /*!< Pointer to SPI Tx transfer Buffer */
|
||||
|
||||
uint16_t TxXferSize; /*!< SPI Tx Transfer size */
|
||||
|
||||
__IO uint16_t TxXferCount; /*!< SPI Tx Transfer Counter */
|
||||
|
||||
uint8_t *pRxBuffPtr; /*!< Pointer to SPI Rx transfer Buffer */
|
||||
|
||||
uint16_t RxXferSize; /*!< SPI Rx Transfer size */
|
||||
|
||||
__IO uint16_t RxXferCount; /*!< SPI Rx Transfer Counter */
|
||||
|
||||
void (*RxISR)(struct __SPI_HandleTypeDef *hspi); /*!< function pointer on Rx ISR */
|
||||
|
||||
void (*TxISR)(struct __SPI_HandleTypeDef *hspi); /*!< function pointer on Tx ISR */
|
||||
|
||||
DMA_HandleTypeDef *hdmatx; /*!< SPI Tx DMA Handle parameters */
|
||||
|
||||
DMA_HandleTypeDef *hdmarx; /*!< SPI Rx DMA Handle parameters */
|
||||
|
||||
HAL_LockTypeDef Lock; /*!< Locking object */
|
||||
|
||||
__IO HAL_SPI_StateTypeDef State; /*!< SPI communication state */
|
||||
|
||||
__IO uint32_t ErrorCode; /*!< SPI Error code */
|
||||
|
||||
#if (USE_HAL_SPI_REGISTER_CALLBACKS == 1U)
|
||||
void (* TxCpltCallback)(struct __SPI_HandleTypeDef *hspi); /*!< SPI Tx Completed callback */
|
||||
void (* RxCpltCallback)(struct __SPI_HandleTypeDef *hspi); /*!< SPI Rx Completed callback */
|
||||
void (* TxRxCpltCallback)(struct __SPI_HandleTypeDef *hspi); /*!< SPI TxRx Completed callback */
|
||||
void (* TxHalfCpltCallback)(struct __SPI_HandleTypeDef *hspi); /*!< SPI Tx Half Completed callback */
|
||||
void (* RxHalfCpltCallback)(struct __SPI_HandleTypeDef *hspi); /*!< SPI Rx Half Completed callback */
|
||||
void (* TxRxHalfCpltCallback)(struct __SPI_HandleTypeDef *hspi); /*!< SPI TxRx Half Completed callback */
|
||||
void (* ErrorCallback)(struct __SPI_HandleTypeDef *hspi); /*!< SPI Error callback */
|
||||
void (* AbortCpltCallback)(struct __SPI_HandleTypeDef *hspi); /*!< SPI Abort callback */
|
||||
void (* MspInitCallback)(struct __SPI_HandleTypeDef *hspi); /*!< SPI Msp Init callback */
|
||||
void (* MspDeInitCallback)(struct __SPI_HandleTypeDef *hspi); /*!< SPI Msp DeInit callback */
|
||||
|
||||
#endif /* USE_HAL_SPI_REGISTER_CALLBACKS */
|
||||
} SPI_HandleTypeDef;
|
||||
|
||||
#if (USE_HAL_SPI_REGISTER_CALLBACKS == 1U)
|
||||
/**
|
||||
* @brief HAL SPI Callback ID enumeration definition
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
HAL_SPI_TX_COMPLETE_CB_ID = 0x00U, /*!< SPI Tx Completed callback ID */
|
||||
HAL_SPI_RX_COMPLETE_CB_ID = 0x01U, /*!< SPI Rx Completed callback ID */
|
||||
HAL_SPI_TX_RX_COMPLETE_CB_ID = 0x02U, /*!< SPI TxRx Completed callback ID */
|
||||
HAL_SPI_TX_HALF_COMPLETE_CB_ID = 0x03U, /*!< SPI Tx Half Completed callback ID */
|
||||
HAL_SPI_RX_HALF_COMPLETE_CB_ID = 0x04U, /*!< SPI Rx Half Completed callback ID */
|
||||
HAL_SPI_TX_RX_HALF_COMPLETE_CB_ID = 0x05U, /*!< SPI TxRx Half Completed callback ID */
|
||||
HAL_SPI_ERROR_CB_ID = 0x06U, /*!< SPI Error callback ID */
|
||||
HAL_SPI_ABORT_CB_ID = 0x07U, /*!< SPI Abort callback ID */
|
||||
HAL_SPI_MSPINIT_CB_ID = 0x08U, /*!< SPI Msp Init callback ID */
|
||||
HAL_SPI_MSPDEINIT_CB_ID = 0x09U /*!< SPI Msp DeInit callback ID */
|
||||
|
||||
} HAL_SPI_CallbackIDTypeDef;
|
||||
|
||||
/**
|
||||
* @brief HAL SPI Callback pointer definition
|
||||
*/
|
||||
typedef void (*pSPI_CallbackTypeDef)(SPI_HandleTypeDef *hspi); /*!< pointer to an SPI callback function */
|
||||
|
||||
#endif /* USE_HAL_SPI_REGISTER_CALLBACKS */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
/** @defgroup SPI_Exported_Constants SPI Exported Constants
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup SPI_Error_Code SPI Error Code
|
||||
* @{
|
||||
*/
|
||||
#define HAL_SPI_ERROR_NONE (0x00000000U) /*!< No error */
|
||||
#define HAL_SPI_ERROR_MODF (0x00000001U) /*!< MODF error */
|
||||
#define HAL_SPI_ERROR_CRC (0x00000002U) /*!< CRC error */
|
||||
#define HAL_SPI_ERROR_OVR (0x00000004U) /*!< OVR error */
|
||||
#define HAL_SPI_ERROR_FRE (0x00000008U) /*!< FRE error */
|
||||
#define HAL_SPI_ERROR_DMA (0x00000010U) /*!< DMA transfer error */
|
||||
#define HAL_SPI_ERROR_FLAG (0x00000020U) /*!< Error on RXNE/TXE/BSY Flag */
|
||||
#define HAL_SPI_ERROR_ABORT (0x00000040U) /*!< Error during SPI Abort procedure */
|
||||
#if (USE_HAL_SPI_REGISTER_CALLBACKS == 1U)
|
||||
#define HAL_SPI_ERROR_INVALID_CALLBACK (0x00000080U) /*!< Invalid Callback error */
|
||||
#endif /* USE_HAL_SPI_REGISTER_CALLBACKS */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup SPI_Mode SPI Mode
|
||||
* @{
|
||||
*/
|
||||
#define SPI_MODE_SLAVE (0x00000000U)
|
||||
#define SPI_MODE_MASTER (SPI_CR1_MSTR | SPI_CR1_SSI)
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup SPI_Direction SPI Direction Mode
|
||||
* @{
|
||||
*/
|
||||
#define SPI_DIRECTION_2LINES (0x00000000U)
|
||||
#define SPI_DIRECTION_2LINES_RXONLY SPI_CR1_RXONLY
|
||||
#define SPI_DIRECTION_1LINE SPI_CR1_BIDIMODE
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup SPI_Data_Size SPI Data Size
|
||||
* @{
|
||||
*/
|
||||
#define SPI_DATASIZE_8BIT (0x00000000U)
|
||||
#define SPI_DATASIZE_16BIT SPI_CR1_DFF
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup SPI_Clock_Polarity SPI Clock Polarity
|
||||
* @{
|
||||
*/
|
||||
#define SPI_POLARITY_LOW (0x00000000U)
|
||||
#define SPI_POLARITY_HIGH SPI_CR1_CPOL
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup SPI_Clock_Phase SPI Clock Phase
|
||||
* @{
|
||||
*/
|
||||
#define SPI_PHASE_1EDGE (0x00000000U)
|
||||
#define SPI_PHASE_2EDGE SPI_CR1_CPHA
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup SPI_Slave_Select_management SPI Slave Select Management
|
||||
* @{
|
||||
*/
|
||||
#define SPI_NSS_SOFT SPI_CR1_SSM
|
||||
#define SPI_NSS_HARD_INPUT (0x00000000U)
|
||||
#define SPI_NSS_HARD_OUTPUT (SPI_CR2_SSOE << 16U)
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup SPI_BaudRate_Prescaler SPI BaudRate Prescaler
|
||||
* @{
|
||||
*/
|
||||
#define SPI_BAUDRATEPRESCALER_2 (0x00000000U)
|
||||
#define SPI_BAUDRATEPRESCALER_4 (SPI_CR1_BR_0)
|
||||
#define SPI_BAUDRATEPRESCALER_8 (SPI_CR1_BR_1)
|
||||
#define SPI_BAUDRATEPRESCALER_16 (SPI_CR1_BR_1 | SPI_CR1_BR_0)
|
||||
#define SPI_BAUDRATEPRESCALER_32 (SPI_CR1_BR_2)
|
||||
#define SPI_BAUDRATEPRESCALER_64 (SPI_CR1_BR_2 | SPI_CR1_BR_0)
|
||||
#define SPI_BAUDRATEPRESCALER_128 (SPI_CR1_BR_2 | SPI_CR1_BR_1)
|
||||
#define SPI_BAUDRATEPRESCALER_256 (SPI_CR1_BR_2 | SPI_CR1_BR_1 | SPI_CR1_BR_0)
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup SPI_MSB_LSB_transmission SPI MSB LSB Transmission
|
||||
* @{
|
||||
*/
|
||||
#define SPI_FIRSTBIT_MSB (0x00000000U)
|
||||
#define SPI_FIRSTBIT_LSB SPI_CR1_LSBFIRST
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup SPI_TI_mode SPI TI Mode
|
||||
* @{
|
||||
*/
|
||||
#define SPI_TIMODE_DISABLE (0x00000000U)
|
||||
#define SPI_TIMODE_ENABLE SPI_CR2_FRF
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup SPI_CRC_Calculation SPI CRC Calculation
|
||||
* @{
|
||||
*/
|
||||
#define SPI_CRCCALCULATION_DISABLE (0x00000000U)
|
||||
#define SPI_CRCCALCULATION_ENABLE SPI_CR1_CRCEN
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup SPI_Interrupt_definition SPI Interrupt Definition
|
||||
* @{
|
||||
*/
|
||||
#define SPI_IT_TXE SPI_CR2_TXEIE
|
||||
#define SPI_IT_RXNE SPI_CR2_RXNEIE
|
||||
#define SPI_IT_ERR SPI_CR2_ERRIE
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup SPI_Flags_definition SPI Flags Definition
|
||||
* @{
|
||||
*/
|
||||
#define SPI_FLAG_RXNE SPI_SR_RXNE /* SPI status flag: Rx buffer not empty flag */
|
||||
#define SPI_FLAG_TXE SPI_SR_TXE /* SPI status flag: Tx buffer empty flag */
|
||||
#define SPI_FLAG_BSY SPI_SR_BSY /* SPI status flag: Busy flag */
|
||||
#define SPI_FLAG_CRCERR SPI_SR_CRCERR /* SPI Error flag: CRC error flag */
|
||||
#define SPI_FLAG_MODF SPI_SR_MODF /* SPI Error flag: Mode fault flag */
|
||||
#define SPI_FLAG_OVR SPI_SR_OVR /* SPI Error flag: Overrun flag */
|
||||
#define SPI_FLAG_FRE SPI_SR_FRE /* SPI Error flag: TI mode frame format error flag */
|
||||
#define SPI_FLAG_MASK (SPI_SR_RXNE | SPI_SR_TXE | SPI_SR_BSY | SPI_SR_CRCERR\
|
||||
| SPI_SR_MODF | SPI_SR_OVR | SPI_SR_FRE)
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Exported macros -----------------------------------------------------------*/
|
||||
/** @defgroup SPI_Exported_Macros SPI Exported Macros
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @brief Reset SPI handle state.
|
||||
* @param __HANDLE__ specifies the SPI Handle.
|
||||
* This parameter can be SPI where x: 1, 2, or 3 to select the SPI peripheral.
|
||||
* @retval None
|
||||
*/
|
||||
#if (USE_HAL_SPI_REGISTER_CALLBACKS == 1U)
|
||||
#define __HAL_SPI_RESET_HANDLE_STATE(__HANDLE__) do{ \
|
||||
(__HANDLE__)->State = HAL_SPI_STATE_RESET; \
|
||||
(__HANDLE__)->MspInitCallback = NULL; \
|
||||
(__HANDLE__)->MspDeInitCallback = NULL; \
|
||||
} while(0)
|
||||
#else
|
||||
#define __HAL_SPI_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_SPI_STATE_RESET)
|
||||
#endif /* USE_HAL_SPI_REGISTER_CALLBACKS */
|
||||
|
||||
/** @brief Enable the specified SPI interrupts.
|
||||
* @param __HANDLE__ specifies the SPI Handle.
|
||||
* This parameter can be SPI where x: 1, 2, or 3 to select the SPI peripheral.
|
||||
* @param __INTERRUPT__ specifies the interrupt source to enable.
|
||||
* This parameter can be one of the following values:
|
||||
* @arg SPI_IT_TXE: Tx buffer empty interrupt enable
|
||||
* @arg SPI_IT_RXNE: RX buffer not empty interrupt enable
|
||||
* @arg SPI_IT_ERR: Error interrupt enable
|
||||
* @retval None
|
||||
*/
|
||||
#define __HAL_SPI_ENABLE_IT(__HANDLE__, __INTERRUPT__) SET_BIT((__HANDLE__)->Instance->CR2, (__INTERRUPT__))
|
||||
|
||||
/** @brief Disable the specified SPI interrupts.
|
||||
* @param __HANDLE__ specifies the SPI handle.
|
||||
* This parameter can be SPIx where x: 1, 2, or 3 to select the SPI peripheral.
|
||||
* @param __INTERRUPT__ specifies the interrupt source to disable.
|
||||
* This parameter can be one of the following values:
|
||||
* @arg SPI_IT_TXE: Tx buffer empty interrupt enable
|
||||
* @arg SPI_IT_RXNE: RX buffer not empty interrupt enable
|
||||
* @arg SPI_IT_ERR: Error interrupt enable
|
||||
* @retval None
|
||||
*/
|
||||
#define __HAL_SPI_DISABLE_IT(__HANDLE__, __INTERRUPT__) CLEAR_BIT((__HANDLE__)->Instance->CR2, (__INTERRUPT__))
|
||||
|
||||
/** @brief Check whether the specified SPI interrupt source is enabled or not.
|
||||
* @param __HANDLE__ specifies the SPI Handle.
|
||||
* This parameter can be SPI where x: 1, 2, or 3 to select the SPI peripheral.
|
||||
* @param __INTERRUPT__ specifies the SPI interrupt source to check.
|
||||
* This parameter can be one of the following values:
|
||||
* @arg SPI_IT_TXE: Tx buffer empty interrupt enable
|
||||
* @arg SPI_IT_RXNE: RX buffer not empty interrupt enable
|
||||
* @arg SPI_IT_ERR: Error interrupt enable
|
||||
* @retval The new state of __IT__ (TRUE or FALSE).
|
||||
*/
|
||||
#define __HAL_SPI_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((__HANDLE__)->Instance->CR2\
|
||||
& (__INTERRUPT__)) == (__INTERRUPT__)) ? SET : RESET)
|
||||
|
||||
/** @brief Check whether the specified SPI flag is set or not.
|
||||
* @param __HANDLE__ specifies the SPI Handle.
|
||||
* This parameter can be SPI where x: 1, 2, or 3 to select the SPI peripheral.
|
||||
* @param __FLAG__ specifies the flag to check.
|
||||
* This parameter can be one of the following values:
|
||||
* @arg SPI_FLAG_RXNE: Receive buffer not empty flag
|
||||
* @arg SPI_FLAG_TXE: Transmit buffer empty flag
|
||||
* @arg SPI_FLAG_CRCERR: CRC error flag
|
||||
* @arg SPI_FLAG_MODF: Mode fault flag
|
||||
* @arg SPI_FLAG_OVR: Overrun flag
|
||||
* @arg SPI_FLAG_BSY: Busy flag
|
||||
* @arg SPI_FLAG_FRE: Frame format error flag
|
||||
* @retval The new state of __FLAG__ (TRUE or FALSE).
|
||||
*/
|
||||
#define __HAL_SPI_GET_FLAG(__HANDLE__, __FLAG__) ((((__HANDLE__)->Instance->SR) & (__FLAG__)) == (__FLAG__))
|
||||
|
||||
/** @brief Clear the SPI CRCERR pending flag.
|
||||
* @param __HANDLE__ specifies the SPI Handle.
|
||||
* This parameter can be SPI where x: 1, 2, or 3 to select the SPI peripheral.
|
||||
* @retval None
|
||||
*/
|
||||
#define __HAL_SPI_CLEAR_CRCERRFLAG(__HANDLE__) ((__HANDLE__)->Instance->SR = (uint16_t)(~SPI_FLAG_CRCERR))
|
||||
|
||||
/** @brief Clear the SPI MODF pending flag.
|
||||
* @param __HANDLE__ specifies the SPI Handle.
|
||||
* This parameter can be SPI where x: 1, 2, or 3 to select the SPI peripheral.
|
||||
* @retval None
|
||||
*/
|
||||
#define __HAL_SPI_CLEAR_MODFFLAG(__HANDLE__) \
|
||||
do{ \
|
||||
__IO uint32_t tmpreg_modf = 0x00U; \
|
||||
tmpreg_modf = (__HANDLE__)->Instance->SR; \
|
||||
CLEAR_BIT((__HANDLE__)->Instance->CR1, SPI_CR1_SPE); \
|
||||
UNUSED(tmpreg_modf); \
|
||||
} while(0U)
|
||||
|
||||
/** @brief Clear the SPI OVR pending flag.
|
||||
* @param __HANDLE__ specifies the SPI Handle.
|
||||
* This parameter can be SPI where x: 1, 2, or 3 to select the SPI peripheral.
|
||||
* @retval None
|
||||
*/
|
||||
#define __HAL_SPI_CLEAR_OVRFLAG(__HANDLE__) \
|
||||
do{ \
|
||||
__IO uint32_t tmpreg_ovr = 0x00U; \
|
||||
tmpreg_ovr = (__HANDLE__)->Instance->DR; \
|
||||
tmpreg_ovr = (__HANDLE__)->Instance->SR; \
|
||||
UNUSED(tmpreg_ovr); \
|
||||
} while(0U)
|
||||
|
||||
/** @brief Clear the SPI FRE pending flag.
|
||||
* @param __HANDLE__ specifies the SPI Handle.
|
||||
* This parameter can be SPI where x: 1, 2, or 3 to select the SPI peripheral.
|
||||
* @retval None
|
||||
*/
|
||||
#define __HAL_SPI_CLEAR_FREFLAG(__HANDLE__) \
|
||||
do{ \
|
||||
__IO uint32_t tmpreg_fre = 0x00U; \
|
||||
tmpreg_fre = (__HANDLE__)->Instance->SR; \
|
||||
UNUSED(tmpreg_fre); \
|
||||
}while(0U)
|
||||
|
||||
/** @brief Enable the SPI peripheral.
|
||||
* @param __HANDLE__ specifies the SPI Handle.
|
||||
* This parameter can be SPI where x: 1, 2, or 3 to select the SPI peripheral.
|
||||
* @retval None
|
||||
*/
|
||||
#define __HAL_SPI_ENABLE(__HANDLE__) SET_BIT((__HANDLE__)->Instance->CR1, SPI_CR1_SPE)
|
||||
|
||||
/** @brief Disable the SPI peripheral.
|
||||
* @param __HANDLE__ specifies the SPI Handle.
|
||||
* This parameter can be SPI where x: 1, 2, or 3 to select the SPI peripheral.
|
||||
* @retval None
|
||||
*/
|
||||
#define __HAL_SPI_DISABLE(__HANDLE__) CLEAR_BIT((__HANDLE__)->Instance->CR1, SPI_CR1_SPE)
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Private macros ------------------------------------------------------------*/
|
||||
/** @defgroup SPI_Private_Macros SPI Private Macros
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @brief Set the SPI transmit-only mode.
|
||||
* @param __HANDLE__ specifies the SPI Handle.
|
||||
* This parameter can be SPI where x: 1, 2, or 3 to select the SPI peripheral.
|
||||
* @retval None
|
||||
*/
|
||||
#define SPI_1LINE_TX(__HANDLE__) SET_BIT((__HANDLE__)->Instance->CR1, SPI_CR1_BIDIOE)
|
||||
|
||||
/** @brief Set the SPI receive-only mode.
|
||||
* @param __HANDLE__ specifies the SPI Handle.
|
||||
* This parameter can be SPI where x: 1, 2, or 3 to select the SPI peripheral.
|
||||
* @retval None
|
||||
*/
|
||||
#define SPI_1LINE_RX(__HANDLE__) CLEAR_BIT((__HANDLE__)->Instance->CR1, SPI_CR1_BIDIOE)
|
||||
|
||||
/** @brief Reset the CRC calculation of the SPI.
|
||||
* @param __HANDLE__ specifies the SPI Handle.
|
||||
* This parameter can be SPI where x: 1, 2, or 3 to select the SPI peripheral.
|
||||
* @retval None
|
||||
*/
|
||||
#define SPI_RESET_CRC(__HANDLE__) do{CLEAR_BIT((__HANDLE__)->Instance->CR1, SPI_CR1_CRCEN);\
|
||||
SET_BIT((__HANDLE__)->Instance->CR1, SPI_CR1_CRCEN);}while(0U)
|
||||
|
||||
/** @brief Check whether the specified SPI flag is set or not.
|
||||
* @param __SR__ copy of SPI SR register.
|
||||
* @param __FLAG__ specifies the flag to check.
|
||||
* This parameter can be one of the following values:
|
||||
* @arg SPI_FLAG_RXNE: Receive buffer not empty flag
|
||||
* @arg SPI_FLAG_TXE: Transmit buffer empty flag
|
||||
* @arg SPI_FLAG_CRCERR: CRC error flag
|
||||
* @arg SPI_FLAG_MODF: Mode fault flag
|
||||
* @arg SPI_FLAG_OVR: Overrun flag
|
||||
* @arg SPI_FLAG_BSY: Busy flag
|
||||
* @arg SPI_FLAG_FRE: Frame format error flag
|
||||
* @retval SET or RESET.
|
||||
*/
|
||||
#define SPI_CHECK_FLAG(__SR__, __FLAG__) ((((__SR__) & ((__FLAG__) & SPI_FLAG_MASK)) == \
|
||||
((__FLAG__) & SPI_FLAG_MASK)) ? SET : RESET)
|
||||
|
||||
/** @brief Check whether the specified SPI Interrupt is set or not.
|
||||
* @param __CR2__ copy of SPI CR2 register.
|
||||
* @param __INTERRUPT__ specifies the SPI interrupt source to check.
|
||||
* This parameter can be one of the following values:
|
||||
* @arg SPI_IT_TXE: Tx buffer empty interrupt enable
|
||||
* @arg SPI_IT_RXNE: RX buffer not empty interrupt enable
|
||||
* @arg SPI_IT_ERR: Error interrupt enable
|
||||
* @retval SET or RESET.
|
||||
*/
|
||||
#define SPI_CHECK_IT_SOURCE(__CR2__, __INTERRUPT__) ((((__CR2__) & (__INTERRUPT__)) == \
|
||||
(__INTERRUPT__)) ? SET : RESET)
|
||||
|
||||
/** @brief Checks if SPI Mode parameter is in allowed range.
|
||||
* @param __MODE__ specifies the SPI Mode.
|
||||
* This parameter can be a value of @ref SPI_Mode
|
||||
* @retval None
|
||||
*/
|
||||
#define IS_SPI_MODE(__MODE__) (((__MODE__) == SPI_MODE_SLAVE) || \
|
||||
((__MODE__) == SPI_MODE_MASTER))
|
||||
|
||||
/** @brief Checks if SPI Direction Mode parameter is in allowed range.
|
||||
* @param __MODE__ specifies the SPI Direction Mode.
|
||||
* This parameter can be a value of @ref SPI_Direction
|
||||
* @retval None
|
||||
*/
|
||||
#define IS_SPI_DIRECTION(__MODE__) (((__MODE__) == SPI_DIRECTION_2LINES) || \
|
||||
((__MODE__) == SPI_DIRECTION_2LINES_RXONLY) || \
|
||||
((__MODE__) == SPI_DIRECTION_1LINE))
|
||||
|
||||
/** @brief Checks if SPI Direction Mode parameter is 2 lines.
|
||||
* @param __MODE__ specifies the SPI Direction Mode.
|
||||
* @retval None
|
||||
*/
|
||||
#define IS_SPI_DIRECTION_2LINES(__MODE__) ((__MODE__) == SPI_DIRECTION_2LINES)
|
||||
|
||||
/** @brief Checks if SPI Direction Mode parameter is 1 or 2 lines.
|
||||
* @param __MODE__ specifies the SPI Direction Mode.
|
||||
* @retval None
|
||||
*/
|
||||
#define IS_SPI_DIRECTION_2LINES_OR_1LINE(__MODE__) (((__MODE__) == SPI_DIRECTION_2LINES) || \
|
||||
((__MODE__) == SPI_DIRECTION_1LINE))
|
||||
|
||||
/** @brief Checks if SPI Data Size parameter is in allowed range.
|
||||
* @param __DATASIZE__ specifies the SPI Data Size.
|
||||
* This parameter can be a value of @ref SPI_Data_Size
|
||||
* @retval None
|
||||
*/
|
||||
#define IS_SPI_DATASIZE(__DATASIZE__) (((__DATASIZE__) == SPI_DATASIZE_16BIT) || \
|
||||
((__DATASIZE__) == SPI_DATASIZE_8BIT))
|
||||
|
||||
/** @brief Checks if SPI Serial clock steady state parameter is in allowed range.
|
||||
* @param __CPOL__ specifies the SPI serial clock steady state.
|
||||
* This parameter can be a value of @ref SPI_Clock_Polarity
|
||||
* @retval None
|
||||
*/
|
||||
#define IS_SPI_CPOL(__CPOL__) (((__CPOL__) == SPI_POLARITY_LOW) || \
|
||||
((__CPOL__) == SPI_POLARITY_HIGH))
|
||||
|
||||
/** @brief Checks if SPI Clock Phase parameter is in allowed range.
|
||||
* @param __CPHA__ specifies the SPI Clock Phase.
|
||||
* This parameter can be a value of @ref SPI_Clock_Phase
|
||||
* @retval None
|
||||
*/
|
||||
#define IS_SPI_CPHA(__CPHA__) (((__CPHA__) == SPI_PHASE_1EDGE) || \
|
||||
((__CPHA__) == SPI_PHASE_2EDGE))
|
||||
|
||||
/** @brief Checks if SPI Slave Select parameter is in allowed range.
|
||||
* @param __NSS__ specifies the SPI Slave Select management parameter.
|
||||
* This parameter can be a value of @ref SPI_Slave_Select_management
|
||||
* @retval None
|
||||
*/
|
||||
#define IS_SPI_NSS(__NSS__) (((__NSS__) == SPI_NSS_SOFT) || \
|
||||
((__NSS__) == SPI_NSS_HARD_INPUT) || \
|
||||
((__NSS__) == SPI_NSS_HARD_OUTPUT))
|
||||
|
||||
/** @brief Checks if SPI Baudrate prescaler parameter is in allowed range.
|
||||
* @param __PRESCALER__ specifies the SPI Baudrate prescaler.
|
||||
* This parameter can be a value of @ref SPI_BaudRate_Prescaler
|
||||
* @retval None
|
||||
*/
|
||||
#define IS_SPI_BAUDRATE_PRESCALER(__PRESCALER__) (((__PRESCALER__) == SPI_BAUDRATEPRESCALER_2) || \
|
||||
((__PRESCALER__) == SPI_BAUDRATEPRESCALER_4) || \
|
||||
((__PRESCALER__) == SPI_BAUDRATEPRESCALER_8) || \
|
||||
((__PRESCALER__) == SPI_BAUDRATEPRESCALER_16) || \
|
||||
((__PRESCALER__) == SPI_BAUDRATEPRESCALER_32) || \
|
||||
((__PRESCALER__) == SPI_BAUDRATEPRESCALER_64) || \
|
||||
((__PRESCALER__) == SPI_BAUDRATEPRESCALER_128) || \
|
||||
((__PRESCALER__) == SPI_BAUDRATEPRESCALER_256))
|
||||
|
||||
/** @brief Checks if SPI MSB LSB transmission parameter is in allowed range.
|
||||
* @param __BIT__ specifies the SPI MSB LSB transmission (whether data transfer starts from MSB or LSB bit).
|
||||
* This parameter can be a value of @ref SPI_MSB_LSB_transmission
|
||||
* @retval None
|
||||
*/
|
||||
#define IS_SPI_FIRST_BIT(__BIT__) (((__BIT__) == SPI_FIRSTBIT_MSB) || \
|
||||
((__BIT__) == SPI_FIRSTBIT_LSB))
|
||||
|
||||
/** @brief Checks if SPI TI mode parameter is in allowed range.
|
||||
* @param __MODE__ specifies the SPI TI mode.
|
||||
* This parameter can be a value of @ref SPI_TI_mode
|
||||
* @retval None
|
||||
*/
|
||||
#define IS_SPI_TIMODE(__MODE__) (((__MODE__) == SPI_TIMODE_DISABLE) || \
|
||||
((__MODE__) == SPI_TIMODE_ENABLE))
|
||||
|
||||
/** @brief Checks if SPI CRC calculation enabled state is in allowed range.
|
||||
* @param __CALCULATION__ specifies the SPI CRC calculation enable state.
|
||||
* This parameter can be a value of @ref SPI_CRC_Calculation
|
||||
* @retval None
|
||||
*/
|
||||
#define IS_SPI_CRC_CALCULATION(__CALCULATION__) (((__CALCULATION__) == SPI_CRCCALCULATION_DISABLE) || \
|
||||
((__CALCULATION__) == SPI_CRCCALCULATION_ENABLE))
|
||||
|
||||
/** @brief Checks if SPI polynomial value to be used for the CRC calculation, is in allowed range.
|
||||
* @param __POLYNOMIAL__ specifies the SPI polynomial value to be used for the CRC calculation.
|
||||
* This parameter must be a number between Min_Data = 0 and Max_Data = 65535
|
||||
* @retval None
|
||||
*/
|
||||
#define IS_SPI_CRC_POLYNOMIAL(__POLYNOMIAL__) (((__POLYNOMIAL__) >= 0x1U) && \
|
||||
((__POLYNOMIAL__) <= 0xFFFFU) && \
|
||||
(((__POLYNOMIAL__)&0x1U) != 0U))
|
||||
|
||||
/** @brief Checks if DMA handle is valid.
|
||||
* @param __HANDLE__ specifies a DMA Handle.
|
||||
* @retval None
|
||||
*/
|
||||
#define IS_SPI_DMA_HANDLE(__HANDLE__) ((__HANDLE__) != NULL)
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Exported functions --------------------------------------------------------*/
|
||||
/** @addtogroup SPI_Exported_Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup SPI_Exported_Functions_Group1
|
||||
* @{
|
||||
*/
|
||||
/* Initialization/de-initialization functions ********************************/
|
||||
HAL_StatusTypeDef HAL_SPI_Init(SPI_HandleTypeDef *hspi);
|
||||
HAL_StatusTypeDef HAL_SPI_DeInit(SPI_HandleTypeDef *hspi);
|
||||
void HAL_SPI_MspInit(SPI_HandleTypeDef *hspi);
|
||||
void HAL_SPI_MspDeInit(SPI_HandleTypeDef *hspi);
|
||||
|
||||
/* Callbacks Register/UnRegister functions ***********************************/
|
||||
#if (USE_HAL_SPI_REGISTER_CALLBACKS == 1U)
|
||||
HAL_StatusTypeDef HAL_SPI_RegisterCallback(SPI_HandleTypeDef *hspi, HAL_SPI_CallbackIDTypeDef CallbackID,
|
||||
pSPI_CallbackTypeDef pCallback);
|
||||
HAL_StatusTypeDef HAL_SPI_UnRegisterCallback(SPI_HandleTypeDef *hspi, HAL_SPI_CallbackIDTypeDef CallbackID);
|
||||
#endif /* USE_HAL_SPI_REGISTER_CALLBACKS */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @addtogroup SPI_Exported_Functions_Group2
|
||||
* @{
|
||||
*/
|
||||
/* I/O operation functions ***************************************************/
|
||||
HAL_StatusTypeDef HAL_SPI_Transmit(SPI_HandleTypeDef *hspi, const uint8_t *pData, uint16_t Size, uint32_t Timeout);
|
||||
HAL_StatusTypeDef HAL_SPI_Receive(SPI_HandleTypeDef *hspi, uint8_t *pData, uint16_t Size, uint32_t Timeout);
|
||||
HAL_StatusTypeDef HAL_SPI_TransmitReceive(SPI_HandleTypeDef *hspi, const uint8_t *pTxData, uint8_t *pRxData,
|
||||
uint16_t Size, uint32_t Timeout);
|
||||
HAL_StatusTypeDef HAL_SPI_Transmit_IT(SPI_HandleTypeDef *hspi, const uint8_t *pData, uint16_t Size);
|
||||
HAL_StatusTypeDef HAL_SPI_Receive_IT(SPI_HandleTypeDef *hspi, uint8_t *pData, uint16_t Size);
|
||||
HAL_StatusTypeDef HAL_SPI_TransmitReceive_IT(SPI_HandleTypeDef *hspi, const uint8_t *pTxData, uint8_t *pRxData,
|
||||
uint16_t Size);
|
||||
HAL_StatusTypeDef HAL_SPI_Transmit_DMA(SPI_HandleTypeDef *hspi, const uint8_t *pData, uint16_t Size);
|
||||
HAL_StatusTypeDef HAL_SPI_Receive_DMA(SPI_HandleTypeDef *hspi, uint8_t *pData, uint16_t Size);
|
||||
HAL_StatusTypeDef HAL_SPI_TransmitReceive_DMA(SPI_HandleTypeDef *hspi, const uint8_t *pTxData, uint8_t *pRxData,
|
||||
uint16_t Size);
|
||||
HAL_StatusTypeDef HAL_SPI_DMAPause(SPI_HandleTypeDef *hspi);
|
||||
HAL_StatusTypeDef HAL_SPI_DMAResume(SPI_HandleTypeDef *hspi);
|
||||
HAL_StatusTypeDef HAL_SPI_DMAStop(SPI_HandleTypeDef *hspi);
|
||||
/* Transfer Abort functions */
|
||||
HAL_StatusTypeDef HAL_SPI_Abort(SPI_HandleTypeDef *hspi);
|
||||
HAL_StatusTypeDef HAL_SPI_Abort_IT(SPI_HandleTypeDef *hspi);
|
||||
|
||||
void HAL_SPI_IRQHandler(SPI_HandleTypeDef *hspi);
|
||||
void HAL_SPI_TxCpltCallback(SPI_HandleTypeDef *hspi);
|
||||
void HAL_SPI_RxCpltCallback(SPI_HandleTypeDef *hspi);
|
||||
void HAL_SPI_TxRxCpltCallback(SPI_HandleTypeDef *hspi);
|
||||
void HAL_SPI_TxHalfCpltCallback(SPI_HandleTypeDef *hspi);
|
||||
void HAL_SPI_RxHalfCpltCallback(SPI_HandleTypeDef *hspi);
|
||||
void HAL_SPI_TxRxHalfCpltCallback(SPI_HandleTypeDef *hspi);
|
||||
void HAL_SPI_ErrorCallback(SPI_HandleTypeDef *hspi);
|
||||
void HAL_SPI_AbortCpltCallback(SPI_HandleTypeDef *hspi);
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @addtogroup SPI_Exported_Functions_Group3
|
||||
* @{
|
||||
*/
|
||||
/* Peripheral State and Error functions ***************************************/
|
||||
HAL_SPI_StateTypeDef HAL_SPI_GetState(const SPI_HandleTypeDef *hspi);
|
||||
uint32_t HAL_SPI_GetError(const SPI_HandleTypeDef *hspi);
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* STM32F4xx_HAL_SPI_H */
|
||||
|
||||
2027
Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_spi.h
Normal file
2027
Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_spi.h
Normal file
File diff suppressed because it is too large
Load Diff
4096
Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_tim.h
Normal file
4096
Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_tim.h
Normal file
File diff suppressed because it is too large
Load Diff
2092
Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_i2s.c
Normal file
2092
Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_i2s.c
Normal file
File diff suppressed because it is too large
Load Diff
1131
Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_i2s_ex.c
Normal file
1131
Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_i2s_ex.c
Normal file
File diff suppressed because it is too large
Load Diff
3930
Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_spi.c
Normal file
3930
Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_spi.c
Normal file
File diff suppressed because it is too large
Load Diff
112
test1.ioc
112
test1.ioc
@@ -12,40 +12,62 @@ CAD.pinconfig=
|
||||
CAD.provider=
|
||||
File.Version=6
|
||||
GPIO.groupedBy=Group By Peripherals
|
||||
I2S2.AudioFreq=I2S_AUDIOFREQ_48K
|
||||
I2S2.DataFormat=I2S_DATAFORMAT_16B
|
||||
I2S2.ErrorAudioFreq=-0.79 %
|
||||
I2S2.FullDuplexMode=I2S_FULLDUPLEXMODE_DISABLE
|
||||
I2S2.IPParameters=Instance,VirtualMode,FullDuplexMode,RealAudioFreq,ErrorAudioFreq,Mode,DataFormat,AudioFreq
|
||||
I2S2.Instance=SPI$Index
|
||||
I2S2.Mode=I2S_MODE_MASTER_RX
|
||||
I2S2.RealAudioFreq=47.619 KHz
|
||||
I2S2.VirtualMode=I2S_MODE_MASTER
|
||||
KeepUserPlacement=false
|
||||
Mcu.CPN=STM32F407VGT6
|
||||
Mcu.Family=STM32F4
|
||||
Mcu.IP0=ADC1
|
||||
Mcu.IP1=I2C1
|
||||
Mcu.IP2=NVIC
|
||||
Mcu.IP3=RCC
|
||||
Mcu.IP4=SYS
|
||||
Mcu.IPNb=5
|
||||
Mcu.IP2=I2S2
|
||||
Mcu.IP3=NVIC
|
||||
Mcu.IP4=RCC
|
||||
Mcu.IP5=SPI1
|
||||
Mcu.IP6=SYS
|
||||
Mcu.IP7=TIM2
|
||||
Mcu.IPNb=8
|
||||
Mcu.Name=STM32F407V(E-G)Tx
|
||||
Mcu.Package=LQFP100
|
||||
Mcu.Pin0=PA0-WKUP
|
||||
Mcu.Pin1=PB1
|
||||
Mcu.Pin10=PD13
|
||||
Mcu.Pin11=PD14
|
||||
Mcu.Pin12=PD15
|
||||
Mcu.Pin13=PC6
|
||||
Mcu.Pin14=PC8
|
||||
Mcu.Pin15=PC9
|
||||
Mcu.Pin16=PA15
|
||||
Mcu.Pin17=PC11
|
||||
Mcu.Pin18=PB6
|
||||
Mcu.Pin19=PB7
|
||||
Mcu.Pin2=PE7
|
||||
Mcu.Pin20=PB9
|
||||
Mcu.Pin21=VP_SYS_VS_Systick
|
||||
Mcu.Pin3=PE10
|
||||
Mcu.Pin4=PE11
|
||||
Mcu.Pin5=PE12
|
||||
Mcu.Pin6=PE13
|
||||
Mcu.Pin7=PE14
|
||||
Mcu.Pin8=PE15
|
||||
Mcu.Pin9=PD12
|
||||
Mcu.PinsNb=22
|
||||
Mcu.Pin0=PC3
|
||||
Mcu.Pin1=PA0-WKUP
|
||||
Mcu.Pin10=PE15
|
||||
Mcu.Pin11=PB10
|
||||
Mcu.Pin12=PB12
|
||||
Mcu.Pin13=PD11
|
||||
Mcu.Pin14=PD12
|
||||
Mcu.Pin15=PD13
|
||||
Mcu.Pin16=PD14
|
||||
Mcu.Pin17=PD15
|
||||
Mcu.Pin18=PC6
|
||||
Mcu.Pin19=PC8
|
||||
Mcu.Pin2=PA5
|
||||
Mcu.Pin20=PC9
|
||||
Mcu.Pin21=PA15
|
||||
Mcu.Pin22=PC11
|
||||
Mcu.Pin23=PD4
|
||||
Mcu.Pin24=PD7
|
||||
Mcu.Pin25=PB4
|
||||
Mcu.Pin26=PB5
|
||||
Mcu.Pin27=PB6
|
||||
Mcu.Pin28=PB7
|
||||
Mcu.Pin29=PB9
|
||||
Mcu.Pin3=PB1
|
||||
Mcu.Pin30=VP_SYS_VS_Systick
|
||||
Mcu.Pin31=VP_TIM2_VS_ClockSourceINT
|
||||
Mcu.Pin4=PE7
|
||||
Mcu.Pin5=PE10
|
||||
Mcu.Pin6=PE11
|
||||
Mcu.Pin7=PE12
|
||||
Mcu.Pin8=PE13
|
||||
Mcu.Pin9=PE14
|
||||
Mcu.PinsNb=32
|
||||
Mcu.ThirdPartyNb=0
|
||||
Mcu.UserConstants=
|
||||
Mcu.UserName=STM32F407VGTx
|
||||
@@ -66,8 +88,21 @@ PA0-WKUP.Locked=true
|
||||
PA0-WKUP.Signal=GPIO_Input
|
||||
PA15.Locked=true
|
||||
PA15.Signal=GPIO_Input
|
||||
PA5.Mode=Full_Duplex_Master
|
||||
PA5.Signal=SPI1_SCK
|
||||
PB1.Locked=true
|
||||
PB1.Signal=ADCx_IN9
|
||||
PB10.Locked=true
|
||||
PB10.Mode=Half_Duplex_Master
|
||||
PB10.Signal=I2S2_CK
|
||||
PB12.Mode=Half_Duplex_Master
|
||||
PB12.Signal=I2S2_WS
|
||||
PB4.Locked=true
|
||||
PB4.Mode=Full_Duplex_Master
|
||||
PB4.Signal=SPI1_MISO
|
||||
PB5.Locked=true
|
||||
PB5.Mode=Full_Duplex_Master
|
||||
PB5.Signal=SPI1_MOSI
|
||||
PB6.Mode=I2C
|
||||
PB6.Signal=I2C1_SCL
|
||||
PB7.Locked=true
|
||||
@@ -77,12 +112,19 @@ PB9.Mode=I2C
|
||||
PB9.Signal=I2C1_SDA
|
||||
PC11.Locked=true
|
||||
PC11.Signal=GPIO_Input
|
||||
PC3.Locked=true
|
||||
PC3.Mode=Half_Duplex_Master
|
||||
PC3.Signal=I2S2_SD
|
||||
PC6.Locked=true
|
||||
PC6.Signal=GPIO_Input
|
||||
PC8.Locked=true
|
||||
PC8.Signal=GPIO_Input
|
||||
PC9.Locked=true
|
||||
PC9.Signal=GPIO_Input
|
||||
PD11.GPIOParameters=GPIO_Speed
|
||||
PD11.GPIO_Speed=GPIO_SPEED_FREQ_VERY_HIGH
|
||||
PD11.Locked=true
|
||||
PD11.Signal=GPIO_Output
|
||||
PD12.Locked=true
|
||||
PD12.Signal=GPIO_Output
|
||||
PD13.Locked=true
|
||||
@@ -91,6 +133,10 @@ PD14.Locked=true
|
||||
PD14.Signal=GPIO_Output
|
||||
PD15.Locked=true
|
||||
PD15.Signal=GPIO_Output
|
||||
PD4.Locked=true
|
||||
PD4.Signal=GPIO_Output
|
||||
PD7.Locked=true
|
||||
PD7.Signal=GPIO_Output
|
||||
PE10.Locked=true
|
||||
PE10.Signal=GPIO_Output
|
||||
PE11.Locked=true
|
||||
@@ -136,7 +182,7 @@ ProjectManager.ToolChainLocation=
|
||||
ProjectManager.UAScriptAfterPath=
|
||||
ProjectManager.UAScriptBeforePath=
|
||||
ProjectManager.UnderRoot=true
|
||||
ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false,2-MX_GPIO_Init-GPIO-false-HAL-true,3-MX_ADC1_Init-ADC1-false-HAL-true
|
||||
ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false,2-MX_GPIO_Init-GPIO-false-HAL-true,3-MX_ADC1_Init-ADC1-false-HAL-true,4-MX_I2C1_Init-I2C1-false-HAL-true,5-MX_SPI1_Init-SPI1-false-HAL-true,6-MX_TIM2_Init-TIM2-false-HAL-true,7-MX_I2S2_Init-I2S2-false-HAL-true
|
||||
RCC.AHBFreq_Value=16000000
|
||||
RCC.APB1Freq_Value=16000000
|
||||
RCC.APB1TimFreq_Value=16000000
|
||||
@@ -165,7 +211,17 @@ RCC.VCOOutputFreq_Value=192000000
|
||||
RCC.VcooutputI2S=96000000
|
||||
SH.ADCx_IN9.0=ADC1_IN9,IN9
|
||||
SH.ADCx_IN9.ConfNb=1
|
||||
SPI1.BaudRatePrescaler=SPI_BAUDRATEPRESCALER_16
|
||||
SPI1.CalculateBaudRate=1000.0 KBits/s
|
||||
SPI1.Direction=SPI_DIRECTION_2LINES
|
||||
SPI1.IPParameters=VirtualType,Mode,Direction,CalculateBaudRate,BaudRatePrescaler
|
||||
SPI1.Mode=SPI_MODE_MASTER
|
||||
SPI1.VirtualType=VM_MASTER
|
||||
TIM2.IPParameters=Period
|
||||
TIM2.Period=0xffffffff
|
||||
VP_SYS_VS_Systick.Mode=SysTick
|
||||
VP_SYS_VS_Systick.Signal=SYS_VS_Systick
|
||||
VP_TIM2_VS_ClockSourceINT.Mode=Internal
|
||||
VP_TIM2_VS_ClockSourceINT.Signal=TIM2_VS_ClockSourceINT
|
||||
board=custom
|
||||
isbadioc=false
|
||||
|
||||
Reference in New Issue
Block a user