Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ion::msleep and LED blinking with Timer + various register definitions #314

Merged
merged 4 commits into from
Aug 24, 2018

Conversation

boricj
Copy link
Contributor

@boricj boricj commented Jan 18, 2018

Change Ion::msleep from a CPU busy-loop to a timer busy-loop. Ideally we'd put the MCU to sleep while sleeping to save on power, but we don't handle interrupts yet.

Also adding register definitions for #311 and a bugfix while I'm here.

@boricj boricj force-pushed the rtc_part1 branch 2 times, most recently from cb7e381 to eba5481 Compare January 21, 2018 19:06
@boricj boricj changed the title Ion::msleep with Timer and various fixes Ion::msleep/Ion::usleep with Timer and various fixes Jan 21, 2018
@boricj
Copy link
Contributor Author

boricj commented Jan 21, 2018

I cleaned up the pull request and switched Ion::usleep to use a timer too. Thus this obsoletes #313 with a cleaner solution that does not depend on how fast the CPU processes NOPs.

I won't attempt trying out interrupts without a means to debug the hardware though, so this pull request is done. Power consumption should be identical to the current implementation.

@EmilieNumworks
Copy link
Collaborator

It looks like a very good PR, thank you @boricj ! It is not a good time right now for us to review and merge it as we are close to release a new update. However, if you could split the the first commit (about the Valgrind uninitialised read) from the others, I will merge it right away.

@boricj
Copy link
Contributor Author

boricj commented Jan 31, 2018

Turns out setting up a timer for Ion::usleep takes long enough that the screen is significantly late for dimming, so I reverted that.

@boricj boricj changed the title Ion::msleep/Ion::usleep with Timer and various fixes Ion::msleep with Timer and various register definitions Jan 31, 2018
@boricj
Copy link
Contributor Author

boricj commented Jan 31, 2018

While messing with timers, I've managed to decouple the exam LED blinking from the event loop and enable LED charging status. Activating exam mode makes the LED blink red and inhibits any LED change until it is deactivated.

A side-effect is that the LED will now keep blinking in exam mode while the calculator is shut down or busy (fixing #196). This might draw more power than before in this specific case, but the alternative would be far less pleasant for the student should an exam invigilator notices the lack of proper calculator blinkingness.

@boricj boricj changed the title Ion::msleep with Timer and various register definitions Ion::msleep and LED blinking with Timer + various register definitions Jan 31, 2018
@boricj boricj force-pushed the rtc_part1 branch 2 times, most recently from 4f0a20f to 4b52456 Compare February 4, 2018 19:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants