Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void zmain(void)
- {
- RTC_Start(); // start real time clock
- RTC_TIME_DATE now;
- // set current time
- int hours = 0;
- int minutes = 0;
- printf("Hours: ");
- scanf("%d", &hours);
- now.Hour = hours;
- printf("\nMinutes: ");
- scanf("%d", &minutes);
- now.Min = minutes;
- now.Sec = 0;
- now.DayOfMonth = 0;
- now.Month = 0;
- now.Year = 2020;
- RTC_WriteTime(&now); // write the time to real time clock
- for(;;)
- {
- if(SW1_Read() == 0) {
- // read the current time
- RTC_DisableInt(); /* Disable Interrupt of RTC Component */
- now = *RTC_ReadTime(); /* copy the current time to a local variable */
- RTC_EnableInt(); /* Enable Interrupt of RTC Component */
- // print the current time
- printf("%2d:%02d.%02d\n", now.Hour, now.Min, now.Sec);
- print_mqtt("Zumo018/time:, %2d:%02d.", now.Hour, now.Min);
- // wait until button is released
- while(SW1_Read() == 0) vTaskDelay(50);
- }
- vTaskDelay(50);
- }
- }
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement