235 views
in GUI Development by
Hi,

I was looking at the bezier clock example,

I don't get the part were the gui gets the time from the device ... how is the gui clock sincronized with the board?

I assume i have to use the EwBspClockGetTime() function in ew_bsp_clock.c, but i don't see the call to that method aniware.

Do i have to make a variable in the device class that gets updated by a process like the adc example?

Thanks

1 Answer

+1 vote
by
 
Best answer

Hi Riccardo,

the CurrentTime within the GUI demo is read from the Mosaic class Core::Time. This calls the function EwGetTime() which you will find in the file /PlatformPackage/RTE/ewextrte.c and this calls the function EwBspClockGetTime() that is located in /TargetSpecific/ew_bsp_clock.c.

The realtime clock (RTC) of your board is initialized during startup within the file ewmain.c.

Best regards,

Manfred.

by

Thank,found it.

I set a timer every 100 ms to update a String on display referring to the String property of a object Core::Time.

On display the time is not incrementing.

 

 

by
Does it work in the Prototyper?
by
Neither... it stays in 0000-00-00 00:00:00
by
So you have to check your implementation - it is not related to the RTC and the access to the RTC on your target...

How do you access the current time? Maybe the implementation shown in other clock examples helps...
by

on the example.... they get every digit of the clock one by one

// Get the current time
var Core::Time currentTime = Time.CurrentTime;

Digit0.Value = currentTime.Hour / 10;
Digit1.Value = currentTime.Hour % 10;

Digit2.Value = currentTime.Minute / 10;
Digit3.Value = currentTime.Minute % 10;

Digit4.Value = currentTime.Second / 10;
Digit5.Value = currentTime.Second % 10;

Date.String = currentTime.getDayOfWeekName( currentTime.DayOfWeek, true ) + ", "
              + currentTime.getMonthName( currentTime.Month, false ) + " " + string(currentTime.Day, 2);

but i'm using the Timer. String  of the object timer i put in my Application::Homescreen.

Might be that the case?

by

Of course, you can use Time.String:

Please find here a short example, demonstrating your use-case. I hope this helps...

Best regards,
Manfred.

 

by
Now  it works.

var Core::Time t = Time.CurrentTime;

was missing.

Can you explain me why i have to declare that varible and not get the string directly from Timer.String ?
by
The idea is, that CurrentTime returns an initialized time object that contains the current time. Now you can keep that time object and evaluate it without the effect that the time changes meanwhile... Or you want to store this as a kind of time stamp.

Ask Embedded Wizard

Welcome to the question and answer site for Embedded Wizard users and UI developers.

Ask your question and receive answers from the Embedded Wizard support team or from other members of the community!

Embedded Wizard Website | Privacy Policy | Imprint

...