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

Incorrect sleep management constants #317

Open
ElectricWater96 opened this issue Sep 17, 2024 · 0 comments
Open

Incorrect sleep management constants #317

ElectricWater96 opened this issue Sep 17, 2024 · 0 comments

Comments

@ElectricWater96
Copy link

When attempting to use sleepMode() with an ATmega328P I found that the SLEEP_... macros are defined with incorrect values in the arduino.h file. The values defined range from 0 through 5, but they should be double what they are, due to a missing left bitshift that is required to align their bits with the SM[2:0] bits in the SMCR register. For example, sleepMode(SLEEP_POWER_DOWN) should pass a binary value of 0100 to SMCR, setting the sleep mode to "Power-down", but it passes 0010, which sets the sleep mode to "ADC Noise Reduction".

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

No branches or pull requests

1 participant