Commit Graph

82 Commits

Author SHA1 Message Date
Scott Allen 7dc88bed30 Change version to 6.0.0
The major version number has been incremented only because there's a
chance that a sketch that sets text wrap on will behave differently,
due to the changes in the way wrapping is now handled.
2020-09-29 09:44:41 -04:00
Scott Allen 191e9a2e45 Document bitmap image height requirements
Added the requirement that bitmap heights must be a multiple of
8 pixels in the documentation for drawBitmap() and drawCompressed().
2020-09-29 09:44:41 -04:00
Scott Allen 98f03773b2 Make state variables used by pollButtons() public
The variables currentButtonState and previousButtonState used by
pollButtons(), justPressed() and justReleased() have been made public.
This allows them to be manipulated if circumstances require it.

The documentation added for previousButtonState includes an example.
2020-09-29 09:44:40 -04:00
Scott Allen 4698dd276e Make all possible functions and variables static
This is mainly to reduce code size.

The write() function in class Arduboy2 has to remain virtual,
so functions that result in it eventually being called could
not be made static.

The members of the Point and Rect structures could not be made static
due to their intended use as having multiple instances.

Also to reduce code size, bootLogoExtra() was made non-virtual.
This meant that the begin() and bootLogo...() functions in the
Arduboy2Base class had to have duplicate or equivalent functions
added to the Arduboy2 class.

Related documentation was updated and some minor changes were made to
non-related documentation.
2020-09-29 09:44:40 -04:00
Scott Allen e78e7c9d55 Add more Doxygen cross-referencing
Also:
- Rearrange the order of some member function declarations.
- Minor documentation changes.
2020-09-29 09:44:40 -04:00
Scott Allen 1264edc748 Refactor function BitStreamReader()
Changed from struct to class.

Removed explicit use of the "this" pointer for consistency with
the rest of the library.
2020-09-29 09:44:40 -04:00
Scott Allen aaf4159274 Remove PIXEL_SAFE_MODE define
The ability to compile drawPixel() to not check for
drawing pixels off screen has been removed.
2020-09-29 09:44:20 -04:00
Scott Allen 58a35e2ad9 Refactor text code and add char size functions
- Functions write() and drawChar() were refactored for smaller code
  size and to make text wrapping operate more like what would normally
  be expected.

- A new flag variable, textRaw, has been added, along with functions
  setTextRawMode() and getTextRawMode() to set and read it.
  When set, the write() function will render the value \n (0x0a) as
  an "inverse white circle" instead of handling it as a newline and
  render value \r (0x0d) as a "musical eighth note" instead of
  ignoring it.

- Spacing added at the end of each character is no longer factored in
  when determining if a character will fit on screen at the end of
  a line.

- Checking if line wrap is neccessary is done before drawing a
  character, instead of doing it after drawing to prepare for the
  next character. This fixed a problem with requested line feeds
  interacting with wrapping, resulting in unexpected blank lines.

- Fixed a bug that caused the drawing of characters with a transparent
  background to not work properly. (This is selected by setting the
  background color to be the same as the text color.)

- Added new functions getCharacterWidth() getCharacterHeight()
  getCharacterSpacing() getLineSpacing() to programmatically get
  the dimensions of a character, given the desired text size.

- Functions write() and drawChar() are now able to render a font of
  any character size, and with any character and line spacing, by
  setting variables characterWidth characterHeight characterSpacing
  and lineSpacing, and providing a matching font array. This doesn't
  affect their use with this library but has been done for the sake
  of code portability.
2020-09-28 21:11:13 -04:00
Scott Allen 7fcbd35266 Fix minor documentation issues 2020-08-23 15:21:28 -04:00
Scott Allen f1009abd7b Change version to 5.3.0 2020-07-25 18:38:05 -04:00
Scott Allen 13130f368a Move generateRandomSeed() to Arduboy2Core
Suggested by @yyyc514 (Josh Goebel)
The generateRandomSeed() function was moved from the Arduboy2Base class
to the Arduboy2Core class, since it deals directly with hardware.
It was also made static.

Some related documentation was changed.
2020-07-25 18:38:05 -04:00
Pharap 5563599c6d Make writeUnitName() const-correct
Changed the writeUnitName() parameter from
"char* name" to "const char* name".
This will prevent warnings or errors when a string literal or
an array of type "const char" is passed to it.
2020-07-25 18:38:05 -04:00
Scott Allen c74438e377 Rewrite Cabi README.md with more details
Also added file sample.png in the cabi directory, which is used
for the example sketch in the Cabi README.md file

Also added a note referring to Cabi in the documentation for
drawCompressed()
2020-07-25 18:37:44 -04:00
Scott Allen 355e2d2081 Update or remove outdated URLs 2020-07-24 17:15:37 -04:00
Scott Allen 2d04cf60e1 Change non-API EEPROM defines to constexpr
Macro defines for system EEPROM access that were not intended to be
part of the API have been made into protected constexpr variables of
the Arduboy2Base class.
2020-07-24 17:15:37 -04:00
Scott Allen 0adb83693a Add functions anyPressed() setCursorX() setCursorY()
Suggested by @Pharap
2020-07-24 17:15:37 -04:00
Scott Allen 53096d87bf Refactor API code. Clarify and enhance user docs.
Includes some suggestions and guidance by @Pharap

API:
- Rename non-API function swap() to swapInt16()
- Make swapInt16(), drawCircleHelper(), fillCircleHelper() and
  struct BitStreamReader protected members of Arduboy2Base
- Add #define ARDUBOY_UNIT_NAME_BUFFER_SIZE for the size of a buffer
  to hold a Unit Name
- Move the position of the PROGMEM keyword for lcdBootProgram[]
  for consistency

Documentation:
- Remove absolute values referring to a Unit Name
- More details relating to the use of the Unit Name
- More details relating to the font and text functions
- Other minor documentation changes and spelling corrections
2020-07-24 17:15:13 -04:00
Scott Allen 4f884f4ed2 Make font and logo data arrays class members
To address a compiler warning for the font array and improve the API.
With help and guidance from @Pharap
2020-07-20 19:12:45 -04:00
Pharap 4e513a15d0
Make Rect and Point's constructors constexpr 2020-02-21 18:18:15 +00:00
Scott Allen 096aaac8dd Change version to 5.2.1 2019-02-27 17:33:10 -05:00
Pharap b40e3b9c57 Fix missing Print::write overloads
Problem:
The overloading of `Print::write` was previously causing the other
overloads of `write` to be hidden.
For more information on this behaviour, see the following
StackOverflow question:
https://stackoverflow.com/questions/1628768

Solution:
The solution uses a `using`-declaration to bring the `Print::write`
overloads into `Arduboy2`'s scope.
For more information on this usage of a `using`-declaration, see the
following cppreference page:
https://en.cppreference.com/w/cpp/language/using_declaration#In_class_definition
2019-02-27 15:38:57 -05:00
Scott Allen 974f5298ee Change version to 5.2.0 2018-11-15 19:27:26 -05:00
Scott Allen c87f512b53 Document Rect and Point constructor parameters 2018-11-15 19:27:26 -05:00
Mr.Blinky 2941ed100f Fix a compiler issue and optimize drawPixel()
The new compiler in Arduino IDE 1.8.6/1.8.7 has an optimization glitch
where it fails to see the difference between a data structure in RAM
and in PROGMEM when the data is the same and optimizes one out.

drawPixel() is unable to fetch the correct pixel mask from the
bitshift_left array in PROGMEM causing junk to be drawn.

The bitshift_left[] array has now been optimised out and drawPixel()
will function properly. The optimization uses the same number of cycles
and saves 6 bytes.

drawPixel() has also been made static so the Arduboy object pointer is
no longer needlesly passed on to drawPixel() saving more bytes.
2018-11-15 19:26:58 -05:00
Pharap d5b4a45706 Make both collide functions static 2018-11-13 12:20:14 -05:00
Pharap 1f86208163 Add constructors to Point 2018-11-13 12:19:35 -05:00
Pharap bc63e39931 Add constructors to Rect 2018-11-13 12:15:55 -05:00
Pharap 54d47ec04e
Remove unncessary limits.h includes 2018-09-03 07:37:16 +01:00
Scott Allen 0eae58c760 Fix initRandomSeed(). Minor code and doc changes
The call to generateRandomSeed() in initRandomSeed() was missing
parentheses.

Added keyword for generateRandomSeed.

Minor code changes, and documentation changes and additions.
2018-04-23 15:44:15 -04:00
Pharap 4c2e412985
Introduce generateRandomSeed function 2018-04-18 01:33:30 +01:00
Scott Allen 58ae256412 Change version to 5.1.0 2018-04-07 07:33:28 -04:00
Scott Allen b8c1cb742a Add EEPROM flag to disable RGB LED with boot logo
Flag SYS_FLAG_SHOW_LOGO_LEDS added to EEPROM_SYS_FLAGS.
The boot logo functions check the flag and leave the RGB LED off if
the flag isn't set.

Added functions writeShowBootLogoLEDsFlag() and
readShowBootLogoLEDsFlag() for writing and reading the
SYS_FLAG_SHOW_LOGO_LEDS flag.

Example sketch SetSystemEEPROM modified to allow setting the
SYS_FLAG_SHOW_LOGO_LEDS flag.
2018-04-07 07:09:49 -04:00
Scott Allen 15db34cab2 Change version to 5.0.0 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 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
Erwin Ried d6336803a2 Small typo on the code example 2017-12-19 15:33:01 +01:00
Scott Allen 5370409875 fix documentation comments for initRandomSeed() 2017-08-28 21:09:13 -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 46ecb2dd78 Change version to 4.0.1 2017-06-16 18:44:44 -04:00
Scott Allen 342186281a Change version to 4.0.0 2017-04-26 10:14:51 -04:00
Scott Allen dac16d5e36 Remove inadvertently added space character 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
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