Commit Graph

129 Commits

Author SHA1 Message Date
Scott Allen 674ac8a774 Don't disable timer 0 for Arduboy core 2018-03-22 08:11:24 -04:00
Scott Allen 9a13011474 Use display() in begin() instead of blank()
This saves some code since display() is used multiple times but
blank() normally isn't.
2018-03-22 08:11:24 -04:00
Scott Allen a43e745250 Add system EEPROM flag to disable the boot logo
Flag SYS_FLAG_SHOW_LOGO added to EEPROM_SYS_FLAGS. The boot logo
functions check the flag and bypass the logo sequence if the flag
isn't set.

Added functions writeShowBootLogoFlag() and readShowBootLogoFlag()
for writing and reading the SYS_FLAG_SHOW_LOGO flag.

Renamed example sketch SetNameAndID to SetSystemEEPROM and added
the ability to set the SYS_FLAG_SHOW_LOGO flag, plus menus to reset
the system and user EEPROM areas.
2018-03-22 08:11:24 -04:00
Delio Brignoli da2c7e3d35 Add SpritesB class as alternative to Sprites
The SpritesB class has functions identical to those in Sprites.
When used in place of Sprites it will usually reduce code size (at the
expense of slower execution speed). Code size reduction is accomplished
by factoring all draw modes into the same loop.

Modifications made to the Sprites class to create this class made by
@dxxb (Delio Brignoli).

Creation of the SpritesB class and documentation by
@MLXXXp (Scott Allen).

Also, bootLogoSpritesBSelfMasked() and bootLogoSpritesBOverwrite()
alternative boot logo functions added by @MLXXXp.
2018-03-22 08:11:24 -04:00
Scott Allen d76eb15c51 Explicitly specify the type in doxygen code blocks
Just to be safe.
2018-03-11 05:40:44 -04:00
Scott Allen c00fee0a78 Add the ability to eliminate the USB stack code
Macro ARDUBOY_NO_USB will provide a substitute main() which will cause
the compiler to leave out the USB code. The macro also adds a check
for the DOWN button being pressed and, if so, will call the new
exitToBootloader() function.

New function exitToBootloader() will invoke the bootloader in command
mode, similar to pressing reset.
2018-03-11 05:40:44 -04:00
Scott Allen fb77929126 Refactor setRGBled() and add freeRGBled()
- setRGBled() has been rewritten to directly control the hardware
  instead of using the Arduino analogWrite() function.

- Added a two parameter version of setRGBled() that sets the brightness
  of one LED without affecting the others.

- Added function freeRGBled() for freeing the PWM control of the LEDs
  so they can be used digitally.

- Added example sketch RGBled.
2018-03-11 05:40:44 -04:00
Scott Allen eb041d24f8 Add function to wait for all buttons released
New function waitNoButtons() replaces the code at the end of begin()
that waits for all buttons to be released. This is to make it easier
to add back this functionality when using boot() in place of begin().
2018-03-11 05:40:44 -04:00
Scott Allen 53ea8188d5 Add Beep classes for playing simple tones
Also added a BeepDemo example sketch and modified the ArduBreakout
example sketch to use the BeepPin1 class instead of Arduino tone().
2018-03-11 05:40:44 -04:00
Scott Allen 460e768ea9 Refactor nextFrame() and add setFrameDuration()
nextFrame() changes were in colaboration with @MrBlinky

setFrameDuration() can be used as an alternative to setFrameRate()
2018-03-11 05:40:44 -04:00
Mr.Blinky 4788b1ab01 Refactor buttonsState()
By @MrBlinky
With some source code formatting and cleanup by @MLXXXp (Scott Allen).
2018-03-11 05:39:57 -04:00
Scott Allen d356be4e13 Refactor and speed up bootLogo functions 2018-03-04 13:51:37 -05:00
Scott Allen 6e1c47cbe0 Refactor idle() to reduce code size 2018-03-04 13:42:17 -05:00
Mr.Blinky bd726fc112 Refactor and optimise paintScreen() in assembler
By @MrBlinky with contributions from @veritazz (Michael Gollnick) and
@MLXXXp (Scott Allen).
2018-03-04 13:31:43 -05:00
Scott Allen d44b89e01f Minor source format changes for drawCompressed()
No code changes from previous commit.
2018-01-17 13:56:25 -05:00
Pharap 6f6849a5bb Reduce drawCompressed progmem usage (#19)
Reduce drawCompressed() progmem usage
2018-01-17 13:51:34 -05:00
Erwin Ried d6336803a2 Small typo on the code example 2017-12-19 15:33:01 +01:00
Scott Allen 93c33f6ad6 Change characters used for Sprites examples 2017-12-10 09:13:11 -05:00
Scott Allen 5e58d9b6a8 Fix minor grammar error in Sprites documentation 2017-12-09 22:48:59 -05:00
Scott Allen 383bdfc144 fix and clarify Sprite assembly comments 2017-08-28 21:31:10 -04:00
Scott Allen 420b958208 Merge branch 'master' of https://github.com/MLXXXp/Arduboy2 2017-08-28 21:13:10 -04:00
Scott Allen 5370409875 fix documentation comments for initRandomSeed() 2017-08-28 21:09:13 -04:00
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
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