Merge pull request #25 from jacobly0/fix/for

Fix for loop direction.
This commit is contained in:
Limor "Ladyada" Fried 2019-07-12 14:14:20 -04:00 committed by GitHub
commit 22de38d30e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -71,7 +71,7 @@ void enable_clock_generator(uint8_t gclk, uint32_t source, uint16_t divisor) {
uint32_t divsel = 0;
if (gclk == 2 && divisor > 31) {
divsel = GCLK_GENCTRL_DIVSEL;
for (int i = 15; i > 4; i++) {
for (int i = 15; i > 4; i--) {
if (divisor & (1 << i)) {
divisor = i - 1;
break;