...
 
Commits (6)
......@@ -25,7 +25,7 @@
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.floatabi.1115574125" name="Floating-point ABI" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.floatabi" 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.2126884966" name="Board" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_board" value="genericBoard" valueType="string"/>
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.defaults.1683093711" name="Defaults" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.defaults" value="com.st.stm32cube.ide.common.services.build.inputs.revA.1.0.3 || Debug || true || Executable || com.st.stm32cube.ide.mcu.gnu.managedbuild.toolchain.base.gnu-tools-for-stm32 || STM32G431CBTx || 0 || 0 || arm-none-eabi- || ${gnu_tools_for_stm32_compiler_path} || ../Drivers/STM32G4xx_HAL_Driver/Inc/Legacy | ../Inc | ../Drivers/CMSIS/Include | ../Drivers/CMSIS/Device/ST/STM32G4xx/Include | ../Drivers/STM32G4xx_HAL_Driver/Inc || || || STM32G431xx | USE_HAL_DRIVER || || Drivers | Src | Startup || || || ${workspace_loc:/${ProjName}/STM32G431CBTX_FLASH.ld} || true || NonSecure || || secure_nsclib.o || " valueType="string"/>
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.runtimelibrary_cpp.1788208957" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.runtimelibrary_cpp" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.runtimelibrary_cpp.value.standard_c_standard_cpp" valueType="enumerated"/>
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.runtimelibrary_cpp.1788208957" name="Runtime library" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.runtimelibrary_cpp" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.runtimelibrary_cpp.value.standard_c_standard_cpp" valueType="enumerated"/>
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.targetplatform.321370822" isAbstract="false" osList="all" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.targetplatform"/>
<builder buildPath="${workspace_loc:/BaliseEvitement}/Debug" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.builder.888988885" keepEnvironmentInBuildfile="false" 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.1969197452" name="MCU GCC Assembler" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler">
......@@ -51,6 +51,7 @@
<listOptionValue builtIn="false" value="../Drivers/STM32G4xx_HAL_Driver/Inc"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/BaliseEvitement/BaliseEvitement/library/type}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/BaliseEvitement/BaliseEvitement/library/capteur}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/BaliseEvitement/BaliseEvitement/library/routine}&quot;"/>
</option>
<inputType id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.input.c.1094913445" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.input.c"/>
</tool>
......@@ -67,6 +68,7 @@
<listOptionValue builtIn="false" value="../Drivers/STM32G4xx_HAL_Driver/Inc"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/BaliseEvitement/BaliseEvitement/library/type}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/BaliseEvitement/BaliseEvitement/library/capteur}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/BaliseEvitement/BaliseEvitement/library/routine}&quot;"/>
</option>
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.compiler.option.definedsymbols.1286912941" name="Define symbols (-D)" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.compiler.option.definedsymbols" useByScannerDiscovery="false" valueType="definedSymbols">
<listOptionValue builtIn="false" value="STM32G431xx"/>
......@@ -101,10 +103,10 @@
</toolChain>
</folderInfo>
<sourceEntries>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Startup"/>
<entry excluding="library/template/|library/actionneur/|library/routine/|library/trajectoire/|library/capteur/Encodeur.cpp|library/capteur/Encodeur.h" flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="BaliseEvitement"/>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Src"/>
<entry excluding="library/template/|library/actionneur/|library/trajectoire/|library/capteur/Encodeur.cpp|library/capteur/Encodeur.h|library/routine/evitement.h|library/routine/evitemment.cpp|library/routine/routine.cpp|library/routine/routine.h" flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="BaliseEvitement"/>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Drivers"/>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Src"/>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Startup"/>
</sourceEntries>
</configuration>
</storageModule>
......
This diff is collapsed.
......@@ -6,7 +6,7 @@
<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="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="507204436783529902" id="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="MCU ARM GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<provider class="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="1099732690713110670" id="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="MCU ARM GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>
......@@ -18,7 +18,7 @@
<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="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="507204436783529902" id="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="MCU ARM GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<provider class="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="1099732690713110670" id="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="MCU ARM GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>
......@@ -30,7 +30,7 @@
<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="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="507204436783529902" id="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="MCU ARM GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<provider class="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="1099732690713110670" id="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="MCU ARM GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>
......@@ -42,7 +42,7 @@
<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="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="507204436783529902" id="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="MCU ARM GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<provider class="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="1099732690713110670" id="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="MCU ARM GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>
......@@ -54,7 +54,7 @@
<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="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="507204436783529902" id="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="MCU ARM GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<provider class="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="1099732690713110670" id="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="MCU ARM GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>
......@@ -66,7 +66,7 @@
<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="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="507204436783529902" id="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="MCU ARM GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<provider class="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="1099732690713110670" id="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="MCU ARM GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>
......
......@@ -54,8 +54,11 @@ NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false
NVIC.DebugMonitor_IRQn=true\:0\:0\:false\:false\:true\:false\:false
NVIC.ForceEnableDMAVector=true
NVIC.HardFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false
NVIC.I2C1_ER_IRQn=true\:0\:0\:false\:false\:true\:true\:true
NVIC.I2C1_EV_IRQn=true\:0\:0\:false\:false\:true\:true\:true
NVIC.I2C2_ER_IRQn=true\:0\:0\:false\:false\:true\:true\:true
NVIC.I2C2_EV_IRQn=true\:0\:0\:false\:false\:true\:true\:true
NVIC.I2C3_ER_IRQn=true\:0\:0\:false\:false\:true\:true\:true
NVIC.I2C3_EV_IRQn=true\:0\:0\:false\:false\:true\:true\:true
NVIC.MemoryManagement_IRQn=true\:0\:0\:false\:false\:true\:false\:false
NVIC.NonMaskableInt_IRQn=true\:0\:0\:false\:false\:true\:false\:false
......@@ -147,18 +150,10 @@ PC13.GPIO_Label=CP0
PC13.Locked=true
PC13.PinState=GPIO_PIN_SET
PC13.Signal=GPIO_Output
PCC.Checker=true
PCC.Line=STM32G4x1
PCC.MCU=STM32G431C(6-8-B)Tx
PCC.PartNumber=STM32G431CBTx
PCC.Seq0=0
PCC.Series=STM32G4
PCC.Temperature=25
PCC.Vdd=3.0
PF0-OSC_IN.Mode=I2C
PF0-OSC_IN.Signal=I2C2_SDA
PinOutPanel.RotationAngle=0
ProjectManager.AskForMigrate=true
ProjectManager.AskForMigrate=false
ProjectManager.BackupPrevious=false
ProjectManager.CompilerOptimize=6
ProjectManager.ComputerToolchain=false
......@@ -184,7 +179,7 @@ ProjectManager.StackSize=0x400
ProjectManager.TargetToolchain=STM32CubeIDE
ProjectManager.ToolChainLocation=
ProjectManager.UnderRoot=true
ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false-HAL-true,2-SystemClock_Config-RCC-false-HAL-false,3-MX_I2C1_Init-I2C1-false-HAL-true,4-MX_I2C2_Init-I2C2-false-HAL-true,5-MX_I2C3_Init-I2C3-false-HAL-true,6-MX_SPI1_Init-SPI1-false-HAL-true,7-MX_USART2_UART_Init-USART2-false-HAL-true
ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false-HAL-true,2-SystemClock_Config-RCC-false-HAL-false,3-MX_I2C1_Init-I2C1-false-HAL-true,4-MX_I2C2_Init-I2C2-false-HAL-true,5-MX_I2C3_Init-I2C3-false-HAL-true,6-MX_SPI1_Init-SPI1-false-HAL-true,7-MX_USART2_UART_Init-USART2-false-HAL-true,8-MX_TIM6_Init-TIM6-false-HAL-true
RCC.AHBFreq_Value=16000000
RCC.APB1Freq_Value=16000000
RCC.APB1TimFreq_Value=16000000
......
......@@ -16,7 +16,8 @@ extern TIM_HandleTypeDef htim6;
extern UART_HandleTypeDef huart2;
Balise::Balise() {
Balise::Balise()
{
_i2c1 = new I2C(&hi2c1);
_i2c2 = new I2C(&hi2c2);
......@@ -59,49 +60,24 @@ Balise::Balise() {
HAL_TIM_Base_Start_IT(&htim6);
_flagUpdate = 0;
_globalClock = 0;
}
Balise::~Balise() {
Balise::~Balise()
{
}
void Balise::launch() {
void Balise::launch()
{
uint16_t ctSPI = 0;
uint16_t ctI2C = 0;
for(uint16_t i = 0; i < NB_OF_CAPTOR_PER_I2C; ++i)
{
if(Enable_Captor[i + 8])
{
_i2c1->sendMessage(mux1MSG[i]);
vl53l1x_i2c1[i]->init();
vl53l1x_i2c1[i]->setDistanceMode(VL53l1x::VL53L1DistanceMode::ShortMode);
}
initDistanceMode();
if(Enable_Captor[i + 16])
{
_i2c2->sendMessage(mux1MSG[i]);
vl53l1x_i2c2[i]->init();
vl53l1x_i2c2[i]->setDistanceMode(VL53l1x::VL53L1DistanceMode::ShortMode);
}
if(Enable_Captor[i])
{
_i2c3->sendMessage(mux1MSG[i]);
vl53l1x_i2c3[i]->init();
vl53l1x_i2c3[i]->setDistanceMode(VL53l1x::VL53L1DistanceMode::ShortMode);
}
}
_u7GPIO->setGPIODirA(0x00);
_u7GPIO->setGPIODirB(0x00);
_u8GPIO->setGPIODirA(0x00);
_u8GPIO->setGPIODirB(0x00);
_u9GPIO->setGPIODirA(0x00);
_u9GPIO->setGPIODirB(0x00);
initGPIODir();
blinkLeds();
while(1)
{
......@@ -162,76 +138,31 @@ void Balise::launch() {
setGPIOEvitement();
}
_i2c1->update();
_i2c2->update();
_i2c3->update();
}
if(ctSPI > 15)
{
ctSPI = 0;
for(uint16_t i = 0; i < TOTAL_NB_CAPTOR; ++i)
{
if(capteurState[i])
{
ledState[i * 2] = 0x01;
if(capteurState[(i + 1) % 24])
{
ledState[(i * 2) + 1] = 0x01;
}
else
{
ledState[(i * 2) + 1] = 0x00;
}
}
else
{
ledState[i * 2] = 0x00;
ledState[(i * 2) + 1] = 0x00;
}
}
u7PortA = ~((ledState[41] << 0) | (ledState[42] << 1) | (ledState[43] << 2) | (ledState[44] << 3) |
(ledState[45] << 4) | (ledState[46] << 5) | (ledState[47] << 6) | (ledState[0] << 7));
u7PortB = ~((ledState[33] << 0) | (ledState[34] << 1) | (ledState[35] << 2) | (ledState[36] << 3) |
(ledState[37] << 4) | (ledState[38] << 5) | (ledState[39] << 6) | (ledState[40] << 7));
u8PortA = ~((ledState[25] << 0) | (ledState[26] << 1) | (ledState[27] << 2) | (ledState[28] << 3) |
(ledState[29] << 4) | (ledState[30] << 5) | (ledState[31] << 6) | (ledState[32] << 7));
u8PortB = ~((ledState[17] << 0) | (ledState[18] << 1) | (ledState[19] << 2) | (ledState[20] << 3) |
(ledState[21] << 4) | (ledState[22] << 5) | (ledState[23] << 6) | (ledState[24] << 7));
u9PortA = ~((ledState[9] << 0) | (ledState[10] << 1) | (ledState[11] << 2) | (ledState[12] << 3) |
(ledState[13] << 4) | (ledState[14] << 5) | (ledState[15] << 6) | (ledState[16] << 7));
u9PortB = ~((ledState[1] << 0) | (ledState[2] << 1) | (ledState[3] << 2) | (ledState[4] << 3) |
(ledState[5] << 4) | (ledState[6] << 5) | (ledState[7] << 6) | (ledState[8] << 7));
_u7GPIO->setGPIOStateA(u7PortA);
_u7GPIO->setGPIOStateB(u7PortB);
_u8GPIO->setGPIOStateA(u8PortA);
_u8GPIO->setGPIOStateB(u8PortB);
_u9GPIO->setGPIOStateA(u9PortA);
_u9GPIO->setGPIOStateB(u9PortB);
updateLedState();
}
_i2c1->update();
_i2c2->update();
_i2c3->update();
_spi->update();
}
}
}
void Balise::tick() {
void Balise::tick()
{
_flagUpdate = 1;
_globalClock++;
}
void Balise::setGPIOEvitement() {
void Balise::setGPIOEvitement()
{
if(capteurState[23] || capteurState[0] || capteurState[1])
{
......@@ -305,3 +236,135 @@ void Balise::setGPIOEvitement() {
HAL_GPIO_WritePin(Evit7_GPIO_Port, Evit7_Pin, GPIO_PIN_RESET);
}
}
void Balise::initDistanceMode()
{
for(uint16_t i = 0; i < NB_OF_CAPTOR_PER_I2C; ++i)
{
if(Enable_Captor[i + 8])
{
_i2c1->sendMessage(mux1MSG[i]);
vl53l1x_i2c1[i]->init();
vl53l1x_i2c1[i]->setDistanceMode(VL53l1x::VL53L1DistanceMode::ShortMode);
}
if(Enable_Captor[i + 16])
{
_i2c2->sendMessage(mux1MSG[i]);
vl53l1x_i2c2[i]->init();
vl53l1x_i2c2[i]->setDistanceMode(VL53l1x::VL53L1DistanceMode::ShortMode);
}
if(Enable_Captor[i])
{
_i2c3->sendMessage(mux1MSG[i]);
vl53l1x_i2c3[i]->init();
vl53l1x_i2c3[i]->setDistanceMode(VL53l1x::VL53L1DistanceMode::ShortMode);
}
}
}
void Balise::initGPIODir()
{
_u7GPIO->setGPIODirA(0x00);
_u7GPIO->setGPIODirB(0x00);
_u8GPIO->setGPIODirA(0x00);
_u8GPIO->setGPIODirB(0x00);
_u9GPIO->setGPIODirA(0x00);
_u9GPIO->setGPIODirB(0x00);
}
void Balise::blinkLeds()
{
uint16_t ct = 0;
uint16_t ctSPI =0;
while(ct < 2000)
{
if(_flagUpdate > 0)
{
_flagUpdate = 0;
++ct;
++ctSPI;
if (ct == 1 || ((ct % 1000) == 0) )
{
_u7GPIO->setGPIOStateA(0xFF);
_u7GPIO->setGPIOStateB(0xFF);
_u8GPIO->setGPIOStateA(0xFF);
_u8GPIO->setGPIOStateB(0xFF);
_u9GPIO->setGPIOStateA(0xFF);
_u9GPIO->setGPIOStateB(0xFF);
}
else if ( (ct % 500) == 0 ) //This work since the first condition will be true for multiple of 1000
{
_u7GPIO->setGPIOStateA(0x00);
_u7GPIO->setGPIOStateB(0x00);
_u8GPIO->setGPIOStateA(0x00);
_u8GPIO->setGPIOStateB(0x00);
_u9GPIO->setGPIOStateA(0x00);
_u9GPIO->setGPIOStateB(0x00);
}
if(ctSPI > 10)
_spi->update();
}
}
}
void Balise::updateLedState()
{
for(uint16_t i = 0; i < TOTAL_NB_CAPTOR; ++i)
{
if(capteurState[i])
{
ledState[i * 2] = 0x01;
if(capteurState[(i + 1) % 24])
{
ledState[(i * 2) + 1] = 0x01;
}
else
{
ledState[(i * 2) + 1] = 0x00;
}
}
else
{
ledState[i * 2] = 0x00;
ledState[(i * 2) + 1] = 0x00;
}
}
u7PortA = ~((ledState[41] << 0) | (ledState[42] << 1) | (ledState[43] << 2) | (ledState[44] << 3) |
(ledState[45] << 4) | (ledState[46] << 5) | (ledState[47] << 6) | (ledState[0] << 7));
u7PortB = ~((ledState[33] << 0) | (ledState[34] << 1) | (ledState[35] << 2) | (ledState[36] << 3) |
(ledState[37] << 4) | (ledState[38] << 5) | (ledState[39] << 6) | (ledState[40] << 7));
u8PortA = ~((ledState[25] << 0) | (ledState[26] << 1) | (ledState[27] << 2) | (ledState[28] << 3) |
(ledState[29] << 4) | (ledState[30] << 5) | (ledState[31] << 6) | (ledState[32] << 7));
u8PortB = ~((ledState[17] << 0) | (ledState[18] << 1) | (ledState[19] << 2) | (ledState[20] << 3) |
(ledState[21] << 4) | (ledState[22] << 5) | (ledState[23] << 6) | (ledState[24] << 7));
u9PortA = ~((ledState[9] << 0) | (ledState[10] << 1) | (ledState[11] << 2) | (ledState[12] << 3) |
(ledState[13] << 4) | (ledState[14] << 5) | (ledState[15] << 6) | (ledState[16] << 7));
u9PortB = ~((ledState[1] << 0) | (ledState[2] << 1) | (ledState[3] << 2) | (ledState[4] << 3) |
(ledState[5] << 4) | (ledState[6] << 5) | (ledState[7] << 6) | (ledState[8] << 7));
_u7GPIO->setGPIOStateA(u7PortA);
_u7GPIO->setGPIOStateB(u7PortB);
_u8GPIO->setGPIOStateA(u8PortA);
_u8GPIO->setGPIOStateB(u8PortB);
_u9GPIO->setGPIOStateA(u9PortA);
_u9GPIO->setGPIOStateB(u9PortB);
}
......@@ -42,6 +42,14 @@ public:
private:
void initDistanceMode();
void initGPIODir();
void blinkLeds();
void updateLedState();
void setGPIOEvitement();
I2C* _i2c1 {nullptr};
......
......@@ -57,11 +57,14 @@ void DebugMon_Handler(void);
void PendSV_Handler(void);
void SysTick_Handler(void);
void I2C1_EV_IRQHandler(void);
void I2C1_ER_IRQHandler(void);
void I2C2_EV_IRQHandler(void);
void I2C2_ER_IRQHandler(void);
void SPI1_IRQHandler(void);
void USART2_IRQHandler(void);
void TIM6_DAC_IRQHandler(void);
void I2C3_EV_IRQHandler(void);
void I2C3_ER_IRQHandler(void);
/* USER CODE BEGIN EFP */
/* USER CODE END EFP */
......
......@@ -113,6 +113,8 @@ void HAL_I2C_MspInit(I2C_HandleTypeDef* hi2c)
/* I2C1 interrupt Init */
HAL_NVIC_SetPriority(I2C1_EV_IRQn, 0, 0);
HAL_NVIC_EnableIRQ(I2C1_EV_IRQn);
HAL_NVIC_SetPriority(I2C1_ER_IRQn, 0, 0);
HAL_NVIC_EnableIRQ(I2C1_ER_IRQn);
/* USER CODE BEGIN I2C1_MspInit 1 */
/* USER CODE END I2C1_MspInit 1 */
......@@ -148,6 +150,8 @@ void HAL_I2C_MspInit(I2C_HandleTypeDef* hi2c)
/* I2C2 interrupt Init */
HAL_NVIC_SetPriority(I2C2_EV_IRQn, 0, 0);
HAL_NVIC_EnableIRQ(I2C2_EV_IRQn);
HAL_NVIC_SetPriority(I2C2_ER_IRQn, 0, 0);
HAL_NVIC_EnableIRQ(I2C2_ER_IRQn);
/* USER CODE BEGIN I2C2_MspInit 1 */
/* USER CODE END I2C2_MspInit 1 */
......@@ -183,6 +187,8 @@ void HAL_I2C_MspInit(I2C_HandleTypeDef* hi2c)
/* I2C3 interrupt Init */
HAL_NVIC_SetPriority(I2C3_EV_IRQn, 0, 0);
HAL_NVIC_EnableIRQ(I2C3_EV_IRQn);
HAL_NVIC_SetPriority(I2C3_ER_IRQn, 0, 0);
HAL_NVIC_EnableIRQ(I2C3_ER_IRQn);
/* USER CODE BEGIN I2C3_MspInit 1 */
/* USER CODE END I2C3_MspInit 1 */
......@@ -214,6 +220,7 @@ void HAL_I2C_MspDeInit(I2C_HandleTypeDef* hi2c)
/* I2C1 interrupt DeInit */
HAL_NVIC_DisableIRQ(I2C1_EV_IRQn);
HAL_NVIC_DisableIRQ(I2C1_ER_IRQn);
/* USER CODE BEGIN I2C1_MspDeInit 1 */
/* USER CODE END I2C1_MspDeInit 1 */
......@@ -236,6 +243,7 @@ void HAL_I2C_MspDeInit(I2C_HandleTypeDef* hi2c)
/* I2C2 interrupt DeInit */
HAL_NVIC_DisableIRQ(I2C2_EV_IRQn);
HAL_NVIC_DisableIRQ(I2C2_ER_IRQn);
/* USER CODE BEGIN I2C2_MspDeInit 1 */
/* USER CODE END I2C2_MspDeInit 1 */
......@@ -258,6 +266,7 @@ void HAL_I2C_MspDeInit(I2C_HandleTypeDef* hi2c)
/* I2C3 interrupt DeInit */
HAL_NVIC_DisableIRQ(I2C3_EV_IRQn);
HAL_NVIC_DisableIRQ(I2C3_ER_IRQn);
/* USER CODE BEGIN I2C3_MspDeInit 1 */
/* USER CODE END I2C3_MspDeInit 1 */
......
......@@ -216,6 +216,20 @@ void I2C1_EV_IRQHandler(void)
/* USER CODE END I2C1_EV_IRQn 1 */
}
/**
* @brief This function handles I2C1 error interrupt.
*/
void I2C1_ER_IRQHandler(void)
{
/* USER CODE BEGIN I2C1_ER_IRQn 0 */
/* USER CODE END I2C1_ER_IRQn 0 */
HAL_I2C_ER_IRQHandler(&hi2c1);
/* USER CODE BEGIN I2C1_ER_IRQn 1 */
/* USER CODE END I2C1_ER_IRQn 1 */
}
/**
* @brief This function handles I2C2 event interrupt / I2C2 wake-up interrupt through EXTI line 24.
*/
......@@ -230,6 +244,20 @@ void I2C2_EV_IRQHandler(void)
/* USER CODE END I2C2_EV_IRQn 1 */
}
/**
* @brief This function handles I2C2 error interrupt.
*/
void I2C2_ER_IRQHandler(void)
{
/* USER CODE BEGIN I2C2_ER_IRQn 0 */
/* USER CODE END I2C2_ER_IRQn 0 */
HAL_I2C_ER_IRQHandler(&hi2c2);
/* USER CODE BEGIN I2C2_ER_IRQn 1 */
/* USER CODE END I2C2_ER_IRQn 1 */
}
/**
* @brief This function handles SPI1 global interrupt.
*/
......@@ -286,6 +314,20 @@ void I2C3_EV_IRQHandler(void)
/* USER CODE END I2C3_EV_IRQn 1 */
}
/**
* @brief This function handles I2C3 error interrupt.
*/
void I2C3_ER_IRQHandler(void)
{
/* USER CODE BEGIN I2C3_ER_IRQn 0 */
/* USER CODE END I2C3_ER_IRQn 0 */
HAL_I2C_ER_IRQHandler(&hi2c3);
/* USER CODE BEGIN I2C3_ER_IRQn 1 */
/* USER CODE END I2C3_ER_IRQn 1 */
}
/* USER CODE BEGIN 1 */
/* USER CODE END 1 */
......