Commit Graph

32 Commits

Author SHA1 Message Date
Scott Allen d7758249fa Add function SPItransferAndRead()
Suggested by @MrBlinky
Same as SPItransfer() but also returns the byte received.
Provided for use with homemade or expanded units that have had
additional peripherals added to the SPI bus that are capable of
sending data.
2020-07-25 18:38:05 -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 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
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 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 53b50a9766 Add some previously missed keywords 2018-03-22 08:11:07 -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
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 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 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 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 6c297fab1e Add nextFrameDEV() function for checking CPU load 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 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 0b0c111757 Add clear option to display() and paintScreen()
Also remove some trailing whitespace
2016-11-24 14:51:45 -05:00
Scott Allen d89a2bd590 Improve embedded Doxygen documentation 2016-11-24 14:51:22 -05:00
Scott Allen 40a028e5a1 Remove Sprites class constructor parameter
The Sprites class has been given direct access to the screen buffer so it
doesn't need a pointer to been given to it.

Also updated README.md and keywords.txt, and made minor indent changes in
the .h files.
2016-10-20 13:28:29 -04:00
Scott Allen c0f04bcb92 Update keywords.txt 2016-06-15 16:18:06 -04:00
Scott Allen 2d0a6317a3 Combine function __attribute__ statments
Also delete getInput keyword and add buttonsState keyword
2016-05-26 18:30:26 -04:00
Scott Allen 7f8897cd20 Add keywords for audio functions 2016-05-26 18:30:26 -04:00
Arduboy 982175ecac Squash commits up to Arduboy V1.1 release 2016-05-26 17:18:33 -04:00