 Hello and welcome to this presentation. My name is Bernadine and in this video we'll learn how to use the real-time clock or RTC with the TADGFX analog clock widget. I will start from TADGFX designer, create an application template, give a name for it, STM32, F769, RTC, analog, pick a template for the STM32, F769 discovery board and use the blank UI. Click create, now place a white box in the canvas for the background and then place an analog clock widget. Okay, then I click generate code, once the code is successfully generated, I browse to the TADGFX files. Here I have the TADGFX product, I go up here and then open the STM32 Cuba Max file. I get this pop-up message asking me either to migrate or continue using the old version. I'll hit continue. I have my Cuba Max project open here. First thing, I enable the clock to the RTC here for the low-speed clock LSE, I'll pick Crystal Resonator. We have Crystal Resonator on the STM32, F769 discovery board. Then I go to the timers, RTC peripheral and activate the clock source. The RTC is enabled. I go back to the clock configuration time and here we have a Max to the RTC to pick which clock goes to the peripheral. Here I'll select the LSE as clock source. I save my project and then hit generate code. So here TADGFX designer detected something changed, I will just click yes. Go back to STM32 Cuba Max and open the project. Here I have the directory for the workspace and give a different path and then hit launch. Now I have my STM32Q by the project open. I close the information center. Okay, click okay and then close this information center. Here I have my STM32F769 discovery project and expand it, then expand application, then expand user. Then double click on main.c and here I have my handler for the RTC here. And then what I'm going to do is to add variable for the time so I can set and get the time from the RTC registers. I will do the same for the date so that I can read and write the date values from and to the RTC registers. Next I'll go to the RTC init function and here I have the configuration done or generated by STM32Q by Max. Here I will add the initialization of the date and time. So for the time I will use BCD format here. So the hour will set the hour to 10 minutes to 20 and seconds to 30 and this is in BCD format. And the whole RTC set time is the whole library or whole API that allows you to set the RTC values or RTC time to the RTC registers. Next I will do the same thing for the date. I will set the month, date, year and the same as the time in BCD format. Now we are done with the backend system. Next step is to change the type gfx files. I'll go to GUI and then to model. But what is a model? The model has the state of everything you have in the view. For our example the model will have the time and date. The model plus has a take method which is automatically called every frame or 16 milliseconds. So every 16 milliseconds will get the time from the RTC and send it to the presenter and then to the view. So first step is to get the time from the RTC registers using the whole API, the whole RTC get time. We do the same with the date, get date. Then we use the model listener to send the time to the active presenter. So the model listener is a pointer to the current active presenter. You can do the same thing with the date. You can add a text widget in the designer and send the date to the presenter using the model listener and then to the view. So here we are sending only the time every 16 milliseconds. Of course you can change it to send the time only every second or so. Next we need to include the hall.h file here and then the RTC variables and those need to be external. Next we need to define the model listener for the update method. We need to include the types for the unsigned end here to save the file. Next step is to go to the scan1 presenter and define the update method here. Then we need to define the prototype of the method. Update time will do the same from the presenter. Call update time and here the update time will change or set the time in the analog clock widget. We still have one more thing to do is to define the prototype of the method in the view.hpp file. Now I will build my application. The build is successful. I will proceed to the download of my decision switch. Now I will learn the code. I'll click on resume and here I have my analog clock. Thank you for joining me in today's presentation and we hope that you enjoyed learning how to use the realtime clock with the analog clock widget.