diff --git a/exp3/Core/Src/main.c b/exp3/Core/Src/main.c index 5c0102a..1fae0ee 100644 --- a/exp3/Core/Src/main.c +++ b/exp3/Core/Src/main.c @@ -65,6 +65,7 @@ uint16_t display_tab[] = { 0x71 }; uint16_t PosSel = 0; +uint8_t bias = 0; /* USER CODE END PV */ /* Private function prototypes -----------------------------------------------*/ @@ -123,11 +124,16 @@ int main(void) if (sSysTickTimer.bTimeOk) { sSysTickTimer.bTimeOk = 0; HAL_GPIO_TogglePin(LED_GPIO_Port, LED_Pin); + + if (++bias >= 8) { + bias = 0; + } + } // if (sSysTickTimer.bTenMilSecOk) { SegLedData_GPIO_Port->ODR = 0x00; AddrA_GPIO_Port->ODR = PosSel; - SegLedData_GPIO_Port->ODR = display_tab[PosSel % 8]; + SegLedData_GPIO_Port->ODR = display_tab[(PosSel + bias) % 8]; if (++PosSel >= 8) { PosSel = 0; }