Split templates to two independent files
Yes, You have very nice idea. Even better than I expected.
I have zero knowledge about Java (small about C and quite big about electronics) so please think about it without my support.
There are at least 4 different platforms with AtMega32U4:
- Teensy 2.0
- Arduino Leonardo (useless, too big to implement)
Micro by Arduino
Micro by Sparkfun
Note size difference between A. Micro and P. Micro. There are available clones for both versions, but bigger board = higher price. LEDs
There are difference on LEDs:
- Pro Micro have same RX/TX LEDs as Leonardo but and lack of User LED and some I/O pins.
- Arduino Micro have same User LED as Leonardo. It also have same pins for RX/TX LEDs but logic for that LEDs are reversed!
So in my opinion, LEDs for Arduino & clones can be ignored at this moment. There are a lot of more important things to improve. 8Mhz Quartz & 3v3
AtMega32U4 should run at 8Mhz on lower voltage. As I see, Teensy have jumper to switch voltage, quartz should be divided at software level.
Arduino products are designed to be simply, 5V and 16Mhz for everyone. WaxBee can run at 8Mhz on Arduino. 5V only might cause a problem for digitizer, but We can talk about it later.
Sparkfun are a black sheep here. No jumpers, just two independent products: Pro Micro - 5V/16MHz
and Pro Micro - 3.3V/8MHz
Why It's so important for me? Because Pro Micro 8Mhz have very cheap clones with 3v3 LDO on board. That would be super easy for peoples to start.
What should be changed in code? As far as I know, code should be compiled as for 8Mhz on 16Mhz quartz, but prescaler for CPU and for PLL should be turned OFF. I'm searching for
PLL_CONFIG(); // config PLL
but can't found it. Memory Types
Sorry about my poor language and putting messy there. If anything is unclear, please ask, I'll try to find example over network and send link.
The rules of fusebits & lockbits are:
bits can be changed only via ISP with fusebits specified command. If board worked before, do not touch this
. There You can brick board.
2. Lockbits can't brick the board, just block reading/overwriting of flash&eeprom.
3. To set lockbits You need specified fusebits command via ISP. Only way to clear lockbits are 'full chip erase' that wipes out flash.
4. Programming flash (burning bootloader) via ISP programmer always use 'full chip erase' command so after programming that way You should set lockbits manually.
Why I'm writing that? Because Teensy, Arduino, Pro Micro and some good clones have right settings for lockbits. That mean that bootloader can't overwrite itself and will crash exactly at 28k. Reset and bootloader works again.
Bad clones doesn't have right settings for lockbits. Bootloader can overwrite itself and brick itself. That happens to me with one board (rest wasn't tested yet).
As You can read on forum
, I use old programmer to fix that. You probably need to build Your own by flashing 'ISP programmer sketch'
into working clone or into one of Teensy boards.