Browse Source

V1.0

ctrl_sig_generator_by_stm32
zhaohe 1 year ago
parent
commit
c14f7cec5d
  1. 3
      .cproject
  2. 4
      .settings/language.settings.xml
  3. 27
      usrc/pluse_generator.c

3
.cproject

@ -45,6 +45,7 @@
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.definedsymbols.1824133732" 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="STM32F103xE"/>
<listOptionValue builtIn="false" value="DEBUG"/>
</option>
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.includepaths.711161122" 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"/>
@ -56,7 +57,7 @@
<listOptionValue builtIn="false" value="../Drivers/CMSIS/Include"/>
</option>
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.warnings.extra.35757150" name="Enable extra warning flags (-Wextra)" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.warnings.extra" useByScannerDiscovery="false" value="true" valueType="boolean"/>
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.slow_flash_data.1505987394" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.slow_flash_data" value="false" valueType="boolean"/>
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.slow_flash_data.1505987394" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.slow_flash_data" useByScannerDiscovery="false" value="false" valueType="boolean"/>
<inputType id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.input.c.1688112573" 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.333702566" name="MCU G++ Compiler" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.compiler">

4
.settings/language.settings.xml

@ -5,7 +5,7 @@
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
<provider class="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="-984125821052360462" 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="260443011819432641" 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>
@ -16,7 +16,7 @@
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
<provider class="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="-984125821052360462" 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="260443011819432641" 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>

27
usrc/pluse_generator.c

@ -51,6 +51,10 @@ void prv_delay_us(uint32_t us) {
}
}
}
static inline void set_io_state(int off, bool state) {
HAL_GPIO_WritePin(ch_io[off].gpio, ch_io[off].pinoff, state);
HAL_GPIO_WritePin(chx_io.gpio, chx_io.pinoff, state);
}
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) {
if (GPIO_Pin != trigger_io.pinoff) {
@ -105,11 +109,6 @@ void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) {
/*******************************************************************************
* FUNCTION *
*******************************************************************************/
static inline void set_io_state(int off, bool state) {
zgpio_write(&ch_io[off], state);
// zdelay_us(1);
zgpio_write(&chx_io, state);
}
void PluseGenerator_init() {
//
@ -131,16 +130,16 @@ void PluseGenerator_init() {
void PluseGenerator_updatePraram() {
config_t* cfg = config_get();
m_steps[kaction_set_io0_high].tp = 1 + (cfg->pulse_width_us + cfg->pulse_interval_us) * 0;
m_steps[kaction_set_io0_low].tp = 1 + (cfg->pulse_width_us + cfg->pulse_interval_us) * 0 + cfg->pulse_width_us;
m_steps[kaction_set_io1_high].tp = 1 + (cfg->pulse_width_us + cfg->pulse_interval_us) * 1;
m_steps[kaction_set_io1_low].tp = 1 + (cfg->pulse_width_us + cfg->pulse_interval_us) * 1 + cfg->pulse_width_us;
m_steps[kaction_set_io2_high].tp = 1 + (cfg->pulse_width_us + cfg->pulse_interval_us) * 2;
m_steps[kaction_set_io2_low].tp = 1 + (cfg->pulse_width_us + cfg->pulse_interval_us) * 2 + cfg->pulse_width_us;
m_steps[kaction_set_io3_high].tp = 1 + (cfg->pulse_width_us + cfg->pulse_interval_us) * 3;
m_steps[kaction_set_io3_low].tp = 1 + (cfg->pulse_width_us + cfg->pulse_interval_us) * 3 + cfg->pulse_width_us;
m_steps[kaction_set_io0_high].tp = 1 + ((cfg->pulse_width_us + cfg->pulse_interval_us) * 1) * 0;
m_steps[kaction_set_io0_low].tp = 1 + ((cfg->pulse_width_us + cfg->pulse_interval_us) * 1) * 0 + (cfg->pulse_width_us * 1);
m_steps[kaction_set_io1_high].tp = 1 + ((cfg->pulse_width_us + cfg->pulse_interval_us) * 1) * 1;
m_steps[kaction_set_io1_low].tp = 1 + ((cfg->pulse_width_us + cfg->pulse_interval_us) * 1) * 1 + (cfg->pulse_width_us * 1);
m_steps[kaction_set_io2_high].tp = 1 + ((cfg->pulse_width_us + cfg->pulse_interval_us) * 1) * 2;
m_steps[kaction_set_io2_low].tp = 1 + ((cfg->pulse_width_us + cfg->pulse_interval_us) * 1) * 2 + (cfg->pulse_width_us * 1);
m_steps[kaction_set_io3_high].tp = 1 + ((cfg->pulse_width_us + cfg->pulse_interval_us) * 1) * 3;
m_steps[kaction_set_io3_low].tp = 1 + ((cfg->pulse_width_us + cfg->pulse_interval_us) * 1) * 3 + (cfg->pulse_width_us * 1);
for (uint32_t i = 0; i < ZARRAY_SIZE(m_steps); i++) {
printf("m_steps[%d].tp = %d\n", i, m_steps[i].tp);
// printf("m_steps[%d].tp = %d\n", i, m_steps[i].tp);
}
}
Loading…
Cancel
Save