Skip to content

Commit

Permalink
check for signal with and without pullup
Browse files Browse the repository at this point in the history
  • Loading branch information
AlkaMotors committed Jul 9, 2021
1 parent de082e2 commit b6362cb
Show file tree
Hide file tree
Showing 40 changed files with 96 additions and 6,227 deletions.
73 changes: 49 additions & 24 deletions .settings/language.settings.xml
Original file line number Diff line number Diff line change
@@ -1,27 +1,52 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project>
<configuration id="com.st.stm32cube.ide.mcu.gnu.managedbuild.config.exe.debug.1950554462" name="Debug">
<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="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="113421523670123703" 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>
</extension>
</configuration>
<configuration id="com.st.stm32cube.ide.mcu.gnu.managedbuild.config.exe.release.1362137836" 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="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="113421523670123703" 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>
</extension>
</configuration>

<configuration id="com.st.stm32cube.ide.mcu.gnu.managedbuild.config.exe.debug.1950554462" name="Debug">

<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="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="196851133827872175" 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>

</extension>

</configuration>

<configuration id="com.st.stm32cube.ide.mcu.gnu.managedbuild.config.exe.release.1362137836" 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="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="196851133827872175" 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>

</extension>

</configuration>

</project>
64 changes: 47 additions & 17 deletions Core/Src/main.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* Bootloader */

#define BOOTLOADER_VERSION 9
#define BOOTLOADER_VERSION 10

//#define USE_PA2
#define USE_PA2

/* Includes ------------------------------------------------------------------*/
#include <stdbool.h>
Expand Down Expand Up @@ -532,6 +532,49 @@ save_flash_nolib(rxBuffer, 48, EEPROM_START_ADD);
}
}

void checkForSignal(){
//uint8_t floating_or_signal= 0;
LL_GPIO_SetPinPull(input_port, input_pin, LL_GPIO_PULL_DOWN);
delayMicroseconds(500);

for(int i = 0 ; i < 500; i ++){
if( !(input_port->IDR & input_pin)){
low_pin_count++;
}else{
// high_pin_count++;
}

delayMicroseconds(10);
}
if(low_pin_count == 0){
return; // all high while pin is pulled low, bootloader signal
}

low_pin_count = 0;

LL_GPIO_SetPinPull(input_port, input_pin, LL_GPIO_PULL_NO);
delayMicroseconds(500);

for(int i = 0 ; i < 500; i ++){
if( !(input_port->IDR & input_pin)){
low_pin_count++;
}

delayMicroseconds(10);
}
if(low_pin_count == 0){
return; // when floated all
}

if(low_pin_count > 0){
jump();
}



}



int main(void)
{
Expand All @@ -550,21 +593,8 @@ int main(void)

MX_GPIO_INPUT_INIT(); // init the pin with a pulldown

LL_GPIO_SetPinPull(input_port, input_pin, LL_GPIO_PULL_DOWN);
delayMicroseconds(1000);

for(int i = 0 ; i < 1000; i ++){
if( !(input_port->IDR & input_pin)){ // if the pin is low for 10 checks out of 100 in 10ms or more its either no signal or signal. jump to application
low_pin_count++;
}
if(low_pin_count > 10){
jump();
}
delayMicroseconds(10);
}

LL_GPIO_SetPinPull(input_port, input_pin, LL_GPIO_PULL_UP);

checkForSignal();
LL_GPIO_SetPinPull(input_port, input_pin, LL_GPIO_PULL_UP);
#ifdef USE_ADC_INPUT // go right to application
jump();

Expand Down
2 changes: 0 additions & 2 deletions Debug/Core/Src/bootloader.su

This file was deleted.

21 changes: 0 additions & 21 deletions Debug/Core/Src/main.su

This file was deleted.

5 changes: 0 additions & 5 deletions Debug/Core/Src/stm32f0xx_it.su

This file was deleted.

44 changes: 0 additions & 44 deletions Debug/Core/Src/subdir.mk

This file was deleted.

17 changes: 0 additions & 17 deletions Debug/Core/Src/syscalls.su

This file was deleted.

1 change: 0 additions & 1 deletion Debug/Core/Src/sysmem.su

This file was deleted.

2 changes: 0 additions & 2 deletions Debug/Core/Src/system_stm32f0xx.su

This file was deleted.

19 changes: 0 additions & 19 deletions Debug/Core/Startup/subdir.mk

This file was deleted.

23 changes: 0 additions & 23 deletions Debug/Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_hal.su

This file was deleted.

12 changes: 0 additions & 12 deletions Debug/Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_hal_cortex.su

This file was deleted.

12 changes: 0 additions & 12 deletions Debug/Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_hal_dma.su

This file was deleted.

9 changes: 0 additions & 9 deletions Debug/Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_hal_exti.su

This file was deleted.

13 changes: 0 additions & 13 deletions Debug/Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_hal_flash.su

This file was deleted.

This file was deleted.

8 changes: 0 additions & 8 deletions Debug/Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_hal_gpio.su

This file was deleted.

Loading

0 comments on commit b6362cb

Please sign in to comment.