Reduce polarity switch time to 10 ms
This commit is contained in:
+3
-3
@@ -137,8 +137,8 @@ int main(void)
|
|||||||
/* Infinite loop */
|
/* Infinite loop */
|
||||||
/* USER CODE BEGIN WHILE */
|
/* USER CODE BEGIN WHILE */
|
||||||
GPIO_PinState state = GPIO_PIN_RESET;
|
GPIO_PinState state = GPIO_PIN_RESET;
|
||||||
const uint32_t polarity_switch_period = 1000;
|
const uint32_t polarity_switch_period_ms = 10;
|
||||||
uint32_t next_polarity_switch_ms = HAL_GetTick() + polarity_switch_period;
|
uint32_t next_polarity_switch_ms = HAL_GetTick() + polarity_switch_period_ms;
|
||||||
bool polarity = true;
|
bool polarity = true;
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
@@ -162,7 +162,7 @@ int main(void)
|
|||||||
HAL_GPIO_WritePin(VDD_LEDL_EN_GPIO_Port, VDD_LEDL_EN_Pin, state);
|
HAL_GPIO_WritePin(VDD_LEDL_EN_GPIO_Port, VDD_LEDL_EN_Pin, state);
|
||||||
if (HAL_GetTick() > next_polarity_switch_ms)
|
if (HAL_GetTick() > next_polarity_switch_ms)
|
||||||
{
|
{
|
||||||
next_polarity_switch_ms = HAL_GetTick() + polarity_switch_period;
|
next_polarity_switch_ms = HAL_GetTick() + polarity_switch_period_ms;
|
||||||
polarity = !polarity;
|
polarity = !polarity;
|
||||||
H_bridge_set_direction(polarity);
|
H_bridge_set_direction(polarity);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user