Arduboy2 Library  6.0.0
Arduboy2.h
Go to the documentation of this file.
1 
7 #ifndef ARDUBOY2_H
8 #define ARDUBOY2_H
9 
10 #include <Arduino.h>
11 #include <EEPROM.h>
12 #include "Arduboy2Core.h"
13 #include "Arduboy2Audio.h"
14 #include "Arduboy2Beep.h"
15 #include "Sprites.h"
16 #include "SpritesB.h"
17 #include <Print.h>
18 
37 #define ARDUBOY_LIB_VER 60000
38 
39 // EEPROM settings
52 #define ARDUBOY_UNIT_NAME_LEN 6
53 
65 #define ARDUBOY_UNIT_NAME_BUFFER_SIZE (ARDUBOY_UNIT_NAME_LEN + 1)
66 
75 #define EEPROM_STORAGE_SPACE_START 16
76 
77 // pixel colors
78 #define BLACK 0
79 #define WHITE 1
89 #define INVERT 2
90 
91 #define CLEAR_BUFFER true
94 //=============================================
95 //========== Rect (rectangle) object ==========
96 //=============================================
97 
108 struct Rect
109 {
110  int16_t x;
111  int16_t y;
112  uint8_t width;
113  uint8_t height;
118  Rect() = default;
119 
128  constexpr Rect(int16_t x, int16_t y, uint8_t width, uint8_t height)
129  : x(x), y(y), width(width), height(height)
130  {
131  }
132 };
133 
134 //==================================
135 //========== Point object ==========
136 //==================================
137 
146 struct Point
147 {
148  int16_t x;
149  int16_t y;
154  Point() = default;
155 
162  constexpr Point(int16_t x, int16_t y)
163  : x(x), y(y)
164  {
165  }
166 };
167 
168 //==================================
169 //========== Arduboy2Base ==========
170 //==================================
171 
212 {
213  friend class Arduboy2Ex;
214  friend class Arduboy2Audio;
215 
216  public:
217 
228 
250  static void begin();
251 
274  static void beginDoFirst();
275 
301  static void flashlight();
302 
319  static void systemButtons();
320 
337  static void bootLogo();
338 
349  static void bootLogoCompressed();
350 
361  static void bootLogoSpritesSelfMasked();
362 
373  static void bootLogoSpritesOverwrite();
374 
385  static void bootLogoSpritesBSelfMasked();
386 
397  static void bootLogoSpritesBOverwrite();
398 
443  static bool bootLogoShell(void (&drawLogo)(int16_t));
444 
462  static void waitNoButtons();
463 
472  static void clear();
473 
481  static void fillScreen(uint8_t color = WHITE);
482 
492  static void display();
493 
512  static void display(bool clear);
513 
526  static void drawPixel(int16_t x, int16_t y, uint8_t color = WHITE);
527 
536  static uint8_t getPixel(uint8_t x, uint8_t y);
537 
548  static void drawCircle(int16_t x0, int16_t y0, uint8_t r, uint8_t color = WHITE);
549 
560  static void fillCircle(int16_t x0, int16_t y0, uint8_t r, uint8_t color = WHITE);
561 
576  static void drawLine(int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint8_t color = WHITE);
577 
588  static void drawFastVLine(int16_t x, int16_t y, uint8_t h, uint8_t color = WHITE);
589 
600  static void drawFastHLine(int16_t x, int16_t y, uint8_t w, uint8_t color = WHITE);
601 
613  static void drawRect(int16_t x, int16_t y, uint8_t w, uint8_t h, uint8_t color = WHITE);
614 
626  static void fillRect(int16_t x, int16_t y, uint8_t w, uint8_t h, uint8_t color = WHITE);
627 
640  static void drawRoundRect(int16_t x, int16_t y, uint8_t w, uint8_t h, uint8_t r, uint8_t color = WHITE);
641 
654  static void fillRoundRect(int16_t x, int16_t y, uint8_t w, uint8_t h, uint8_t r, uint8_t color = WHITE);
655 
669  static void drawTriangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint8_t color = WHITE);
670 
684  static void fillTriangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint8_t color = WHITE);
685 
711  static void drawBitmap(int16_t x, int16_t y, const uint8_t *bitmap, uint8_t w, uint8_t h, uint8_t color = WHITE);
712 
742  static void drawSlowXYBitmap(int16_t x, int16_t y, const uint8_t *bitmap, uint8_t w, uint8_t h, uint8_t color = WHITE);
743 
773  static void drawCompressed(int16_t sx, int16_t sy, const uint8_t *bitmap, uint8_t color = WHITE);
774 
792  static uint8_t* getBuffer();
793 
808  static void initRandomSeed();
809 
836  static void setFrameRate(uint8_t rate);
837 
856  static void setFrameDuration(uint8_t duration);
857 
884  static bool nextFrame();
885 
913  static bool nextFrameDEV();
914 
940  static bool everyXFrames(uint8_t frames);
941 
963  static int cpuLoad();
964 
984  static bool pressed(uint8_t buttons);
985 
1006  static bool anyPressed(uint8_t buttons);
1007 
1028  static bool notPressed(uint8_t buttons);
1029 
1063  static void pollButtons();
1064 
1085  static bool justPressed(uint8_t button);
1086 
1113  static bool justReleased(uint8_t button);
1114 
1129  static bool collide(Point point, Rect rect);
1130 
1146  static bool collide(Rect rect1, Rect rect2);
1147 
1160  static uint16_t readUnitID();
1161 
1174  static void writeUnitID(uint16_t id);
1175 
1220  static uint8_t readUnitName(char* name);
1221 
1251  static void writeUnitName(const char* name);
1252 
1267  static bool readShowBootLogoFlag();
1268 
1283  static void writeShowBootLogoFlag(bool val);
1284 
1299  static bool readShowUnitNameFlag();
1300 
1315  static void writeShowUnitNameFlag(bool val);
1316 
1330  static bool readShowBootLogoLEDsFlag();
1331 
1346  static void writeShowBootLogoLEDsFlag(bool val);
1347 
1381  static uint16_t frameCount;
1382 
1395  static uint8_t currentButtonState;
1396 
1451  static uint8_t previousButtonState;
1452 
1465  static uint8_t sBuffer[(HEIGHT*WIDTH)/8];
1466 
1472  static const PROGMEM uint8_t arduboy_logo[];
1473 
1479  static const PROGMEM uint8_t arduboy_logo_compressed[];
1480 
1488  static const PROGMEM uint8_t arduboy_logo_sprite[];
1489 
1490  protected:
1491  // helper function for sound enable/disable system control
1492  static void sysCtrlSound(uint8_t buttons, uint8_t led, uint8_t eeVal);
1493 
1494  // functions passed to bootLogoShell() to draw the logo
1495  static void drawLogoBitmap(int16_t y);
1496  static void drawLogoCompressed(int16_t y);
1497  static void drawLogoSpritesSelfMasked(int16_t y);
1498  static void drawLogoSpritesOverwrite(int16_t y);
1499  static void drawLogoSpritesBSelfMasked(int16_t y);
1500  static void drawLogoSpritesBOverwrite(int16_t y);
1501 
1502  // draw one or more "corners" of a circle
1503  static void drawCircleHelper(int16_t x0, int16_t y0, uint8_t r, uint8_t corners,
1504  uint8_t color = WHITE);
1505 
1506  // draw one or both vertical halves of a filled-in circle or
1507  // rounded rectangle edge
1508  static void fillCircleHelper(int16_t x0, int16_t y0, uint8_t r,
1509  uint8_t sides, int16_t delta, uint8_t color = WHITE);
1510 
1511  // helper for drawCompressed()
1512  class BitStreamReader;
1513 
1514  // swap the values of two int16_t variables passed by reference
1515  static void swapInt16(int16_t& a, int16_t& b);
1516 
1517  // For frame functions
1518  static uint8_t eachFrameMillis;
1519  static uint8_t thisFrameStart;
1520  static uint8_t lastFrameDurationMs;
1521  static bool justRendered;
1522 
1523  // ----- Map of EEPROM addresses for system use-----
1524 
1525  // EEPROM address 0 is reserved for bootloader use
1526  // This library will not touch it
1527 
1528  // Control flags
1529  static constexpr uint16_t eepromSysFlags = 1;
1530  // Audio mute control. 0 = audio off, non-zero = audio on
1531  static constexpr uint16_t eepromAudioOnOff = 2;
1532  // -- Addresses 3-7 are currently reserved for future use --
1533  // A uint16_t binary unit ID
1534  static constexpr uint16_t eepromUnitID = 8; // A uint16_t binary unit ID
1535  // An up to 6 character unit name
1536  // The name cannot contain 0x00, 0xFF, 0x0A, 0x0D
1537  // Lengths less than 6 are padded with 0x00
1538  static constexpr uint16_t eepromUnitName = 10;
1539  // -- User EEPROM space starts at address 16 --
1540 
1541  // --- Map of the bits in the eepromSysFlags byte --
1542  // Display the unit name on the logo screen
1543  static constexpr uint8_t sysFlagUnameBit = 0;
1544  static constexpr uint8_t sysFlagUnameMask = _BV(sysFlagUnameBit);
1545  // Show the logo sequence during boot up
1546  static constexpr uint8_t sysFlagShowLogoBit = 1;
1547  static constexpr uint8_t sysFlagShowLogoMask = _BV(sysFlagShowLogoBit);
1548  // Flash the RGB led during the boot logo
1549  static constexpr uint8_t sysFlagShowLogoLEDsBit = 2;
1550  static constexpr uint8_t sysFlagShowLogoLEDsMask = _BV(sysFlagShowLogoLEDsBit);
1551 };
1552 
1553 
1554 //==============================
1555 //========== Arduboy2 ==========
1556 //==============================
1557 
1575 class Arduboy2 : public Print, public Arduboy2Base
1576 {
1577  friend class Arduboy2Ex;
1578 
1579  public:
1580 
1630  using Print::write;
1631 
1653  void begin();
1654 
1671  void bootLogo();
1672 
1683  void bootLogoCompressed();
1684 
1696 
1707  void bootLogoSpritesOverwrite();
1708 
1720 
1732 
1762  void bootLogoText();
1763 
1787  void bootLogoExtra();
1788 
1825  virtual size_t write(uint8_t);
1826 
1852  static void drawChar(int16_t x, int16_t y, uint8_t c, uint8_t color, uint8_t bg, uint8_t size);
1853 
1872  static void setCursor(int16_t x, int16_t y);
1873 
1887  static void setCursorX(int16_t x);
1888 
1902  static void setCursorY(int16_t y);
1903 
1915  static int16_t getCursorX();
1916 
1928  static int16_t getCursorY();
1929 
1938  static void setTextColor(uint8_t color);
1939 
1947  static uint8_t getTextColor();
1948 
1965  static void setTextBackground(uint8_t bg);
1966 
1974  static uint8_t getTextBackground();
1975 
1990  static void setTextSize(uint8_t s);
1991 
2000  static uint8_t getTextSize();
2001 
2020  static void setTextWrap(bool w);
2021 
2029  static bool getTextWrap();
2030 
2048  static void setTextRawMode(bool raw);
2049 
2057  static bool getTextRawMode();
2058 
2062  static void clear();
2063 
2086  static constexpr uint8_t getCharacterWidth(uint8_t textSize = 1)
2087  {
2088  return characterWidth * textSize;
2089  }
2090 
2108  static constexpr uint8_t getCharacterSpacing(uint8_t textSize = 1)
2109  {
2110  return characterSpacing * textSize;
2111  }
2112 
2129  static constexpr uint8_t getCharacterHeight(uint8_t textSize = 1)
2130  {
2131  return characterHeight * textSize;
2132  }
2133 
2158  static constexpr uint8_t getLineSpacing(uint8_t textSize = 1)
2159  {
2160  return lineSpacing * textSize;
2161  }
2162 
2208  static const PROGMEM uint8_t font5x7[];
2209 
2210  protected:
2211  static int16_t cursor_x;
2212  static int16_t cursor_y;
2213  static uint8_t textColor;
2214  static uint8_t textBackground;
2215  static uint8_t textSize;
2216  static bool textWrap;
2217  static bool textRaw;
2218 
2219  // Width and height of a font5x7 character
2220  // (not including inter-character spacing)
2221  static constexpr uint8_t characterWidth = 5;
2222  static constexpr uint8_t characterHeight = 8;
2223  // Width of inter-character spacing
2224  static constexpr uint8_t characterSpacing = 1;
2225  // Height of inter-line spacing
2226  static constexpr uint8_t lineSpacing = 0;
2227  // Character sizes including spacing
2228  static constexpr uint8_t fullCharacterWidth = characterWidth + characterSpacing;
2229  static constexpr uint8_t fullCharacterHeight = characterHeight + lineSpacing;
2230 };
2231 
2232 #endif
2233 
Arduboy2Base::drawFastVLine
static void drawFastVLine(int16_t x, int16_t y, uint8_t h, uint8_t color=WHITE)
Draw a vertical line.
Definition: Arduboy2.cpp:548
Arduboy2::getCharacterSpacing
static constexpr uint8_t getCharacterSpacing(uint8_t textSize=1)
Get the number of pixels added after each character to provide spacing.
Definition: Arduboy2.h:2108
Arduboy2Base::display
static void display()
Copy the contents of the display buffer to the display.
Definition: Arduboy2.cpp:997
Sprites.h
A class for drawing animated sprites from image and mask bitmaps.
Arduboy2Base::fillRect
static void fillRect(int16_t x, int16_t y, uint8_t w, uint8_t h, uint8_t color=WHITE)
Draw a filled-in rectangle of a specified width and height.
Definition: Arduboy2.cpp:609
Arduboy2Base::previousButtonState
static uint8_t previousButtonState
Used by pollButtons() to hold the previous button state.
Definition: Arduboy2.h:1451
Arduboy2Base::pollButtons
static void pollButtons()
Poll the buttons and track their state over time.
Definition: Arduboy2.cpp:1027
Arduboy2Base::bootLogoSpritesSelfMasked
static void bootLogoSpritesSelfMasked()
Display the boot logo sequence using Sprites::drawSelfMasked().
Definition: Arduboy2.cpp:129
Arduboy2Base::drawRoundRect
static void drawRoundRect(int16_t x, int16_t y, uint8_t w, uint8_t h, uint8_t r, uint8_t color=WHITE)
Draw a rectangle with rounded corners.
Definition: Arduboy2.cpp:667
Arduboy2
The main functions provided for writing sketches for the Arduboy, including text output.
Definition: Arduboy2.h:1576
Arduboy2Base::drawLine
static void drawLine(int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint8_t color=WHITE)
Draw a line between two specified points.
Definition: Arduboy2.cpp:488
Arduboy2Core
Lower level functions generally dealing directly with the hardware.
Definition: Arduboy2Core.h:336
Arduboy2Base::fillTriangle
static void fillTriangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint8_t color=WHITE)
Draw a filled-in triangle given the coordinates of each corner.
Definition: Arduboy2.cpp:701
Arduboy2Base::drawTriangle
static void drawTriangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint8_t color=WHITE)
Draw a triangle given the coordinates of each corner.
Definition: Arduboy2.cpp:693
Arduboy2::bootLogoSpritesBOverwrite
void bootLogoSpritesBOverwrite()
Display the boot logo sequence using SpritesB::drawOverwrite().
Definition: Arduboy2.cpp:1227
Point::Point
Point()=default
The default constructor.
WHITE
#define WHITE
Definition: Arduboy2.h:79
Arduboy2Base::everyXFrames
static bool everyXFrames(uint8_t frames)
Indicate if the specified number of frames has elapsed.
Definition: Arduboy2.cpp:232
Arduboy2Base::initRandomSeed
static void initRandomSeed()
Seed the random number generator with a random value.
Definition: Arduboy2.cpp:283
Arduboy2Base::justPressed
static bool justPressed(uint8_t button)
Check if a button has just been pressed.
Definition: Arduboy2.cpp:1033
Arduboy2Base::drawCircle
static void drawCircle(int16_t x0, int16_t y0, uint8_t r, uint8_t color=WHITE)
Draw a circle of a given radius.
Definition: Arduboy2.cpp:362
Arduboy2Base::clear
static void clear()
Clear the display buffer.
Definition: Arduboy2.cpp:290
Point::x
int16_t x
Definition: Arduboy2.h:148
Arduboy2Base::currentButtonState
static uint8_t currentButtonState
Used by pollButtons() to hold the current button state.
Definition: Arduboy2.h:1395
Arduboy2::getTextBackground
static uint8_t getTextBackground()
Get the currently set text background color.
Definition: Arduboy2.cpp:1458
Arduboy2Base::drawCompressed
static void drawCompressed(int16_t sx, int16_t sy, const uint8_t *bitmap, uint8_t color=WHITE)
Draw a bitmap from an array of compressed data.
Definition: Arduboy2.cpp:902
Point::Point
constexpr Point(int16_t x, int16_t y)
The fully initializing constructor.
Definition: Arduboy2.h:162
Arduboy2::setTextBackground
static void setTextBackground(uint8_t bg)
Set the text background color.
Definition: Arduboy2.cpp:1453
Arduboy2::setTextColor
static void setTextColor(uint8_t color)
Set the text foreground color.
Definition: Arduboy2.cpp:1443
Arduboy2::bootLogoSpritesSelfMasked
void bootLogoSpritesSelfMasked()
Display the boot logo sequence using Sprites::drawSelfMasked().
Definition: Arduboy2.cpp:1203
Arduboy2Base::drawPixel
static void drawPixel(int16_t x, int16_t y, uint8_t color=WHITE)
Set a single pixel in the display buffer to the specified color.
Definition: Arduboy2.cpp:295
Point::y
int16_t y
Definition: Arduboy2.h:149
Arduboy2Base::cpuLoad
static int cpuLoad()
Return the load on the CPU as a percentage.
Definition: Arduboy2.cpp:278
Arduboy2Audio.h
The Arduboy2Audio class for speaker and sound control.
Arduboy2Base::sBuffer
static uint8_t sBuffer[(HEIGHT *WIDTH)/8]
The display buffer array in RAM.
Definition: Arduboy2.h:1465
Rect::Rect
constexpr Rect(int16_t x, int16_t y, uint8_t width, uint8_t height)
The fully initializing constructor.
Definition: Arduboy2.h:128
Arduboy2Base::nextFrameDEV
static bool nextFrameDEV()
Indicate that it's time to render the next frame, and visually indicate if the code is running slower...
Definition: Arduboy2.cpp:265
Arduboy2Base::writeShowBootLogoFlag
static void writeShowBootLogoFlag(bool val)
Write the "Show Boot Logo" flag in system EEPROM.
Definition: Arduboy2.cpp:1110
Arduboy2Base::writeUnitID
static void writeUnitID(uint16_t id)
Write a unit ID to system EEPROM.
Definition: Arduboy2.cpp:1063
Arduboy2Base::collide
static bool collide(Point point, Rect rect)
Test if a point falls within a rectangle.
Definition: Arduboy2.cpp:1043
Arduboy2::write
virtual size_t write(uint8_t)
Write a single character at the current text cursor position.
Definition: Arduboy2.cpp:1311
Arduboy2::setTextWrap
static void setTextWrap(bool w)
Set or disable text wrap mode.
Definition: Arduboy2.cpp:1474
Rect::y
int16_t y
Definition: Arduboy2.h:111
Arduboy2::bootLogoSpritesBSelfMasked
void bootLogoSpritesBSelfMasked()
Display the boot logo sequence using SpritesB::drawSelfMasked().
Definition: Arduboy2.cpp:1219
Arduboy2::setTextRawMode
static void setTextRawMode(bool raw)
Set or disable text raw mode, allowing special characters to be displayed.
Definition: Arduboy2.cpp:1484
Arduboy2Base::drawRect
static void drawRect(int16_t x, int16_t y, uint8_t w, uint8_t h, uint8_t color=WHITE)
Draw a rectangle of a specified width and height.
Definition: Arduboy2.cpp:539
Arduboy2Base::bootLogoCompressed
static void bootLogoCompressed()
Display the boot logo sequence using drawCompressed().
Definition: Arduboy2.cpp:119
Arduboy2::font5x7
static const PROGMEM uint8_t font5x7[]
The font used for text functions.
Definition: Arduboy2.h:2208
Arduboy2Base::audio
static Arduboy2Audio audio
An object created to provide audio control functions within this class.
Definition: Arduboy2.h:227
Arduboy2Base::drawSlowXYBitmap
static void drawSlowXYBitmap(int16_t x, int16_t y, const uint8_t *bitmap, uint8_t w, uint8_t h, uint8_t color=WHITE)
Draw a bitmap from a horizontally oriented array in program memory.
Definition: Arduboy2.cpp:850
Arduboy2Base::nextFrame
static bool nextFrame()
Indicate that it's time to render the next frame.
Definition: Arduboy2.cpp:237
Arduboy2::getCharacterHeight
static constexpr uint8_t getCharacterHeight(uint8_t textSize=1)
Get the height, in pixels, of a character in the library's font.
Definition: Arduboy2.h:2129
Arduboy2Base::notPressed
static bool notPressed(uint8_t buttons)
Test if the specified buttons are not pressed.
Definition: Arduboy2.cpp:1022
Rect::width
uint8_t width
Definition: Arduboy2.h:112
WIDTH
#define WIDTH
Definition: Arduboy2Core.h:242
Arduboy2::getCharacterWidth
static constexpr uint8_t getCharacterWidth(uint8_t textSize=1)
Get the width, in pixels, of a character in the library's font.
Definition: Arduboy2.h:2086
Arduboy2Base::arduboy_logo_sprite
static const PROGMEM uint8_t arduboy_logo_sprite[]
The bitmap for the ARDUBOY logo in Sprites class drawSelfMasked() or drawOverwrite() format.
Definition: Arduboy2.h:1488
Arduboy2Base::drawBitmap
static void drawBitmap(int16_t x, int16_t y, const uint8_t *bitmap, uint8_t w, uint8_t h, uint8_t color=WHITE)
Draw a bitmap from an array in program memory.
Definition: Arduboy2.cpp:804
Arduboy2Base::bootLogoSpritesBOverwrite
static void bootLogoSpritesBOverwrite()
Display the boot logo sequence using SpritesB::drawOverwrite().
Definition: Arduboy2.cpp:159
Arduboy2Base::fillRoundRect
static void fillRoundRect(int16_t x, int16_t y, uint8_t w, uint8_t h, uint8_t r, uint8_t color=WHITE)
Draw a filled-in rectangle with rounded corners.
Definition: Arduboy2.cpp:682
Arduboy2::bootLogoSpritesOverwrite
void bootLogoSpritesOverwrite()
Display the boot logo sequence using Sprites::drawOverwrite().
Definition: Arduboy2.cpp:1211
Arduboy2Core.h
The Arduboy2Core class for Arduboy hardware initilization and control.
Arduboy2Base::getBuffer
static uint8_t * getBuffer()
Get a pointer to the display buffer in RAM.
Definition: Arduboy2.cpp:1007
Arduboy2::begin
void begin()
Initialize the hardware, display the boot logo, provide boot utilities, etc.
Definition: Arduboy2.cpp:1170
Arduboy2Base::frameCount
static uint16_t frameCount
A counter which is incremented once per frame.
Definition: Arduboy2.h:1381
Arduboy2Base::pressed
static bool pressed(uint8_t buttons)
Test if the all of the specified buttons are pressed.
Definition: Arduboy2.cpp:1012
Arduboy2Base::bootLogoSpritesBSelfMasked
static void bootLogoSpritesBSelfMasked()
Display the boot logo sequence using SpritesB::drawSelfMasked().
Definition: Arduboy2.cpp:149
Arduboy2Base::getPixel
static uint8_t getPixel(uint8_t x, uint8_t y)
Returns the state of the given pixel in the screen buffer.
Definition: Arduboy2.cpp:355
Arduboy2::bootLogo
void bootLogo()
Display the boot logo sequence using drawBitmap().
Definition: Arduboy2.cpp:1187
Point
An object to define a single point for collision functions.
Definition: Arduboy2.h:147
Rect::Rect
Rect()=default
The default constructor.
Arduboy2::clear
static void clear()
Clear the display buffer and set the text cursor to location 0, 0.
Definition: Arduboy2.cpp:1494
Arduboy2::getTextSize
static uint8_t getTextSize()
Get the currently set text size.
Definition: Arduboy2.cpp:1469
Arduboy2Base
The main functions provided for writing sketches for the Arduboy, minus text output.
Definition: Arduboy2.h:212
Arduboy2Audio
Provide speaker and sound control.
Definition: Arduboy2Audio.h:74
Arduboy2Base::begin
static void begin()
Initialize the hardware, display the boot logo, provide boot utilities, etc.
Definition: Arduboy2.cpp:31
Arduboy2::getCursorX
static int16_t getCursorX()
Get the X coordinate of the current text cursor position.
Definition: Arduboy2.cpp:1433
Arduboy2Base::setFrameDuration
static void setFrameDuration(uint8_t duration)
Set the frame rate, used by the frame control functions, by giving the duration of each frame.
Definition: Arduboy2.cpp:227
SpritesB.h
A class for drawing animated sprites from image and mask bitmaps. Optimized for small code size.
Arduboy2Base::bootLogoSpritesOverwrite
static void bootLogoSpritesOverwrite()
Display the boot logo sequence using Sprites::drawOverwrite().
Definition: Arduboy2.cpp:139
Arduboy2::getLineSpacing
static constexpr uint8_t getLineSpacing(uint8_t textSize=1)
Get the number of pixels added below each character to provide line spacing.
Definition: Arduboy2.h:2158
Arduboy2Base::arduboy_logo_compressed
static const PROGMEM uint8_t arduboy_logo_compressed[]
The bitmap for the ARDUBOY logo in drawCompressed() format.
Definition: Arduboy2.h:1479
Arduboy2Base::anyPressed
static bool anyPressed(uint8_t buttons)
Test if any of the specified buttons are pressed.
Definition: Arduboy2.cpp:1017
Arduboy2Base::bootLogo
static void bootLogo()
Display the boot logo sequence using drawBitmap().
Definition: Arduboy2.cpp:109
Arduboy2Base::readUnitName
static uint8_t readUnitName(char *name)
Read the unit name from system EEPROM.
Definition: Arduboy2.cpp:1069
Arduboy2::bootLogoText
void bootLogoText()
Display the boot logo sequence using printed text instead of a bitmap.
Definition: Arduboy2.cpp:1237
Arduboy2Base::flashlight
static void flashlight()
Turn the RGB LED and display fully on to act as a small flashlight/torch.
Definition: Arduboy2.cpp:62
Print
The Arduino Print class is available for writing text to the screen buffer.
Arduboy2Base::fillCircle
static void fillCircle(int16_t x0, int16_t y0, uint8_t r, uint8_t color=WHITE)
Draw a filled-in circle of a given radius.
Definition: Arduboy2.cpp:444
Arduboy2Base::readShowBootLogoFlag
static bool readShowBootLogoFlag()
Read the "Show Boot Logo" flag in system EEPROM.
Definition: Arduboy2.cpp:1105
Arduboy2::bootLogoCompressed
void bootLogoCompressed()
Display the boot logo sequence using drawCompressed().
Definition: Arduboy2.cpp:1195
Arduboy2::setTextSize
static void setTextSize(uint8_t s)
Set the text character size.
Definition: Arduboy2.cpp:1463
Arduboy2::setCursor
static void setCursor(int16_t x, int16_t y)
Set the location of the text cursor.
Definition: Arduboy2.cpp:1417
Arduboy2::setCursorY
static void setCursorY(int16_t y)
Set the Y coordinate of the text cursor location.
Definition: Arduboy2.cpp:1428
Arduboy2::getTextColor
static uint8_t getTextColor()
Get the currently set text foreground color.
Definition: Arduboy2.cpp:1448
Arduboy2::setCursorX
static void setCursorX(int16_t x)
Set the X coordinate of the text cursor location.
Definition: Arduboy2.cpp:1423
Arduboy2Beep.h
Classes to generate simple square wave tones on the Arduboy speaker pins.
Rect::x
int16_t x
Definition: Arduboy2.h:110
Arduboy2Base::waitNoButtons
static void waitNoButtons()
Wait until all buttons have been released.
Definition: Arduboy2.cpp:213
Arduboy2::getTextWrap
static bool getTextWrap()
Get the currently set text wrap mode.
Definition: Arduboy2.cpp:1479
Arduboy2Base::readUnitID
static uint16_t readUnitID()
Read the unit ID from system EEPROM.
Definition: Arduboy2.cpp:1057
Arduboy2Base::systemButtons
static void systemButtons()
Handle buttons held on startup for system control.
Definition: Arduboy2.cpp:83
Arduboy2::drawChar
static void drawChar(int16_t x, int16_t y, uint8_t c, uint8_t color, uint8_t bg, uint8_t size)
Draw a single character at the specified location in the screen buffer.
Definition: Arduboy2.cpp:1335
Arduboy2Base::readShowBootLogoLEDsFlag
static bool readShowBootLogoLEDsFlag()
Read the "Show LEDs with boot logo" flag in system EEPROM.
Definition: Arduboy2.cpp:1131
Arduboy2Base::readShowUnitNameFlag
static bool readShowUnitNameFlag()
Read the "Show Unit Name" flag in system EEPROM.
Definition: Arduboy2.cpp:1118
Rect::height
uint8_t height
Definition: Arduboy2.h:113
Arduboy2Base::setFrameRate
static void setFrameRate(uint8_t rate)
Set the frame rate used by the frame control functions.
Definition: Arduboy2.cpp:222
Arduboy2Base::drawFastHLine
static void drawFastHLine(int16_t x, int16_t y, uint8_t w, uint8_t color=WHITE)
Draw a horizontal line.
Definition: Arduboy2.cpp:558
Arduboy2Base::writeShowBootLogoLEDsFlag
static void writeShowBootLogoLEDsFlag(bool val)
Write the "Show LEDs with boot logo" flag in system EEPROM.
Definition: Arduboy2.cpp:1136
Rect
A rectangle object for collision functions.
Definition: Arduboy2.h:109
Arduboy2Base::writeUnitName
static void writeUnitName(const char *name)
Write a unit name to system EEPROM.
Definition: Arduboy2.cpp:1089
Arduboy2Base::fillScreen
static void fillScreen(uint8_t color=WHITE)
Fill the screen buffer with the specified color.
Definition: Arduboy2.cpp:618
Arduboy2Base::justReleased
static bool justReleased(uint8_t button)
Check if a button has just been released.
Definition: Arduboy2.cpp:1038
HEIGHT
#define HEIGHT
Definition: Arduboy2Core.h:243
Arduboy2Base::writeShowUnitNameFlag
static void writeShowUnitNameFlag(bool val)
Write the "Show Unit Name" flag in system EEPROM.
Definition: Arduboy2.cpp:1123
Arduboy2Base::arduboy_logo
static const PROGMEM uint8_t arduboy_logo[]
The bitmap for the ARDUBOY logo in drawBitmap() format.
Definition: Arduboy2.h:1472
Arduboy2::getCursorY
static int16_t getCursorY()
Get the Y coordinate of the current text cursor position.
Definition: Arduboy2.cpp:1438
Arduboy2Base::beginDoFirst
static void beginDoFirst()
Helper function that calls the inital functions used by begin()
Definition: Arduboy2.cpp:48
Arduboy2::getTextRawMode
static bool getTextRawMode()
Get the current state of text raw mode.
Definition: Arduboy2.cpp:1489
Arduboy2::bootLogoExtra
void bootLogoExtra()
Show the unit name at the bottom of the boot logo screen.
Definition: Arduboy2.cpp:1282
Arduboy2Base::bootLogoShell
static bool bootLogoShell(void(&drawLogo)(int16_t))
Display the boot logo sequence using the provided function.
Definition: Arduboy2.cpp:171