Compiles on recent versions of avr-gcc & multiple sleep bugfixes#1
Open
johngarchie wants to merge 2 commits intojsgf:masterfrom
Open
Compiles on recent versions of avr-gcc & multiple sleep bugfixes#1johngarchie wants to merge 2 commits intojsgf:masterfrom
johngarchie wants to merge 2 commits intojsgf:masterfrom
Conversation
added 2 commits
September 7, 2014 11:23
All deprecated interrupt names have been replaced by their
current equivalents:
SIG_OVERFLOW0 -> TIMER0_OVF_vect
SIG_PIN_CHANGE2 -> PCINT2_vect
SIG_PIN_CHANGE0 -> PCINT0_vect
SIG_INTERRUPT0 -> INT0_vect
SIG_COMPARATOR -> ANALOG_COMP_vect
The code no longer generates compile errors on recent versions of GCC.
(Tested on avr-gcc 4.8.2.)
This commit includes four sleep-related bugfixes. Together, these changes should ensure more reliable sleep behavior. The code now uses a 2 MHz clock speed during sleep--fast enough for reliable asynchronous timer (timer2) operation, but slow enough for oscillator stability at 1.7 volts, the lowest possible voltage ensured by the BOD settings. Timer2 is now initialized only if not already initialized. This prevents time loss due to the unnecessary reinitializations after calls to app_start(). The sleep code now ensures that all asynchronous timer settings are latched before sleeping to ensure reliable waking via the once-per- second time keeping interrupt. The once-per-second interrupt must not exit before a full crystal oscillation, so OCR2B--an unused timer2 register--is written at the beginning of the interrupt routine. The value of OCR2B is latched after two positive edges from the crystal oscillator, and since the system will not sleep until all asynchronous timer (timer2) registers are latched, the system will not sleep until the necessary time has passed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Thought these changes might interest you. See the individual commit comments for details.