The code currently uses SPR2 register bit which does not exist in ATmega32U4, causing compilation errors on some development environments:
error: 'SPR2' was not declared in this scope
This issue primarily affects 3.3V 8MHz ATmega32U4 boards (such as some SparkFun Pro Micro 3.3V variants) when compiled with strict register checking.
Background
Most ATmega32U4 boards (Leonardo, Micro, standard Pro Micro) operate at 5V 16MHz and work fine with the current code
The issue specifically occurs with 3.3V 8MHz variants where the SPR2 register reference causes compilation failures
The original code attempts to set SPI clock to 250kHz using non-existent SPR2 bit
Solution
Replace the non-existent SPR2 with the correct combination of SPR1 and SPI2X bits to achieve the same Fosc/32 clock division:
SPR1=1, SPR0=0 → Fosc/64
SPI2X=1 → Double speed mode → Fosc/32
Result: 8MHz/32 = 250kHz (maintains original target frequency)
## Problem
The code currently uses `SPR2` register bit which does not exist in ATmega32U4, causing compilation errors on some development environments:
```
error: 'SPR2' was not declared in this scope
```
This issue primarily affects **3.3V 8MHz ATmega32U4 boards** (such as some SparkFun Pro Micro 3.3V variants) when compiled with strict register checking.
## Background
- Most ATmega32U4 boards (Leonardo, Micro, standard Pro Micro) operate at **5V 16MHz** and work fine with the current code
- The issue specifically occurs with **3.3V 8MHz variants** where the SPR2 register reference causes compilation failures
- The original code attempts to set SPI clock to 250kHz using non-existent SPR2 bit
## Solution
Replace the non-existent `SPR2` with the correct combination of `SPR1` and `SPI2X` bits to achieve the same Fosc/32 clock division:
- `SPR1=1, SPR0=0` → Fosc/64
- `SPI2X=1` → Double speed mode → Fosc/32
- Result: 8MHz/32 = 250kHz (maintains original target frequency)
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Problem
The code currently uses
SPR2register bit which does not exist in ATmega32U4, causing compilation errors on some development environments:This issue primarily affects 3.3V 8MHz ATmega32U4 boards (such as some SparkFun Pro Micro 3.3V variants) when compiled with strict register checking.
Background
Solution
Replace the non-existent
SPR2with the correct combination ofSPR1andSPI2Xbits to achieve the same Fosc/32 clock division:SPR1=1, SPR0=0→ Fosc/64SPI2X=1→ Double speed mode → Fosc/32Thanks for the PR!