Commit Graph

130 Commits

Author SHA1 Message Date
Scott Allen 78de8a439b Merge pull request #13 from yyyc514/sprites_assembly_buffer_underflow
Fix buffer underflow in drawPlusMask
2017-04-26 10:26:55 -04:00
Josh Goebel e307cdc725 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-22 15:25:33 -04:00
Josh Goebel 5fe9488b10 tmp variables can be flagged as output only
- this saves a few bytes
2017-04-22 15:25:29 -04:00
Josh Goebel ceef595357 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-22 15:24:58 -04:00
Scott Allen 878dffdb12 Merge branch 'sprite_cleanup'
of https://github.com/yyyc514/Arduboy2 into develop
2017-04-19 17:23:43 -04:00
Scott Allen 98db5a9ba5 Merge branch 'pixel_performance'
of https://github.com/yyyc514/Arduboy2 into develop
2017-04-19 17:22:05 -04:00
Josh Goebel b246b8180f any upper register is fine 2017-04-19 15:07:07 -04:00
Josh Goebel fcfc0c9aa0 minor code fixes for sprites
- saves several bytes for sketches using drawPlusMask()
2017-04-18 21:26:32 -04:00
Scott Allen 8544463b11 Remove inadvertently added space character 2017-04-18 12:41:34 -04:00
Scott Allen 36bbfa89ab Merge pull request #9 from yyyc514/pixel_performance
Pixel performance improvements
2017-04-18 12:31:33 -04:00
Josh Goebel d999733320 remove unnecessary carry 2017-04-17 23:24:04 -04:00
Josh Goebel 825d6bc760 make sure row_offset and y do not overlap 2017-04-17 22:46:18 -04:00
Josh Goebel 023a7120b8 add back original C implimentation 2017-04-17 20:06:25 -04:00
Josh Goebel 07c321cd44 make sure we use upper registers 2017-04-17 20:06:25 -04:00
Josh Goebel dfbe2dda3b 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-17 20:06:20 -04:00
Scott Allen 142d85415c 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-17 18:52:53 -04:00
Scott Allen e96ae541d6 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-17 18:52:53 -04:00
Scott Allen 070a364741 Remove "inline" keywords and attributes
Optimization done by the compiler makes these unnecessary.
2017-04-17 18:52:53 -04:00
Scott Allen f0dc4d0de5 Eliminate mismatched type warning in drawChar()
Also changed a loop index from int8_t to uint8_t to match other loops.
2017-04-17 18:52:53 -04:00
Josh Goebel 69150a018a optimize drawChar (-126 bytes) 2017-04-13 21:03:12 -04:00
Scott Allen aa29a1881c Remove extra 50ms delay added by de1725
by Josh Goebel.
Merge conflict resolved.
2017-04-13 21:02:36 -04:00
Josh Goebel fae5f9a19f optimize readUnitName (-6 bytes) 2017-04-13 20:43:08 -04:00
Josh Goebel 3a22bb9da0 optimize writeUnitName (-130 bytes) 2017-04-13 20:43:08 -04:00
Josh Goebel 1f48e852e5 clean up frame management code (-6 bytes)
- saves 6 bytes compiling Mystic Balloon on Arduino 1.8.1
2017-04-13 20:43:08 -04:00
Scott Allen 9efa78bf68 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-12 17:48:54 -04:00
Scott Allen cca56f91f4 Adjust location of some braces for consistency
This is just a source formatting change.
2017-04-07 15:02:11 -04:00
Scott Allen c962257488 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-07 14:47:15 -04:00
Scott Allen 4f58fa710a 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-07 14:47:15 -04:00
Scott Allen 4b74b2c366 Add bootLogoText() function
Displays the boot logo using text instead of a bitmap,
as an option to reduce code size.
2017-04-07 14:47:15 -04:00
Scott Allen a8077a756e 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-07 14:47:15 -04:00
Scott Allen a85c6da431 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-07 14:46:59 -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
Scott Allen 2cbe4afa08 Rearrange and update README.md 2017-02-06 18:09:50 -05:00
Scott Allen 6c297fab1e Add nextFrameDEV() function for checking CPU load 2017-02-06 18:09:50 -05:00
Scott Allen de17257029 Add boot logo bypass feature
Pressing the RIGHT button while the boot logo is scrolling down will
abort the sequence, to start running the actual sketch faster.
2017-02-06 18:09:50 -05:00
Scott Allen 2fede9cb86 Add read/write EEPROM unit name and ID functions
Also:
- Changes to show the unit name on the boot logo screen
- Added new example sketch SetNameAndID to allow setting the name and ID
- Updated the LICENSE.txt file and made changes to include it in the
  Doxygen generated documentation
2017-02-06 18:09:50 -05:00
Scott Allen 8125862bfe Make frameCount public and document it 2017-02-06 18:09:50 -05:00
Scott Allen 3e82f484a2 Add missing "details" keyword to Doxygen comments
Also add missing angle brackets around email address in library.properties
2017-02-06 18:09:50 -05:00
Scott Allen 4607f087a2 Make display buffer array public 2017-02-06 18:09:13 -05:00
Scott Allen 388f8abb9f Add drawCompressed to keywords.txt 2016-12-13 11:54:25 -05:00
Scott Allen 7dfb4f14f7 Add sound on/off toggle function 2016-12-13 11:49:29 -05:00
Scott Allen a9271a335d Minor changes to LICENCE.txt 2016-12-13 10:01:32 -05:00
Scott Allen e00acd4d06 Add Library documentation section to README.md 2016-11-24 14:51:45 -05:00