完成第二次实验
This commit is contained in:
parent
2e01c0a278
commit
f1bc6bd8e1
@ -9,6 +9,8 @@ extern "C" {
|
||||
typedef struct {
|
||||
uint8_t mMilSecCount; // 毫秒计数
|
||||
uint8_t bTenMilSecOk; // 10毫秒标志位
|
||||
uint8_t mTenMilSecCount; // 10毫秒计数
|
||||
uint8_t bHundredMilSecOk; // 100毫秒标志位
|
||||
uint8_t mTimeCount; // 秒计数
|
||||
uint8_t bTimeOk; // 秒标志位
|
||||
} stSysTickTimer;
|
||||
|
@ -104,7 +104,9 @@ int main(void)
|
||||
if (sSysTickTimer.bTimeOk) {
|
||||
sSysTickTimer.bTimeOk = 0;
|
||||
HAL_GPIO_TogglePin(LED_GPIO_Port, LED_Pin);
|
||||
|
||||
}
|
||||
if (sSysTickTimer.bHundredMilSecOk) {
|
||||
sSysTickTimer.bHundredMilSecOk = 0;
|
||||
HAL_GPIO_WritePin(FlashLeds_GPIO_Port, nShift, GPIO_PIN_SET);
|
||||
|
||||
|
||||
|
@ -192,9 +192,13 @@ void SysTick_Handler(void)
|
||||
if (++sSysTickTimer.mMilSecCount >= 10) {
|
||||
sSysTickTimer.mMilSecCount = 0;
|
||||
sSysTickTimer.bTenMilSecOk = 1;
|
||||
if (++sSysTickTimer.mTimeCount >= 100) {
|
||||
sSysTickTimer.mTimeCount = 0;
|
||||
sSysTickTimer.bTimeOk = 1;
|
||||
if (++sSysTickTimer.mTenMilSecCount >= 10) {
|
||||
sSysTickTimer.mTenMilSecCount = 0;
|
||||
sSysTickTimer.bHundredMilSecOk = 1;
|
||||
if (++sSysTickTimer.mTimeCount >= 10) {
|
||||
sSysTickTimer.mTimeCount = 0;
|
||||
sSysTickTimer.bTimeOk = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* USER CODE END SysTick_IRQn 1 */
|
||||
|
Loading…
Reference in New Issue
Block a user