void HAL_RTC_AlarmAEventCallback(RTC_HandleTypeDef *hrtc) {
z ++;
RTC_AlarmTypeDef sAlarm;
HAL_RTC_GetTime(hrtc, &RTC_TimeStruct, FORMAT_BIN);
HAL_RTC_GetDate(hrtc, &RTC_DateStruct, FORMAT_BIN);
HAL_RTC_GetAlarm(hrtc,&sAlarm,RTC_ALARM_A,FORMAT_BIN);
if(sAlarm.AlarmTime.Seconds>54) {
sAlarm.AlarmTime.Seconds=0;
}else{
sAlarm.AlarmTime.Seconds=sAlarm.AlarmTime.Seconds+5;
}
while(HAL_RTC_SetAlarm_IT(hrtc, &sAlarm, FORMAT_BIN)!=HAL_OK){}
HAL_GPIO_TogglePin(LD2_GPIO_Port, LD2_Pin);
if (z == 2)
{
printf("y =%d\n", RTC_TimeStruct.Minutes);
printf("x =%d\n", RTC_TimeStruct.Seconds);
z = 0;
}
}