|
|
@ -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); |
|
|
|
} |
|
|
|
} |