kengineer Posted February 19, 2016 Report Share Posted February 19, 2016 Hello, just got gfx up and running on a cortex M0+ based microcontroller. I implemented gfxSystemTicks and gfxMillisecondsToTicks functions similar to how suggested here. I didn't however actually use a system systick, but rather enabled an accurate 1 ms timer interrupt in my code, and used this to increment a timer variable. This was easy and quick to setup as I didn't really look too much into how systick works. What I'm wondering, is when should this timer be cleared to 0? Otherwise it's just going to run forever until it overflows. I'm not sure how an actual systick is handled so maybe this usually isn't an issue. Thanks. Link to comment Share on other sites More sharing options...
inmarket Posted February 21, 2016 Report Share Posted February 21, 2016 Your millisecond counter is perfect for the ugfx systick routines. You dont need to worry if the counter overflows as ugfx performs its time calculations correctly to ensure the overflows are handled without causing problems. Link to comment Share on other sites More sharing options...
Joel Bodenmann Posted February 21, 2016 Report Share Posted February 21, 2016 Hello and welcome to the community! As inmarket mentioned you don't have to worry about that in terms of uGFX as we internally take care of that. However, that is in fact a problem you can never avoid. It's a basic principle (or problem) of counters and the systick has the same problem. This problem needs to be handled manually: https://stackoverflow.com/questions/3095623/how-to-deal-with-a-wrapping-counter-in-embedded-c STM32 Systick overflow ... An overflowing systick counter was also the reason why the mouse cursor in Windows 95 stopped working after 47.5 days Link to comment Share on other sites More sharing options...
kengineer Posted February 23, 2016 Author Report Share Posted February 23, 2016 Thanks for the info guys! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now