Commit Graph

241 Commits

Author SHA1 Message Date
Josh Goebel 4478b1fe0a fix random display glitches with sprite rendering
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
2017-08-26 14:55:02 -04:00
Scott Allen 1bb4726ed0 Change version to 4.1.0 2017-07-31 17:10:21 -04:00
Scott Allen fe30863dbe Add complimentary "get" for text "set" functions
Added functions getTextColor(), getTextBackground(),
getTextSize() and getTextWrap() to the Arduboy2 class
2017-07-31 16:57:28 -04:00
Scott Allen 6ab6b83e2c Fix some small errors in documentation comments 2017-07-31 11:56:10 -04:00
Scott Allen fd614ab586 Change version to 4.0.2 2017-07-07 11:38:02 -04:00
Scott Allen e6e82bf336 Fix initialisation of Right button for DevKit 2017-07-07 11:30:48 -04:00
Scott Allen 46ecb2dd78 Change version to 4.0.1 2017-06-16 18:44:44 -04:00
Scott Allen b121d19b77 Refactor fillScreen() 2017-06-16 18:37:19 -04:00
Scott Allen bd5b470294 Change drawPixel() to avoid Z reg corruption
Also use _BV() to specify bit masks in the bitshift_left array,
and other minor formatting changes
2017-06-16 18:05:19 -04:00
Scott Allen 6074f9fc56 Merge pull request #14 from Pharap/master
Fix bug in drawPixel asm
2017-06-16 17:59:03 -04:00
Pharap 427c1d53f2 Fix bug in drawPixel asm 2017-06-14 19:31:54 +01:00
Scott Allen 342186281a Change version to 4.0.0 2017-04-26 10:14:51 -04:00
Scott Allen 3c4915b0d5 Add commented out logo alternatives to begin() 2017-04-26 10:08:07 -04:00
Scott Allen a01ceffb20 Fix improper masking in Sprites drawPlusMask()
As per Josh Goebel @yyyc514
2017-04-25 15:36:42 -04:00
Scott Allen babf6893c8 Eliminate "may be uninitialized" variable warning
Code in Sprites.cpp refactored to eliminate
"warning: 'mask_ofs' may be used uninitialized in this function"
2017-04-25 15:36:42 -04:00
Josh Goebel b4d8fd8d6f fix register pressure
- 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'""
2017-04-25 15:36:42 -04:00
Josh Goebel 606c80268b tmp variables can be flagged as output only
- this saves a few bytes
2017-04-25 15:36:42 -04:00
Josh Goebel 5d428a3a33 Fix buffer underflow in drawPlusMask
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.
2017-04-25 15:36:42 -04:00
Josh Goebel 520be03d59 any upper register is fine 2017-04-25 15:36:42 -04:00
Josh Goebel 3aa015b997 minor code fixes for sprites
- saves several bytes for sketches using drawPlusMask()
2017-04-25 15:36:42 -04:00
Scott Allen dac16d5e36 Remove inadvertently added space character 2017-04-25 15:36:42 -04:00
Josh Goebel e235f26def remove unnecessary carry 2017-04-25 15:36:42 -04:00
Josh Goebel 50df1a221b make sure row_offset and y do not overlap 2017-04-25 15:36:42 -04:00
Josh Goebel 6f9056f99c add back original C implimentation 2017-04-25 15:36:42 -04:00
Josh Goebel 554c21f759 make sure we use upper registers 2017-04-25 15:36:42 -04:00
Josh Goebel e1cce03580 Optimize drawPixel for speed (-20 bytes)
- 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)
2017-04-25 15:36:42 -04:00
Scott Allen ab1a7b3bdd Add delayShort() function
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()
2017-04-25 15:36:42 -04:00
Scott Allen fc61d180d9 Add displayOff() and displayOn() functions
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.
2017-04-25 15:36:42 -04:00
Scott Allen 9bfb499169 Remove "inline" keywords and attributes
Optimization done by the compiler makes these unnecessary.
2017-04-25 15:36:42 -04:00
Scott Allen 96b53875b5 Eliminate mismatched type warning in drawChar()
Also changed a loop index from int8_t to uint8_t to match other loops.
2017-04-25 15:36:42 -04:00
Josh Goebel ae8e284d41 optimize drawChar (-126 bytes) 2017-04-25 15:36:42 -04:00
Scott Allen 6e13fc019f Remove extra 50ms delay added by de1725
by Josh Goebel.
Merge conflict resolved.
2017-04-25 15:36:42 -04:00
Josh Goebel 1280160f89 optimize readUnitName (-6 bytes) 2017-04-25 15:36:42 -04:00
Josh Goebel 5877208a57 optimize writeUnitName (-130 bytes) 2017-04-25 15:36:42 -04:00
Josh Goebel 6050dda391 clean up frame management code (-6 bytes)
- saves 6 bytes compiling Mystic Balloon on Arduino 1.8.1
2017-04-25 15:36:42 -04:00
Scott Allen 449532f1e9 Add alternative boot logo 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.
2017-04-25 15:36:42 -04:00
Scott Allen 79f24c47cc Adjust location of some braces for consistency
This is just a source formatting change.
2017-04-25 15:36:42 -04:00
Scott Allen cfb5e89d5c Simplify initRandomSeed() to reduce code size
Use only an ADC reading from an unconnected pin shifted left 16 bits
then added to micros().
2017-04-25 15:36:42 -04:00
Scott Allen 3572a013e1 Make showing the unit name with the logo optional
- 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.
2017-04-25 15:36:42 -04:00
Scott Allen 14d5877dae Add bootLogoText() function
Displays the boot logo using text instead of a bitmap,
as an option to reduce code size.
2017-04-25 15:36:42 -04:00
Scott Allen f294a045e0 Fix flashlight() and safeMode() for boot problem
- 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().
2017-04-25 15:36:42 -04:00
Scott Allen 1e7f251ce0 Direct control of ports and pins
This eliminates calls to pinMode(), digitalWrite(), functions to
initialize hardware, etc.

New 2 parameter version of digitalWriteRGB() added, which sets an
individual RGB LED on or off digitally.

New function SPItransfer() added to replace Arduino SPI.transfer().
2017-04-25 15:36:42 -04:00
Scott Allen 4ff6973a4b Change version to 3.1.1 2017-03-22 18:16:10 -04:00
Scott Allen cf648850c4 Merge branch 'master' of https://github.com/MLXXXp/Arduboy2 2017-03-22 18:04:31 -04:00
Scott Allen db50dfce87 Merge pull request #1 from yyyc514/master
Fix internal drawBitmap call use correct type for height and width
2017-03-22 17:48:24 -04:00
Josh Goebel b560ff9f60 fix internal drawBitmap call to use correct types 2017-03-22 17:43:56 -04:00
Scott Allen 2851dcf4cc Fix Sprites class data array documentation
A separate mask array does not include width and height values at
the beginning.
2017-03-13 18:00:40 -04:00
Scott Allen f07f2267b2 Add a link to the repository in README.md 2017-03-13 17:22:12 -04:00
Scott Allen 2760d87194 Change version to 3.1.0 2017-02-07 10:03:48 -05:00
Scott Allen b4707dc546 Fix comment in PlayTune sketch: Devkit -> DevKit 2017-02-07 09:57:32 -05:00