Adding FreeRToS constructs to I2C driver
This commit is contained in:
@@ -110,120 +110,6 @@
|
|||||||
</storageModule>
|
</storageModule>
|
||||||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||||
</cconfiguration>
|
</cconfiguration>
|
||||||
<cconfiguration id="fr.ac6.managedbuild.config.gnu.cross.exe.release.723264573">
|
|
||||||
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="fr.ac6.managedbuild.config.gnu.cross.exe.release.723264573" moduleId="org.eclipse.cdt.core.settings" name="Release">
|
|
||||||
<externalSettings/>
|
|
||||||
<extensions>
|
|
||||||
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
|
|
||||||
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
|
||||||
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
|
||||||
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
|
||||||
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
|
|
||||||
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
|
||||||
</extensions>
|
|
||||||
</storageModule>
|
|
||||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
|
||||||
<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="fr.ac6.managedbuild.config.gnu.cross.exe.release.723264573" name="Release" parent="fr.ac6.managedbuild.config.gnu.cross.exe.release" postannouncebuildStep="Generating binary and Printing size information:" postbuildStep="arm-none-eabi-objcopy -O binary "${BuildArtifactFileBaseName}.elf" "${BuildArtifactFileBaseName}.bin"; arm-none-eabi-size -B "${BuildArtifactFileName}" ;arm-none-eabi-objcopy -O ihex "${BuildArtifactFileBaseName}.elf" "${BuildArtifactFileBaseName}.hex"">
|
|
||||||
<folderInfo id="fr.ac6.managedbuild.config.gnu.cross.exe.release.723264573." name="/" resourcePath="">
|
|
||||||
<toolChain id="fr.ac6.managedbuild.toolchain.gnu.cross.exe.release.1456567544" name="Ac6 STM32 MCU GCC" superClass="fr.ac6.managedbuild.toolchain.gnu.cross.exe.release">
|
|
||||||
<option id="fr.ac6.managedbuild.option.gnu.cross.mcu.67332574" name="Mcu" superClass="fr.ac6.managedbuild.option.gnu.cross.mcu" useByScannerDiscovery="false" value="STM32F103T8Ux" valueType="string"/>
|
|
||||||
<option id="fr.ac6.managedbuild.option.gnu.cross.board.1570943989" name="Board" superClass="fr.ac6.managedbuild.option.gnu.cross.board" useByScannerDiscovery="false" value="ts100" valueType="string"/>
|
|
||||||
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="fr.ac6.managedbuild.targetPlatform.gnu.cross.793444160" isAbstract="false" osList="all" superClass="fr.ac6.managedbuild.targetPlatform.gnu.cross"/>
|
|
||||||
<builder buildPath="${workspace_loc:/TS100}/Release" id="fr.ac6.managedbuild.builder.gnu.cross.548236022" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="fr.ac6.managedbuild.builder.gnu.cross"/>
|
|
||||||
<tool id="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.1363306495" name="MCU GCC Compiler" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.compiler">
|
|
||||||
<option id="fr.ac6.managedbuild.gnu.c.compiler.option.optimization.level.1100266163" name="Optimization Level" superClass="fr.ac6.managedbuild.gnu.c.compiler.option.optimization.level" useByScannerDiscovery="false" value="fr.ac6.managedbuild.gnu.c.optimization.level.more" valueType="enumerated"/>
|
|
||||||
<option id="gnu.c.compiler.option.debugging.level.2139237845" name="Debug Level" superClass="gnu.c.compiler.option.debugging.level" useByScannerDiscovery="false" value="gnu.c.debugging.level.max" valueType="enumerated"/>
|
|
||||||
<option id="gnu.c.compiler.option.include.paths.1770182855" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath">
|
|
||||||
<listOptionValue builtIn="false" value=""${ProjDirPath}/inc""/>
|
|
||||||
<listOptionValue builtIn="false" value=""${ProjDirPath}/CMSIS/core""/>
|
|
||||||
<listOptionValue builtIn="false" value=""${ProjDirPath}/CMSIS/device""/>
|
|
||||||
<listOptionValue builtIn="false" value=""${ProjDirPath}/HAL_Driver/Inc/Legacy""/>
|
|
||||||
<listOptionValue builtIn="false" value=""${ProjDirPath}/HAL_Driver/Inc""/>
|
|
||||||
<listOptionValue builtIn="false" value=""${ProjDirPath}/Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS""/>
|
|
||||||
<listOptionValue builtIn="false" value=""${ProjDirPath}/Middlewares/Third_Party/FreeRTOS/Source/include""/>
|
|
||||||
<listOptionValue builtIn="false" value=""${ProjDirPath}/Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM3""/>
|
|
||||||
</option>
|
|
||||||
<option id="gnu.c.compiler.option.preprocessor.def.symbols.1423042308" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" useByScannerDiscovery="false" valueType="definedSymbols">
|
|
||||||
<listOptionValue builtIn="false" value="STM32F103T8Ux"/>
|
|
||||||
<listOptionValue builtIn="false" value="STM32F1"/>
|
|
||||||
<listOptionValue builtIn="false" value="STM32"/>
|
|
||||||
<listOptionValue builtIn="false" value="USE_HAL_DRIVER"/>
|
|
||||||
<listOptionValue builtIn="false" value="STM32F103xB"/>
|
|
||||||
<listOptionValue builtIn="false" value="USE_RTOS_SYSTICK"/>
|
|
||||||
</option>
|
|
||||||
<option id="gnu.c.compiler.option.dialect.std.356859384" name="Language standard" superClass="gnu.c.compiler.option.dialect.std" useByScannerDiscovery="true" value="gnu.c.compiler.dialect.default" valueType="enumerated"/>
|
|
||||||
<option id="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.fdata.1580070223" name="Place the data in their own section (-fdata-sections)" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.fdata" useByScannerDiscovery="false" value="true" valueType="boolean"/>
|
|
||||||
<option id="gnu.c.compiler.option.misc.pic.1841660469" name="Position Independent Code (-fPIC)" superClass="gnu.c.compiler.option.misc.pic" useByScannerDiscovery="false" value="false" valueType="boolean"/>
|
|
||||||
<inputType id="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.input.c.747173367" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.input.c"/>
|
|
||||||
<inputType id="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.input.s.1210653460" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.input.s"/>
|
|
||||||
</tool>
|
|
||||||
<tool id="fr.ac6.managedbuild.tool.gnu.cross.cpp.compiler.1414722294" name="MCU G++ Compiler" superClass="fr.ac6.managedbuild.tool.gnu.cross.cpp.compiler">
|
|
||||||
<option id="fr.ac6.managedbuild.gnu.cpp.compiler.option.optimization.level.1489744363" name="Optimization Level" superClass="fr.ac6.managedbuild.gnu.cpp.compiler.option.optimization.level" useByScannerDiscovery="false" value="fr.ac6.managedbuild.gnu.cpp.optimization.level.more" valueType="enumerated"/>
|
|
||||||
<option id="gnu.cpp.compiler.option.debugging.level.641509376" name="Debug Level" superClass="gnu.cpp.compiler.option.debugging.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/>
|
|
||||||
<option id="gnu.cpp.compiler.option.include.paths.105977434" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath">
|
|
||||||
<listOptionValue builtIn="false" value=""${ProjDirPath}/inc""/>
|
|
||||||
<listOptionValue builtIn="false" value=""${ProjDirPath}/CMSIS/core""/>
|
|
||||||
<listOptionValue builtIn="false" value=""${ProjDirPath}/CMSIS/device""/>
|
|
||||||
<listOptionValue builtIn="false" value=""${ProjDirPath}/HAL_Driver/Inc/Legacy""/>
|
|
||||||
<listOptionValue builtIn="false" value=""${ProjDirPath}/HAL_Driver/Inc""/>
|
|
||||||
<listOptionValue builtIn="false" value=""${ProjDirPath}/Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS""/>
|
|
||||||
<listOptionValue builtIn="false" value=""${ProjDirPath}/Middlewares/Third_Party/FreeRTOS/Source/include""/>
|
|
||||||
<listOptionValue builtIn="false" value=""${ProjDirPath}/Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM3""/>
|
|
||||||
</option>
|
|
||||||
<option id="gnu.cpp.compiler.option.preprocessor.def.158062035" name="Defined symbols (-D)" superClass="gnu.cpp.compiler.option.preprocessor.def" useByScannerDiscovery="false" valueType="definedSymbols">
|
|
||||||
<listOptionValue builtIn="false" value="STM32F103T8Ux"/>
|
|
||||||
<listOptionValue builtIn="false" value="STM32F1"/>
|
|
||||||
<listOptionValue builtIn="false" value="STM32"/>
|
|
||||||
<listOptionValue builtIn="false" value="USE_HAL_DRIVER"/>
|
|
||||||
<listOptionValue builtIn="false" value="STM32F103xB"/>
|
|
||||||
<listOptionValue builtIn="false" value="USE_RTOS_SYSTICK"/>
|
|
||||||
</option>
|
|
||||||
<option id="gnu.cpp.compiler.option.dialect.std.2101054556" name="Language standard" superClass="gnu.cpp.compiler.option.dialect.std" useByScannerDiscovery="true" value="gnu.cpp.compiler.dialect.default" valueType="enumerated"/>
|
|
||||||
<option id="fr.ac6.managedbuild.tool.gnu.cross.cpp.compiler.fdata.1877154487" name="Place the data in their own section (-fdata-sections)" superClass="fr.ac6.managedbuild.tool.gnu.cross.cpp.compiler.fdata" useByScannerDiscovery="false" value="true" valueType="boolean"/>
|
|
||||||
<inputType id="fr.ac6.managedbuild.tool.gnu.cross.cpp.compiler.input.cpp.688034595" superClass="fr.ac6.managedbuild.tool.gnu.cross.cpp.compiler.input.cpp"/>
|
|
||||||
<inputType id="fr.ac6.managedbuild.tool.gnu.cross.cpp.compiler.input.s.6473827" superClass="fr.ac6.managedbuild.tool.gnu.cross.cpp.compiler.input.s"/>
|
|
||||||
</tool>
|
|
||||||
<tool id="fr.ac6.managedbuild.tool.gnu.cross.c.linker.1409185098" name="MCU GCC Linker" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.linker"/>
|
|
||||||
<tool id="fr.ac6.managedbuild.tool.gnu.cross.cpp.linker.162825548" name="MCU G++ Linker" superClass="fr.ac6.managedbuild.tool.gnu.cross.cpp.linker">
|
|
||||||
<option id="gnu.cpp.link.option.strip.459660118" name="Omit all symbol information (-s)" superClass="gnu.cpp.link.option.strip" useByScannerDiscovery="false" value="true" valueType="boolean"/>
|
|
||||||
<option id="fr.ac6.managedbuild.tool.gnu.cross.cpp.linker.gcsections.664103720" name="Discard unused sections (-Wl,--gc-sections)" superClass="fr.ac6.managedbuild.tool.gnu.cross.cpp.linker.gcsections" useByScannerDiscovery="false" value="true" valueType="boolean"/>
|
|
||||||
<inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.1735005640" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
|
|
||||||
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
|
|
||||||
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
|
|
||||||
</inputType>
|
|
||||||
</tool>
|
|
||||||
<tool id="fr.ac6.managedbuild.tool.gnu.archiver.907512577" name="MCU GCC Archiver" superClass="fr.ac6.managedbuild.tool.gnu.archiver"/>
|
|
||||||
<tool id="fr.ac6.managedbuild.tool.gnu.cross.assembler.1906472572" name="MCU GCC Assembler" superClass="fr.ac6.managedbuild.tool.gnu.cross.assembler">
|
|
||||||
<option id="gnu.both.asm.option.include.paths.1277819409" name="Include paths (-I)" superClass="gnu.both.asm.option.include.paths" useByScannerDiscovery="false" valueType="includePath">
|
|
||||||
<listOptionValue builtIn="false" value=""${ProjDirPath}/inc""/>
|
|
||||||
<listOptionValue builtIn="false" value=""${ProjDirPath}/CMSIS/core""/>
|
|
||||||
<listOptionValue builtIn="false" value=""${ProjDirPath}/CMSIS/device""/>
|
|
||||||
<listOptionValue builtIn="false" value=""${ProjDirPath}/HAL_Driver/Inc/Legacy""/>
|
|
||||||
<listOptionValue builtIn="false" value=""${ProjDirPath}/HAL_Driver/Inc""/>
|
|
||||||
<listOptionValue builtIn="false" value=""${ProjDirPath}/Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS""/>
|
|
||||||
<listOptionValue builtIn="false" value=""${ProjDirPath}/Middlewares/Third_Party/FreeRTOS/Source/include""/>
|
|
||||||
<listOptionValue builtIn="false" value=""${ProjDirPath}/Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM3""/>
|
|
||||||
</option>
|
|
||||||
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.1588000933" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
|
|
||||||
<inputType id="fr.ac6.managedbuild.tool.gnu.cross.assembler.input.1118741214" superClass="fr.ac6.managedbuild.tool.gnu.cross.assembler.input"/>
|
|
||||||
</tool>
|
|
||||||
<tool id="fr.ac6.managedbuild.tool.gnu.cross.assembler.exe.release.63862661" name="MCU GCC Assembler" superClass="fr.ac6.managedbuild.tool.gnu.cross.assembler.exe.release">
|
|
||||||
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.983697759" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
|
|
||||||
<inputType id="fr.ac6.managedbuild.tool.gnu.cross.assembler.input.1721181053" superClass="fr.ac6.managedbuild.tool.gnu.cross.assembler.input"/>
|
|
||||||
</tool>
|
|
||||||
</toolChain>
|
|
||||||
</folderInfo>
|
|
||||||
<sourceEntries>
|
|
||||||
<entry excluding="Src/stm32f1xx_hal_timebase_tim_template.c|Src/stm32f1xx_hal_timebase_rtc_wakeup_template.c|Src/stm32f1xx_hal_timebase_rtc_alarm_template.c" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="HAL_Driver"/>
|
|
||||||
<entry excluding="Third_Party/FreeRTOS/Source/portable/MemMang/heap_1.c|Third_Party/FreeRTOS/Source/portable/MemMang/heap_2.c|Third_Party/FreeRTOS/Source/portable/MemMang/heap_3.c|Third_Party/FreeRTOS/Source/portable/MemMang/heap_5.c" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Middlewares"/>
|
|
||||||
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="inc"/>
|
|
||||||
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src"/>
|
|
||||||
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="startup"/>
|
|
||||||
</sourceEntries>
|
|
||||||
</configuration>
|
|
||||||
</storageModule>
|
|
||||||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
|
||||||
</cconfiguration>
|
|
||||||
</storageModule>
|
</storageModule>
|
||||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||||
<project id="TS100.fr.ac6.managedbuild.target.gnu.cross.exe.1768512215" name="Executable" projectType="fr.ac6.managedbuild.target.gnu.cross.exe"/>
|
<project id="TS100.fr.ac6.managedbuild.target.gnu.cross.exe.1768512215" name="Executable" projectType="fr.ac6.managedbuild.target.gnu.cross.exe"/>
|
||||||
|
|||||||
@@ -12,16 +12,4 @@
|
|||||||
</provider>
|
</provider>
|
||||||
</extension>
|
</extension>
|
||||||
</configuration>
|
</configuration>
|
||||||
<configuration id="fr.ac6.managedbuild.config.gnu.cross.exe.release.723264573" name="Release">
|
|
||||||
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
|
|
||||||
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
|
|
||||||
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
|
|
||||||
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
|
|
||||||
<provider copy-of="extension" id="org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser"/>
|
|
||||||
<provider class="fr.ac6.mcu.ide.build.CrossBuiltinSpecsDetector" console="false" env-hash="1349131645423570210" id="fr.ac6.mcu.ide.build.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="Ac6 SW4 STM32 MCU Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
|
||||||
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
|
||||||
<language-scope id="org.eclipse.cdt.core.g++"/>
|
|
||||||
</provider>
|
|
||||||
</extension>
|
|
||||||
</configuration>
|
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
27
workspace/TS100/TS100.cfg
Normal file
27
workspace/TS100/TS100.cfg
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
# This is an ts100 board with a single STM32F103T8Ux chip
|
||||||
|
#
|
||||||
|
# Generated by System Workbench for STM32
|
||||||
|
# Take care that such file, as generated, may be overridden without any early notice. Please have a look to debug launch configuration setup(s)
|
||||||
|
|
||||||
|
source [find interface/stlink.cfg]
|
||||||
|
|
||||||
|
set WORKAREASIZE 0x5000
|
||||||
|
|
||||||
|
transport select "hla_swd"
|
||||||
|
|
||||||
|
set CHIPNAME STM32F103T8Ux
|
||||||
|
|
||||||
|
# Enable debug when in low power modes
|
||||||
|
set ENABLE_LOW_POWER 1
|
||||||
|
|
||||||
|
# Stop Watchdog counters when halt
|
||||||
|
set STOP_WATCHDOG 1
|
||||||
|
|
||||||
|
# STlink Debug clock frequency
|
||||||
|
set CLOCK_FREQ 950
|
||||||
|
|
||||||
|
# use software system reset
|
||||||
|
reset_config none
|
||||||
|
set CONNECT_UNDER_RESET 0
|
||||||
|
|
||||||
|
source [find target/stm32f1x.cfg]
|
||||||
@@ -13,20 +13,22 @@
|
|||||||
class FRToSI2C {
|
class FRToSI2C {
|
||||||
public:
|
public:
|
||||||
FRToSI2C(I2C_HandleTypeDef* i2chandle);
|
FRToSI2C(I2C_HandleTypeDef* i2chandle);
|
||||||
|
void FRToSInit();
|
||||||
void MasterTxCpltCallback(); //Normal Tx Callback
|
void MasterTxCpltCallback(); //Normal Tx Callback
|
||||||
void MemRxCpltCallback(); //Callback from memory read cycles
|
void MemRxCpltCallback(); //Callback from memory read cycles
|
||||||
void MemTxCpltCallback(); //Callback from memory write cycles
|
void MemTxCpltCallback(); //Callback from memory write cycles
|
||||||
|
|
||||||
void Mem_Read(uint16_t DevAddress, uint16_t MemAddress, uint16_t MemAddSize,
|
void Mem_Read(uint16_t DevAddress, uint16_t MemAddress, uint16_t MemAddSize,
|
||||||
uint8_t *pData, uint16_t Size);
|
uint8_t *pData, uint16_t Size);
|
||||||
void Mem_Write(uint16_t DevAddress, uint16_t MemAddress, uint16_t MemAddSize,
|
void Mem_Write(uint16_t DevAddress, uint16_t MemAddress,
|
||||||
uint8_t *pData, uint16_t Size);
|
uint16_t MemAddSize, uint8_t *pData, uint16_t Size);
|
||||||
|
|
||||||
void Transmit(uint16_t DevAddress, uint8_t *pData, uint16_t Size);
|
void Transmit(uint16_t DevAddress, uint8_t *pData, uint16_t Size);
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
bool RToSUP=false;
|
||||||
I2C_HandleTypeDef* i2c;
|
I2C_HandleTypeDef* i2c;
|
||||||
|
SemaphoreHandle_t I2CSemaphore;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* FRTOSI2C_HPP_ */
|
#endif /* FRTOSI2C_HPP_ */
|
||||||
|
|||||||
@@ -13,38 +13,81 @@ FRToSI2C::FRToSI2C(I2C_HandleTypeDef* i2chandle) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void FRToSI2C::MasterTxCpltCallback() {
|
void FRToSI2C::MasterTxCpltCallback() {
|
||||||
|
xSemaphoreGive(I2CSemaphore);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FRToSI2C::MemRxCpltCallback() {
|
void FRToSI2C::MemRxCpltCallback() {
|
||||||
|
xSemaphoreGive(I2CSemaphore);
|
||||||
}
|
}
|
||||||
void FRToSI2C::MemTxCpltCallback() {
|
void FRToSI2C::MemTxCpltCallback() {
|
||||||
|
xSemaphoreGive(I2CSemaphore);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FRToSI2C::Mem_Read(uint16_t DevAddress, uint16_t MemAddress,
|
void FRToSI2C::Mem_Read(uint16_t DevAddress, uint16_t MemAddress,
|
||||||
uint16_t MemAddSize, uint8_t* pData, uint16_t Size) {
|
uint16_t MemAddSize, uint8_t* pData, uint16_t Size) {
|
||||||
if (xTaskGetSchedulerState() != taskSCHEDULER_NOT_STARTED)
|
if (xTaskGetSchedulerState() == taskSCHEDULER_NOT_STARTED
|
||||||
taskENTER_CRITICAL();
|
|| RToSUP == false) {
|
||||||
HAL_I2C_Mem_Read(i2c, DevAddress, MemAddress, MemAddSize, pData, Size,
|
//no RToS, run blocking code
|
||||||
5000);
|
HAL_I2C_Mem_Read(i2c, DevAddress, MemAddress, MemAddSize, pData, Size,
|
||||||
if (xTaskGetSchedulerState() != taskSCHEDULER_NOT_STARTED)
|
5000);
|
||||||
taskEXIT_CRITICAL();
|
} else {
|
||||||
|
//RToS is active, run threading
|
||||||
|
//Get the mutex so we can use the I2C port
|
||||||
|
//Wait up to 1 second for the mutex
|
||||||
|
if ( xSemaphoreTake( I2CSemaphore, ( TickType_t ) 1000 ) == pdTRUE) {
|
||||||
|
HAL_I2C_Mem_Read(i2c, DevAddress, MemAddress, MemAddSize, pData,
|
||||||
|
Size, 5000);
|
||||||
|
xSemaphoreGive(I2CSemaphore);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FRToSI2C::Mem_Write(uint16_t DevAddress, uint16_t MemAddress,
|
void FRToSI2C::Mem_Write(uint16_t DevAddress, uint16_t MemAddress,
|
||||||
uint16_t MemAddSize, uint8_t* pData, uint16_t Size) {
|
uint16_t MemAddSize, uint8_t* pData, uint16_t Size) {
|
||||||
if (xTaskGetSchedulerState() != taskSCHEDULER_NOT_STARTED)
|
if (xTaskGetSchedulerState() == taskSCHEDULER_NOT_STARTED
|
||||||
taskENTER_CRITICAL();
|
|| RToSUP == false) {
|
||||||
HAL_I2C_Mem_Write(i2c, DevAddress, MemAddress, MemAddSize, pData, Size,
|
//no RToS, run blocking code
|
||||||
5000);
|
HAL_I2C_Mem_Write(i2c, DevAddress, MemAddress, MemAddSize, pData, Size,
|
||||||
if (xTaskGetSchedulerState() != taskSCHEDULER_NOT_STARTED)
|
5000);
|
||||||
taskEXIT_CRITICAL();
|
} else {
|
||||||
|
//RToS is active, run threading
|
||||||
|
//Get the mutex so we can use the I2C port
|
||||||
|
//Wait up to 1 second for the mutex
|
||||||
|
if ( xSemaphoreTake( I2CSemaphore, ( TickType_t ) 1000 ) == pdTRUE) {
|
||||||
|
HAL_I2C_Mem_Write(i2c, DevAddress, MemAddress, MemAddSize, pData,
|
||||||
|
Size, 5000);
|
||||||
|
xSemaphoreGive(I2CSemaphore);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void FRToSI2C::FRToSInit() {
|
||||||
|
I2CSemaphore = xSemaphoreCreateMutex();
|
||||||
|
xSemaphoreGive(I2CSemaphore);
|
||||||
|
RToSUP = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FRToSI2C::Transmit(uint16_t DevAddress, uint8_t* pData, uint16_t Size) {
|
void FRToSI2C::Transmit(uint16_t DevAddress, uint8_t* pData, uint16_t Size) {
|
||||||
if (xTaskGetSchedulerState() != taskSCHEDULER_NOT_STARTED)
|
if (xTaskGetSchedulerState() == taskSCHEDULER_NOT_STARTED
|
||||||
taskENTER_CRITICAL();
|
|| RToSUP == false) {
|
||||||
HAL_I2C_Master_Transmit(i2c, DevAddress, pData, Size, 5000);
|
//no RToS, run blocking code
|
||||||
if (xTaskGetSchedulerState() != taskSCHEDULER_NOT_STARTED)
|
HAL_I2C_Master_Transmit(i2c, DevAddress, pData, Size, 5000);
|
||||||
taskEXIT_CRITICAL();
|
} else {
|
||||||
|
//RToS is active, run threading
|
||||||
|
//Get the mutex so we can use the I2C port
|
||||||
|
//Wait up to 1 second for the mutex
|
||||||
|
if ( xSemaphoreTake( I2CSemaphore, ( TickType_t ) 1000 ) == pdTRUE) {
|
||||||
|
HAL_I2C_Master_Transmit(i2c, DevAddress, pData, Size, 5000);
|
||||||
|
|
||||||
|
xSemaphoreGive(I2CSemaphore);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ OLED::OLED(FRToSI2C* i2cHandle) {
|
|||||||
|
|
||||||
void OLED::initialize() {
|
void OLED::initialize() {
|
||||||
HAL_Delay(5);
|
HAL_Delay(5);
|
||||||
|
|
||||||
HAL_GPIO_WritePin(OLED_RESET_GPIO_Port, OLED_RESET_Pin, GPIO_PIN_SET);
|
HAL_GPIO_WritePin(OLED_RESET_GPIO_Port, OLED_RESET_Pin, GPIO_PIN_SET);
|
||||||
HAL_Delay(5);
|
HAL_Delay(5);
|
||||||
//Send the setup settings
|
//Send the setup settings
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ void SystemClock_Config(void) {
|
|||||||
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
|
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
|
||||||
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
|
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
|
||||||
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV16; //TIM 2,3,4,5,6,7,12,13,14
|
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV16; //TIM 2,3,4,5,6,7,12,13,14
|
||||||
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1; //64 mhz to soem peripherals and adc
|
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1; //64 mhz to some peripherals and adc
|
||||||
|
|
||||||
HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2);
|
HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2);
|
||||||
|
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ int main(void) {
|
|||||||
*/
|
*/
|
||||||
HAL_Init();
|
HAL_Init();
|
||||||
Setup_HAL(); // Setup all the HAL objects
|
Setup_HAL(); // Setup all the HAL objects
|
||||||
|
HAL_IWDG_Refresh(&hiwdg);
|
||||||
setTipPWM(0);
|
setTipPWM(0);
|
||||||
lcd.initialize(); // start up the LCD
|
lcd.initialize(); // start up the LCD
|
||||||
lcd.setFont(0); // default to bigger font
|
lcd.setFont(0); // default to bigger font
|
||||||
@@ -641,6 +642,7 @@ static void gui_solderingMode() {
|
|||||||
|
|
||||||
/* StartGUITask function */
|
/* StartGUITask function */
|
||||||
void startGUITask(void const *argument) {
|
void startGUITask(void const *argument) {
|
||||||
|
i2cDev.FRToSInit();
|
||||||
/*
|
/*
|
||||||
* Main program states:
|
* Main program states:
|
||||||
*
|
*
|
||||||
@@ -1085,3 +1087,16 @@ void HAL_ADCEx_InjectedConvCpltCallback(ADC_HandleTypeDef* hadc) {
|
|||||||
portYIELD_FROM_ISR(xHigherPriorityTaskWoken);
|
portYIELD_FROM_ISR(xHigherPriorityTaskWoken);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void HAL_I2C_MasterRxCpltCallback(I2C_HandleTypeDef *hi2c) {
|
||||||
|
}
|
||||||
|
void HAL_I2C_MasterTxCpltCallback(I2C_HandleTypeDef *hi2c) {
|
||||||
|
i2cDev.MasterTxCpltCallback();
|
||||||
|
}
|
||||||
|
void HAL_I2C_MemTxCpltCallback(I2C_HandleTypeDef *hi2c) {
|
||||||
|
i2cDev.MemTxCpltCallback();
|
||||||
|
}
|
||||||
|
|
||||||
|
void HAL_I2C_MemRxCpltCallback(I2C_HandleTypeDef *hi2c) {
|
||||||
|
i2cDev.MemRxCpltCallback();
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user