I'm working on a project with a Digispark ATTiny85, that performs keystrokes using the DigisparkKeyboard library (https://github.com/digistump/DigisparkArduinoIntegration/tree/master/libraries/DigisparkKeyboard). Besides the DigiKeyboard, I also import EEPROM.h.
My own code is only about 150 lines, I've cut down the size following a number of online guides, trying to avoid larger data types and so on. The Digispark is limited to ~6kB and the imported DigiKeyboard library takes up a little more that 5.4kB. In total the compiled project takes up about 7kB, which exceeds the boards capacity.
From the DigiKeyboard library I only use DigiKeyboard.sendKeyStroke() and DigiKeyboard.print() (with about only ten different characters). So I assume there is a lot of unused code I could remove, but I don't know how to approach this. I use Visual Studio Code and PlatformIO.
How could I reduce the size of the used DigisparkKeyboard library?
write()instead ofprint()?-flto?-O3 -fltodidn't change a byte for me and I couldn't find any documentation onwrite(). However, I switched to.sendKeyStrokefor all write operations from.print(), which shaved off about 3kB! and the code fits the board! If you formulate an answer, I'll gladly accept it!print(), but rather one single instance of print, where I did:DigiKeyboard.print("Time: "+String(round(runtime/1000)));. So I believe the large code was due to the inclusion ofString().