Sometimes the compiler would assign r28/29 to one of our input
variables despite our needing to use that register ourselves. This
fix attempts to prevent that from happening and also cleans up a
few other small details.
- remove unnecessary y_count (-1 register)
- set buffer_ofs_2 inside assembly (-1 register)
- require inputs/outputs to use lower or simple upper registers
- declare a high register clobber
This seems to have the side effect of freeing up a high register and
preventing the error:
"can't find a register in class 'LD_REGS' while reloading 'asm'""
When sRow == -1 drawPlusMask can cause buffer underflow if it's
interrupted by an interrupt that changes memory that it's in the middle
of writing. Of course it shouldn't be writing to this memory at all.
This fixes the issue.
- Inlined : 332 -> 358 ops/ms
- Non-inlined : 222 -> 303 ops/ms
Moves most of the pixel offset calculation math into assembly.
Also uses a shift lookup table vs calculting bit shifts on the
CPU (which is slow)
Same as Arduino delay() except takes a 16 bit value.
Mainly added to save some code in the library but can be used by
sketches for the same purpose.
Also changed a delay in bootLogoText() to match a previous change in
bootLogo()
displayOff() puts the display in low power mode.
displayOn() re-initializes the display after displayOff() is used.
The SPI initialization code was separated from the display
initialization code to facilitate the new functions.
New functions bootLogoCompressed(), bootLogoSpritesSelfMasked() and
bootLogoSpritesOverwrite() can be used in place of bootLogo() to
reduce code size in cases where their drawing functions are shared
with the same functions used by the sketch.
New function bootLogoShell() added to provide common code for the
above functions.
Also, the Sprites class functions, and functions used for drawing the
logos, were made static.
- Added a flag in system EEPROM to indicate if the unit name
should be displayed at the end of the boot logo sequence.
Function bootLogoExtra() displays the unit name only if the
flag is set.
- Added functions writeShowUnitNameFlag() and readShowUnitNameFlag()
to write and read the "Show Unit Name" flag in EEPROM.
- Enhanced the SetNameAndID example sketch to allow setting the
"Show Unit Name" flag in EEPROM.
- Timer 0 is disabled in flashlight() and safeMode() in case its
variables overlap the bootloader "magic key" location.
- Flashlight mode never exits if invoked.
- Made safeMode() public for use as a smaller code size alternative
to flashlight().