Adafruit Arcada Library
Public Member Functions | Public Attributes | Protected Attributes | List of all members
Adafruit_Arcada_SPITFT Class Referenceabstract

An abstraction class for something with a display, and possibly button controls or speaker. Makes targing games and UI to multiple hardware designs easier. More...

#include <arcadatype.h>

Public Member Functions

 Adafruit_Arcada_SPITFT (void)
 Instantiator for Arcada class, will allso inistantiate (but not init) the TFT.
 
bool arcadaBegin (void)
 Initialize GPIO, NeoPixels, and speaker. More...
 
virtual bool variantBegin (void)=0
 Perform any specialized variant setup such as initializing accelerometers, seesaw, etc. More...
 
virtual uint32_t variantReadButtons (void)=0
 Perform any variant input reading (say if we use seesaw or whatnot) More...
 
bool timerCallback (float freq, arcada_callback_t callback)
 Create a repetative callback to a function using a timer. More...
 
float getTimerCallbackFreq (void)
 Get the final frequency created for the callback helper. More...
 
arcada_callback_t getTimerCallback (void)
 Get the previous callback function we were using. More...
 
void timerStop (void)
 Stop a previously-initiated timer.
 
void printf (const char *format,...)
 printf wrapper to serial debug, handy for logging config, C inclusion More...
 
Arcada_FilesystemType filesysBegin (Arcada_FilesystemType desiredFilesys=ARCADA_FILESYS_SD_AND_QSPI)
 Initialize the filesystem, either SD or QSPI. More...
 
int16_t filesysListFiles (const char *path=NULL, const char *extensionFilter=NULL)
 Debugging helper, prints to Serial a list of files in a path. More...
 
bool chdir (const char *path)
 Set working filesys directory to a given path (makes file naming easier) More...
 
File open (const char *path=NULL, uint32_t flags=O_READ)
 Opens a file and returns the object, a wrapper for our filesystem. More...
 
File openFileByIndex (const char *path, uint16_t index, uint32_t flags=O_READ, const char *extensionFilter=NULL)
 Opens a file as an indexed # in a directory (0 is first file), and returns the object. More...
 
bool exists (const char *path)
 Tests if a file exists on the filesys. More...
 
bool mkdir (const char *path)
 Make a directory in the filesys. More...
 
bool remove (const char *path)
 Remove a file from the filesys. More...
 
uint8_t * writeDataToFlash (uint8_t *data, uint32_t len)
 Write a block of data in RAM to the NEXT AVAILABLE position in flash memory (NOT a specific location). More...
 
uint8_t * writeFileToFlash (const char *filename)
 Opens a file and writes the data contents to the internal chip flash memory. NOT the QSPI flash but the actual chip memory! More...
 
uint32_t availableFlash (void)
 Determine amount of unused flash memory remaining. More...
 
bool filesysBeginMSD (Arcada_FilesystemType desiredFilesys=ARCADA_FILESYS_SD_AND_QSPI)
 Make the raw filesystem of the Arcada board available over USB. More...
 
bool recentUSB (uint32_t timeout=100)
 Hints whether we're doing a bunch of USB stuff recently. More...
 
bool chooseFile (const char *path, char *filename, uint16_t filename_max, const char *extensionFilter=NULL)
 Presents a navigation menu for choosing a file from the filesys. More...
 
bool hasControlPad (void)
 Does this board have a control pad - latch, buttons or analog joystick? More...
 
int16_t readJoystickX (uint8_t oversampling=3)
 Read X analog joystick. More...
 
int16_t readJoystickY (uint8_t oversampling=3)
 Read Y analog joystick. More...
 
uint32_t readButtons (void)
 Read all buttons/joystick and return a bitmask of which buttons are pressed, check ARCADA_BUTTONMASK_* for valid bitmasks to check again. If there's an analog joystick, it will 'simulate' the button presses. More...
 
uint32_t justPressedButtons (void)
 What buttons were just pressed as of the last readButtons() call. Use ARCADA_BUTTONMASK_* defines to extract which bits are true (just pressed) More...
 
uint32_t justReleasedButtons (void)
 What buttons were just released as of the last readButtons() call. Use ARCADA_BUTTONMASK_* defines to extract which bits are true (just releasd) More...
 
bool hasTouchscreen (void)
 Does this board have a touchscreen. More...
 
void setTouchscreenCalibration (int16_t xmin, int16_t xmax, int16_t ymin, int16_t ymax)
 Set the X/Y calibration values for the touchscreen. More...
 
TSPoint getTouchscreenPoint (void)
 Get a calibrated point that corresponds to the TFT. More...
 
uint16_t readLightSensor (void)
 Read the light sensor onboard if there is one. More...
 
float readBatterySensor (void)
 Read the batterysensor onboard if there is one. More...
 
virtual void displayBegin (void)=0
 Initialize TFT display, doesn't turn on the backlight.
 
bool createFrameBuffer (uint16_t width, uint16_t height)
 Create (allocate) an internal GFX canvas of given width and height. More...
 
GFXcanvas16 * getCanvas (void)
 Return pointer to GFX canvas (NULL if not allocated) More...
 
uint16_t * getFrameBuffer (void)
 Return address of internal framebuffer (NULL if not allocated) More...
 
bool blitFrameBuffer (uint16_t x, uint16_t y, bool blocking=false, bool bigEndian=false, Adafruit_SPITFT *display=NULL)
 Write the internal framebuffer to the display at coord (x, y) More...
 
uint16_t ColorHSV565 (int16_t H, uint8_t S, uint8_t V)
 Convert hue, saturation and value into a packed 16-bit RGB color that can be passed to TFT. More...
 
bool setBacklight (uint8_t brightness, bool saveToDisk=false)
 Set the backlight brightness and save to the configuration. More...
 
uint8_t getBacklight (void)
 Get the backlight brightness. More...
 
bool setVolume (uint8_t volume, bool saveToDisk=false)
 Set the audio volume (not working at this time) More...
 
uint8_t getVolume (void)
 Get the audio volume (not working at this time) More...
 
void enableSpeaker (bool flag)
 Turn on the speaker amplifier. More...
 
void alertBox (const char *string, uint16_t boxColor, uint16_t textColor, uint32_t continueButtonMask)
 Display an alert box with optional 'press to continue' button. More...
 
void infoBox (const char *string, uint32_t continueButtonMask=ARCADA_BUTTONMASK_A)
 Display an info box with optional 'press to continue' button. More...
 
void warnBox (const char *string, uint32_t continueButtonMask=ARCADA_BUTTONMASK_A)
 Display an warning box with optional 'press to continue' button. More...
 
void errorBox (const char *string, uint32_t continueButtonMask=ARCADA_BUTTONMASK_A)
 Display an error box with optional 'press to continue' button. More...
 
void haltBox (const char *string)
 Display an error box and halt operation. More...
 
uint8_t menu (const char **menu_strings, uint8_t menu_num, uint16_t boxColor, uint16_t textColor, bool cancellable=false)
 Draws a menu and lets a user select one of the menu items. More...
 
bool loadConfigurationFile (const char *filename=ARCADA_DEFAULT_CONFIGURATION_FILENAME)
 Loads the configuration JSON from the filesystem (which must be initialized before this function is called) and stores parsed JSON data internally. More...
 
bool saveConfigurationFile (const char *filename=ARCADA_DEFAULT_CONFIGURATION_FILENAME)
 Saves the configuration JSON to the filesystem (which must be initialized before this function is called) More...
 
bool hasAccel (void)
 Getter for accelerometer existance. More...
 
bool hasWiFi (void)
 Gets the status of the ESP32 module connected via SPI. More...
 
ImageReturnCode drawBMP (char *filename, int16_t x, int16_t y, Adafruit_SPITFT *tft=0x0, boolean transact=true)
 Loads BMP image file from QSPI or SD card directly to SPITFT screen. More...
 
Adafruit_ImageReader * getImageReader (void)
 Reques the ImageReader object used, either for SD or QSPI. More...
 
wavStatus WavLoad (char *filename, uint32_t *samplerate)
 Load up a wave file from the filesystem, to prepare for playback. More...
 
wavStatus WavLoad (File f, uint32_t *samplerate)
 Load up a wave file from the filesystem, to prepare for playback. More...
 
wavStatus WavReadFile ()
 Reads another buffer's full of wave data into the internal buffer from the filesystem. More...
 
wavStatus WavPlayNextSample (void)
 Output the next sample to the DAC(s) - should be called at 'samplerate'! More...
 
bool WavReadyForData ()
 Checks if we need to load the double buffer with WavReadFile() soon! More...
 
wavStatus WavPlayComplete (char *filename)
 Play a wave file completely thru by blocking until end of file. More...
 
wavStatus WavPlayComplete (File f)
 Play a wave file completely thru by blocking until end of file. More...
 

Public Attributes

Adafruit_SPITFT * display
 The Adafruit_GFX subclass display which the variant must create. More...
 
Adafruit_NeoPixel pixels
 The neopixel strip, of length ARCADA_NEOPIXEL_NUM.
 

Protected Attributes

bool _has_accel
 Internally tracked variable if accelerometer was found. More...
 
bool _has_wifi
 Internally tracked variable if wifi module was found. More...
 
Adafruit_ImageReader * QSPI_imagereader
 If initalized, the imagereader for the QSPI filesystem. More...
 
Adafruit_ImageReader * SD_imagereader
 If initalized, the imagereader for the SD card filesystem. More...
 

Detailed Description

An abstraction class for something with a display, and possibly button controls or speaker. Makes targing games and UI to multiple hardware designs easier.

Member Function Documentation

◆ arcadaBegin()

bool Adafruit_Arcada_SPITFT::arcadaBegin ( void  )

Initialize GPIO, NeoPixels, and speaker.

Returns
True on success, False if something failed!

◆ variantBegin()

virtual bool Adafruit_Arcada_SPITFT::variantBegin ( void  )
pure virtual

Perform any specialized variant setup such as initializing accelerometers, seesaw, etc.

Returns
True on variant setup success

◆ variantReadButtons()

virtual uint32_t Adafruit_Arcada_SPITFT::variantReadButtons ( void  )
pure virtual

Perform any variant input reading (say if we use seesaw or whatnot)

Returns
Bitmask of pressed buttons

◆ timerCallback()

bool Adafruit_Arcada_SPITFT::timerCallback ( float  freq,
arcada_callback_t  callback 
)

Create a repetative callback to a function using a timer.

Parameters
freqThe callback frequency, must be between 0.75 Hz and 24MHz (slower is better)
callbackA pointer to the function we'll call every time
Returns
True on success, False if something failed!

◆ getTimerCallbackFreq()

float Adafruit_Arcada_SPITFT::getTimerCallbackFreq ( void  )

Get the final frequency created for the callback helper.

Returns
The callback frequency

◆ getTimerCallback()

arcada_callback_t Adafruit_Arcada_SPITFT::getTimerCallback ( void  )

Get the previous callback function we were using.

Returns
A pointer to a function that takes no arguments, and returns nothing or NULL on no callback set

◆ printf()

void Adafruit_Arcada_SPITFT::printf ( const char *  format,
  ... 
)

printf wrapper to serial debug, handy for logging config, C inclusion

Parameters
formatThe printf-compatible format and extra args

◆ filesysBegin()

Arcada_FilesystemType Adafruit_Arcada_SPITFT::filesysBegin ( Arcada_FilesystemType  desiredFilesys = ARCADA_FILESYS_SD_AND_QSPI)

Initialize the filesystem, either SD or QSPI.

Parameters
desiredFilesysThe filesystem we'd prefer to use, can be ARCADA_FILESYS_SD, ARCADA_FILESYS_QSPI, or ARCADA_FILESYS_SD_AND_QSPI
Returns
Filesystem type found, can be ARCADA_FILESYS_NONE (none found), ARCADA_FILESYS_SD (found SD card), ARCADA_FILESYS_QSPI (QSPI flash memory), or ARCADA_FILESYS_SD_AND_QSPI (both found)

◆ filesysListFiles()

int16_t Adafruit_Arcada_SPITFT::filesysListFiles ( const char *  path = NULL,
const char *  extensionFilter = NULL 
)

Debugging helper, prints to Serial a list of files in a path.

Parameters
pathA string with the filename path, must start with / e.g. "/roms". If nothing is passed in, we use the CWD (default is "/")
extensionFilterThe 3 letters to check at the end of the filename to match
Returns
-1 if was not able to open, or the number of files

◆ chdir()

bool Adafruit_Arcada_SPITFT::chdir ( const char *  path)

Set working filesys directory to a given path (makes file naming easier)

Parameters
pathA string with the directory to change to
Returns
True if was able to find a directory at that path

◆ open()

File Adafruit_Arcada_SPITFT::open ( const char *  path = NULL,
uint32_t  flags = O_READ 
)

Opens a file and returns the object, a wrapper for our filesystem.

Parameters
pathA string with the filename path, must start with / e.g. "/roms"
flagsDefaults to O_READ but can use O_WRITE for writing (uses SDfat's flag system)
Returns
A File object, for whatever filesystem we're using

◆ openFileByIndex()

File Adafruit_Arcada_SPITFT::openFileByIndex ( const char *  path,
uint16_t  index,
uint32_t  flags = O_READ,
const char *  extensionFilter = NULL 
)

Opens a file as an indexed # in a directory (0 is first file), and returns the object.

Parameters
pathA string with the directory path, must start with / e.g. "/roms"
indexThe n'th file to open, 0 is first file
flagsDefaults to O_READ but can use O_WRITE for writing (uses SDfat's flag system)
extensionFilterA 3 (or more?) string to match against the final characters of each file for them to count. If they don't match, the index isn't incremented at all. We toupper() the extension and filename so don't worry about it.
Returns
A File object, for whatever filesystem we're using

◆ exists()

bool Adafruit_Arcada_SPITFT::exists ( const char *  path)

Tests if a file exists on the filesys.

Parameters
pathA string with the filename path
Returns
true or false if we can open the file

◆ mkdir()

bool Adafruit_Arcada_SPITFT::mkdir ( const char *  path)

Make a directory in the filesys.

Parameters
pathA string with the new directory path
Returns
true or false if we succeeded

◆ remove()

bool Adafruit_Arcada_SPITFT::remove ( const char *  path)

Remove a file from the filesys.

Parameters
pathA string with the file to be deleted
Returns
true or false if we succeeded

◆ writeDataToFlash()

uint8_t * Adafruit_Arcada_SPITFT::writeDataToFlash ( uint8_t *  ramAddress,
uint32_t  len 
)

Write a block of data in RAM to the NEXT AVAILABLE position in flash memory (NOT a specific location).

Parameters
ramAddressPointer to source RAM data
lenSize in bytes of RAM data to store
Returns
Pointer to stored data, NULL if insufficient space or an error.

◆ writeFileToFlash()

uint8_t * Adafruit_Arcada_SPITFT::writeFileToFlash ( const char *  filename)

Opens a file and writes the data contents to the internal chip flash memory. NOT the QSPI flash but the actual chip memory!

Parameters
filenameA string with the filename path, can be relative or absolute.
Returns
A pointer to the flash memory address, or NULL on failure.

◆ availableFlash()

uint32_t Adafruit_Arcada_SPITFT::availableFlash ( void  )

Determine amount of unused flash memory remaining.

Returns
Available flash space, in bytes.

◆ filesysBeginMSD()

bool Adafruit_Arcada_SPITFT::filesysBeginMSD ( Arcada_FilesystemType  desiredFilesys = ARCADA_FILESYS_SD_AND_QSPI)

Make the raw filesystem of the Arcada board available over USB.

Parameters
desiredFilesysThe filesystem we'd prefer to use, can be ARCADA_FILESYS_SD, ARCADA_FILESYS_QSPI, or ARCADA_FILESYS_SD_AND_QSPI
Returns
True on success, false on failure

◆ recentUSB()

bool Adafruit_Arcada_SPITFT::recentUSB ( uint32_t  timeout = 100)

Hints whether we're doing a bunch of USB stuff recently.

Parameters
timeoutThe timeperiod to look at, defaults to 100ms
Returns
True if some USB stuff happened in last timeout # millis

◆ chooseFile()

bool Adafruit_Arcada_SPITFT::chooseFile ( const char *  path,
char *  selected_filename,
uint16_t  selected_filename_maxlen,
const char *  extensionFilter = NULL 
)

Presents a navigation menu for choosing a file from the filesys.

Parameters
pathA string with the starting directory path, must start with / e.g. "/roms"
selected_filenameA buffer to put the final selection in. Given long filename support, make this big!
selected_filename_maxlenMaximum buffer available in 'selected_filename'
extensionFilterA 3 (or more?) string to match against the final characters of each file for them to count. If they don't match, the index isn't incremented at all. We toupper() the extension and filename so don't worry about it.
Returns
true on success, false on some sort of failure

◆ hasControlPad()

bool Adafruit_Arcada_SPITFT::hasControlPad ( void  )

Does this board have a control pad - latch, buttons or analog joystick?

Returns
True if it does

◆ readJoystickX()

int16_t Adafruit_Arcada_SPITFT::readJoystickX ( uint8_t  sampling = 3)

Read X analog joystick.

Parameters
samplingHow many samples to read and average, default is 3
Returns
Signed 16 bits, from -512 to 511, 0 being 'center'

◆ readJoystickY()

int16_t Adafruit_Arcada_SPITFT::readJoystickY ( uint8_t  sampling = 3)

Read Y analog joystick.

Parameters
samplingHow many samples to read and average, default is 3
Returns
Signed 16 bits, from -512 to 511, 0 being 'center'

◆ readButtons()

uint32_t Adafruit_Arcada_SPITFT::readButtons ( void  )

Read all buttons/joystick and return a bitmask of which buttons are pressed, check ARCADA_BUTTONMASK_* for valid bitmasks to check again. If there's an analog joystick, it will 'simulate' the button presses.

Returns
Bit array with up to 32 buttons, 1 for pressed, 0 for not.

◆ justPressedButtons()

uint32_t Adafruit_Arcada_SPITFT::justPressedButtons ( void  )

What buttons were just pressed as of the last readButtons() call. Use ARCADA_BUTTONMASK_* defines to extract which bits are true (just pressed)

Returns
Bitmask of all buttons that were just pressed

◆ justReleasedButtons()

uint32_t Adafruit_Arcada_SPITFT::justReleasedButtons ( void  )

What buttons were just released as of the last readButtons() call. Use ARCADA_BUTTONMASK_* defines to extract which bits are true (just releasd)

Returns
Bitmask of all buttons that were just released

◆ hasTouchscreen()

bool Adafruit_Arcada_SPITFT::hasTouchscreen ( void  )

Does this board have a touchscreen.

Returns
True if it does

◆ setTouchscreenCalibration()

void Adafruit_Arcada_SPITFT::setTouchscreenCalibration ( int16_t  xmin,
int16_t  xmax,
int16_t  ymin,
int16_t  ymax 
)

Set the X/Y calibration values for the touchscreen.

Parameters
xminThe value of X which corresponds to 0 on that axis
yminThe value of Y which corresponds to 0 on that axis
xmaxThe value of X which corresponds to the TFT width on that axis
ymaxThe value of Y which corresponds to the TFT height on that axis

◆ getTouchscreenPoint()

TSPoint Adafruit_Arcada_SPITFT::getTouchscreenPoint ( void  )

Get a calibrated point that corresponds to the TFT.

Returns
A TSPoint with x, y and z pressure readings. If z is 0 no touch was detected.

◆ readLightSensor()

uint16_t Adafruit_Arcada_SPITFT::readLightSensor ( void  )

Read the light sensor onboard if there is one.

Returns
0 (darkest) to 1023 (brightest) or 0 if there is no sensor

◆ readBatterySensor()

float Adafruit_Arcada_SPITFT::readBatterySensor ( void  )

Read the batterysensor onboard if there is one.

Returns
Voltage as floating point or NAN if there is no sensor

◆ createFrameBuffer()

bool Adafruit_Arcada_SPITFT::createFrameBuffer ( uint16_t  width,
uint16_t  height 
)

Create (allocate) an internal GFX canvas of given width and height.

Parameters
widthNumber of pixels wide
heightNumber of pixels tall
Returns
True on success (could allocate) or false on failure

◆ getCanvas()

GFXcanvas16* Adafruit_Arcada_SPITFT::getCanvas ( void  )
inline

Return pointer to GFX canvas (NULL if not allocated)

Returns
The pointer to a width*height*16-bit GFXcanvas16 canvas.

◆ getFrameBuffer()

uint16_t* Adafruit_Arcada_SPITFT::getFrameBuffer ( void  )
inline

Return address of internal framebuffer (NULL if not allocated)

Returns
The pointer to a width*height*16-bit framebuf

◆ blitFrameBuffer()

bool Adafruit_Arcada_SPITFT::blitFrameBuffer ( uint16_t  x,
uint16_t  y,
bool  blocking = false,
bool  bigEndian = false,
Adafruit_SPITFT *  blitdisplay = NULL 
)

Write the internal framebuffer to the display at coord (x, y)

Parameters
xX coordinate in the TFT screen to write it to
yY coordinate in the TFT screen to write it to
blockingIf true, function waits until blit is done. Otherwise we let DMA do the blitting and return immediately (THIS ISN'T NECESSARILY TRUE, SEE NOTE BELOW)
bigEndianIf true, frame buffer data is already in big-endian order (which is NOT SAMD-native order) and an actual background DMA blit can take place (SEE NOTE BELOW)
blitdisplayThe pointer to display we'll blit to. If not passed in, we'll use the 'internal' default of 'display' that the variant creates
Returns
True on success, failure if no canvas exists yet
Note
Even if blocking is 'false,' this function may still block. For starters, DMA must be enabled in Adafruit_SPITFT.h. If bigEndian is NOT true (and this is the normal case on SAMD, being little-endian, and with GFX pixels in RAM being in MCU-native order), then every pixel needs to be byte-swapped before issuing to the display (which tend to be big-endian). If blocking is false, DMA transfers are used on a per- scanline basis and we at least get the cycles to perform this byte- swapping "free," but really it's no faster than a blocking write without byte swaps (except for the last scanline, which we allow the transfer to complete in the background). To really truly get a non-blocking full DMA transfer, blocking must be false AND bigEndian must be true...and graphics must be drawn to the canvas using byte-swapped colors, which is not normal (GFX uses device-native 16-bit type for pixels, i.e. little- endian). ONLY THEN will the entire transfer take place in the background (and the application should wait before further drawing in the framebuffer until the transfer completes).

◆ ColorHSV565()

uint16_t Adafruit_Arcada_SPITFT::ColorHSV565 ( int16_t  H,
uint8_t  S,
uint8_t  V 
)

Convert hue, saturation and value into a packed 16-bit RGB color that can be passed to TFT.

Parameters
HThe Hue ranging from 0 to 359
SSaturation, 8-bit value, 0 (min or pure grayscale) to 100 (max or pure hue)
VValue (brightness), 8-bit value, 0 (min / black / off) to 100 (max or full brightness)
Returns
Packed 16-bit 5-6-5 RGB. Result is linearly but not perceptually correct for LEDs. Intended for TFT use only.

◆ setBacklight()

bool Adafruit_Arcada_SPITFT::setBacklight ( uint8_t  brightness,
bool  saveToDisk = false 
)

Set the backlight brightness and save to the configuration.

Parameters
brightnessFrom 0 (off) to 255 (full on)
saveToDiskWhether we save this permanently to disk, default is false
Returns
Whether saving to disk succeeded, or true if we don't save

◆ getBacklight()

uint8_t Adafruit_Arcada_SPITFT::getBacklight ( void  )

Get the backlight brightness.

Returns
brightness From 0 (off) to 255 (full on)

◆ setVolume()

bool Adafruit_Arcada_SPITFT::setVolume ( uint8_t  volume,
bool  saveToDisk = false 
)

Set the audio volume (not working at this time)

Parameters
volumeFrom 0 (off) to 255 (full on)
saveToDiskWhether we save this permanently to disk, default is false
Returns
Whether saving to disk succeeded, or true if we don't save

◆ getVolume()

uint8_t Adafruit_Arcada_SPITFT::getVolume ( void  )

Get the audio volume (not working at this time)

Returns
Volume From 0 (off) to 255 (full on)

◆ enableSpeaker()

void Adafruit_Arcada_SPITFT::enableSpeaker ( bool  on)

Turn on the speaker amplifier.

Parameters
onTrue to enable, False to disable

◆ alertBox()

void Adafruit_Arcada_SPITFT::alertBox ( const char *  string,
uint16_t  boxColor,
uint16_t  textColor,
uint32_t  continueButtonMask 
)

Display an alert box with optional 'press to continue' button.

Parameters
stringThe message to display
boxColor16-bit color to use as background
textColor16-bit color to use as outline and text
continueButtonMaskARCADA_BUTTONMASK_ value to wait for, or 0 for immediate return.

◆ infoBox()

void Adafruit_Arcada_SPITFT::infoBox ( const char *  string,
uint32_t  continueButtonMask = ARCADA_BUTTONMASK_A 
)

Display an info box with optional 'press to continue' button.

Parameters
stringThe message to display
continueButtonMaskARCADA_BUTTONMASK_ value to wait for, or 0 for immediate return. Default is ARCADA_BUTTONMASK_A

◆ warnBox()

void Adafruit_Arcada_SPITFT::warnBox ( const char *  string,
uint32_t  continueButtonMask = ARCADA_BUTTONMASK_A 
)

Display an warning box with optional 'press to continue' button.

Parameters
stringThe message to display
continueButtonMaskARCADA_BUTTONMASK_ value to wait for, or 0 for immediate return. Default is ARCADA_BUTTONMASK_A

◆ errorBox()

void Adafruit_Arcada_SPITFT::errorBox ( const char *  string,
uint32_t  continueButtonMask = ARCADA_BUTTONMASK_A 
)

Display an error box with optional 'press to continue' button.

Parameters
stringThe message to display
continueButtonMaskARCADA_BUTTONMASK_ value to wait for, or 0 for immediate return. Default is ARCADA_BUTTONMASK_A

◆ haltBox()

void Adafruit_Arcada_SPITFT::haltBox ( const char *  string)

Display an error box and halt operation.

Parameters
stringThe message to display

◆ menu()

uint8_t Adafruit_Arcada_SPITFT::menu ( const char **  menu_strings,
uint8_t  menu_num,
uint16_t  boxColor,
uint16_t  textColor,
bool  cancellable = false 
)

Draws a menu and lets a user select one of the menu items.

Parameters
menu_stringsList of menu-item strings
menu_numNumber of menu items
boxColor16-bit color to use as menu-background
textColor16-bit color to use as outline and text
cancellablesetting this to true will enable the user to exit the menu by pressing "B"
Returns
uint8_t, The selected menu item, returns 255 if the menu is canceled

◆ loadConfigurationFile()

bool Adafruit_Arcada_SPITFT::loadConfigurationFile ( const char *  filename = ARCADA_DEFAULT_CONFIGURATION_FILENAME)

Loads the configuration JSON from the filesystem (which must be initialized before this function is called) and stores parsed JSON data internally.

Parameters
filenameThe path to the JSON file
Returns
True if a the file was found and was parsable

◆ saveConfigurationFile()

bool Adafruit_Arcada_SPITFT::saveConfigurationFile ( const char *  filename = ARCADA_DEFAULT_CONFIGURATION_FILENAME)

Saves the configuration JSON to the filesystem (which must be initialized before this function is called)

Parameters
filenameThe path to the JSON file
Returns
True if a the file was writable and saved

◆ hasAccel()

bool Adafruit_Arcada_SPITFT::hasAccel ( void  )
inline

Getter for accelerometer existance.

Returns
True if an accelerometer exists

◆ hasWiFi()

bool Adafruit_Arcada_SPITFT::hasWiFi ( void  )
inline

Gets the status of the ESP32 module connected via SPI.

Returns
True if the ESP32 module was detected, false otherwise.

◆ drawBMP()

ImageReturnCode Adafruit_Arcada_SPITFT::drawBMP ( char *  filename,
int16_t  x,
int16_t  y,
Adafruit_SPITFT *  tft = 0x0,
boolean  transact = true 
)

Loads BMP image file from QSPI or SD card directly to SPITFT screen.

Parameters
filenameName of BMP image file to load.
xHorizontal offset in pixels; left edge = 0, positive = right. Value is signed, image will be clipped if all or part is off the screen edges. Screen rotation setting is observed.
yVertical offset in pixels; top edge = 0, positive = down.
tftThe display we'll be drawing to
transactPass 'true' if TFT and SD are on the same SPI bus, in which case SPI transactions are necessary. If separate peripherals, can pass 'false'.
Returns
One of the ImageReturnCode values (IMAGE_SUCCESS on successful completion, other values on failure).

◆ getImageReader()

Adafruit_ImageReader * Adafruit_Arcada_SPITFT::getImageReader ( void  )

Reques the ImageReader object used, either for SD or QSPI.

Returns
The activated ImageReader, or NULL if neither SD or QSPI are available

◆ WavLoad() [1/2]

wavStatus Adafruit_Arcada_SPITFT::WavLoad ( char *  filename,
uint32_t *  samplerate 
)

Load up a wave file from the filesystem, to prepare for playback.

Parameters
filenameName of file to open, either relative or abs path
samplerateThe uint32_t where the loaded wav files' sample rate will be stored for the caller to use.
Returns
Status enum from Adafruit WavePlayer library, on success, places the wave file samplerate into samplerate pointer

◆ WavLoad() [2/2]

wavStatus Adafruit_Arcada_SPITFT::WavLoad ( File  f,
uint32_t *  samplerate 
)

Load up a wave file from the filesystem, to prepare for playback.

Parameters
fThe already-opened file that we'll play
samplerateThe uint32_t where the loaded wav files' sample rate will be stored for the caller to use.
Returns
Status enum from Adafruit WavePlayer library, on success, places the wave file samplerate into samplerate pointer

◆ WavReadFile()

wavStatus Adafruit_Arcada_SPITFT::WavReadFile ( )

Reads another buffer's full of wave data into the internal buffer from the filesystem.

Returns
Status enum from Adafruit WavePlayer library

◆ WavPlayNextSample()

wavStatus Adafruit_Arcada_SPITFT::WavPlayNextSample ( void  )

Output the next sample to the DAC(s) - should be called at 'samplerate'!

Returns
Status enum from Adafruit WavePlayer library

◆ WavReadyForData()

bool Adafruit_Arcada_SPITFT::WavReadyForData ( )

Checks if we need to load the double buffer with WavReadFile() soon!

Returns
True if there's free buffer space

◆ WavPlayComplete() [1/2]

wavStatus Adafruit_Arcada_SPITFT::WavPlayComplete ( char *  filename)

Play a wave file completely thru by blocking until end of file.

Parameters
filenameName of file to open, either relative or abs path
Returns
Status enum from Adafruit WavePlayer library, WAV_OK on success

◆ WavPlayComplete() [2/2]

wavStatus Adafruit_Arcada_SPITFT::WavPlayComplete ( File  f)

Play a wave file completely thru by blocking until end of file.

Parameters
fThe already-opened file that we'll play
Returns
Status enum from Adafruit WavePlayer library, WAV_OK on success

Member Data Documentation

◆ display

Adafruit_SPITFT* Adafruit_Arcada_SPITFT::display
Initial value:
=
0

The Adafruit_GFX subclass display which the variant must create.

◆ _has_accel

bool Adafruit_Arcada_SPITFT::_has_accel
protected
Initial value:
=
false

Internally tracked variable if accelerometer was found.

◆ _has_wifi

bool Adafruit_Arcada_SPITFT::_has_wifi
protected
Initial value:
=
false

Internally tracked variable if wifi module was found.

◆ QSPI_imagereader

Adafruit_ImageReader* Adafruit_Arcada_SPITFT::QSPI_imagereader
protected
Initial value:
=
0

If initalized, the imagereader for the QSPI filesystem.

◆ SD_imagereader

Adafruit_ImageReader * Adafruit_Arcada_SPITFT::SD_imagereader
protected
Initial value:
=
0

If initalized, the imagereader for the SD card filesystem.


The documentation for this class was generated from the following files: