5 #include "Adafruit_Arcada_Def.h"     6 #include <Adafruit_GFX.h>     7 #include <Adafruit_ImageReader.h>      8 #include <Adafruit_NeoPixel.h>     9 #include <Adafruit_SPIFlash.h>    10 #include <Adafruit_WavePlayer.h>    11 #include <SdFat_Adafruit_Fork.h>    12 #include <TouchScreen.h>    14 #if defined(USE_TINYUSB)    15 #include "Adafruit_TinyUSB.h"    18 #if defined(ARCADA_USE_JSON)    19 #include <ArduinoJson.h>    22 #define SD_MAX_FILENAME_SIZE 80    23 #define ARCADA_DEFAULT_CONFIGURATION_FILENAME "/arcada_config.json"    25 typedef void (*arcada_callback_t)(void);
    28 typedef enum _FilesystemType {
    32   ARCADA_FILESYS_SD_AND_QSPI
    33 } Arcada_FilesystemType;
    80   void printf(
const char *format, ...);
    84       Arcada_FilesystemType desiredFilesys = ARCADA_FILESYS_SD_AND_QSPI);
    86                            const char *extensionFilter = NULL);
    87   bool chdir(
const char *path);
    88   File 
open(
const char *path = NULL, uint32_t flags = O_READ);
    90                        uint32_t flags = O_READ,
    91                        const char *extensionFilter = NULL);
    93   bool exists(
const char *path);
    94   bool mkdir(
const char *path);
    95   bool remove(
const char *path);
   100       Arcada_FilesystemType desiredFilesys = ARCADA_FILESYS_SD_AND_QSPI);
   102   bool chooseFile(
const char *path, 
char *filename, uint16_t filename_max,
   103                   const char *extensionFilter = NULL);
   141     return _canvas ? _canvas->getBuffer() : NULL;
   144                        bool bigEndian = 
false, Adafruit_SPITFT *display = NULL);
   145   uint16_t 
ColorHSV565(int16_t H, uint8_t S, uint8_t V);
   147   bool setBacklight(uint8_t brightness, 
bool saveToDisk = 
false);
   149   bool setVolume(uint8_t volume, 
bool saveToDisk = 
false);
   154   void alertBox(
const char *
string, uint16_t boxColor, uint16_t textColor,
   155                 uint32_t continueButtonMask);
   156   void infoBox(
const char *
string,
   157                uint32_t continueButtonMask = ARCADA_BUTTONMASK_A);
   158   void warnBox(
const char *
string,
   159                uint32_t continueButtonMask = ARCADA_BUTTONMASK_A);
   161                 uint32_t continueButtonMask = ARCADA_BUTTONMASK_A);
   162   void haltBox(
const char *
string);
   163   uint8_t 
menu(
const char **menu_strings, uint8_t menu_num, uint16_t boxColor,
   164                uint16_t textColor, 
bool cancellable = 
false);
   168       const char *filename = ARCADA_DEFAULT_CONFIGURATION_FILENAME);
   170       const char *filename = ARCADA_DEFAULT_CONFIGURATION_FILENAME);
   192 #ifdef ARCADA_USE_JSON   193   StaticJsonDocument<256>
   198   ImageReturnCode 
drawBMP(
char *filename, int16_t x, int16_t y,
   199                           Adafruit_SPITFT *tft = 0x0, 
boolean transact = 
true);
   202   wavStatus 
WavLoad(
char *filename, uint32_t *samplerate);
   203   wavStatus 
WavLoad(File f, uint32_t *samplerate);
   222   uint32_t last_buttons, 
   227       justreleased_buttons; 
   231   void _initAlertFonts(
void);
   233   int16_t _joyx_center = 512;
   234   int16_t _joyy_center = 512;
   236   Arcada_FilesystemType _filesys_type = ARCADA_FILESYS_NONE;
   239   GFXcanvas16 *_canvas = NULL;
   240   bool _first_frame = 
true;
   242   uint8_t _volume = 255, _brightness = 255;
   244   TouchScreen *_touchscreen;
   245   int16_t _ts_xmin = 0, _ts_xmax = 1023, _ts_ymin = 0, _ts_ymax = 1023;
   247   Adafruit_WavePlayer *player = NULL;
   249   volatile bool _wav_readflag = 
true;
   250   volatile bool _wav_playing = 
false;
   252   float _callback_freq = 0;
   253   arcada_callback_t _callback_func = NULL;
   256   int8_t _sd_cs, _speaker_en, _neopixel_pin, _backlight_pin, _touch_xp,
   257       _touch_yp, _touch_xm, _touch_ym,
   258       _start_button = -1, _select_button, _a_button, _b_button, _up_button,
   259       _down_button, _left_button, _right_button, _button_latch, _button_clock,
   260       _button_data, _battery_sensor, _light_sensor, _joystick_x, _joystick_y;
   261   uint8_t _neopixel_num = 0, _shift_up, _shift_down, _shift_left, _shift_right,
   262           _shift_a, _shift_b, _shift_select, _shift_start;
 bool _has_wifi
Internally tracked variable if wifi module was found. 
Definition: arcadatype.h:213
 
bool setBacklight(uint8_t brightness, bool saveToDisk=false)
Set the backlight brightness and save to the configuration. 
Definition: Adafruit_Arcada.cpp:182
 
void haltBox(const char *string)
Display an error box and halt operation. 
Definition: Adafruit_Arcada_Alerts.cpp:63
 
uint16_t * getFrameBuffer(void)
Return address of internal framebuffer (NULL if not allocated) 
Definition: arcadatype.h:140
 
wavStatus WavReadFile()
Reads another buffer's full of wave data into the internal buffer from the filesystem. 
Definition: Adafruit_Arcada_Wav.cpp:84
 
bool recentUSB(uint32_t timeout=100)
Hints whether we're doing a bunch of USB stuff recently. 
Definition: Adafruit_Arcada_USBMSD.cpp:128
 
bool loadConfigurationFile(const char *filename=ARCADA_DEFAULT_CONFIGURATION_FILENAME)
Loads the configuration JSON from the filesystem (which must be initialized before this function is c...
Definition: Adafruit_Arcada_Config.cpp:16
 
float getTimerCallbackFreq(void)
Get the final frequency created for the callback helper. 
Definition: Adafruit_Arcada.cpp:336
 
Arcada_FilesystemType filesysBegin(Arcada_FilesystemType desiredFilesys=ARCADA_FILESYS_SD_AND_QSPI)
Initialize the filesystem, either SD or QSPI. 
Definition: Adafruit_Arcada_Filesystem.cpp:44
 
bool _has_accel
Internally tracked variable if accelerometer was found. 
Definition: arcadatype.h:211
 
bool hasControlPad(void)
Does this board have a control pad - latch, buttons or analog joystick? 
Definition: Adafruit_Arcada.cpp:782
 
wavStatus WavLoad(char *filename, uint32_t *samplerate)
Load up a wave file from the filesystem, to prepare for playback. 
Definition: Adafruit_Arcada_Wav.cpp:29
 
bool hasAccel(void)
Getter for accelerometer existance. 
Definition: arcadatype.h:182
 
uint32_t readButtons(void)
Read all buttons/joystick and return a bitmask of which buttons are pressed, check ARCADA_BUTTONMASK_...
Definition: Adafruit_Arcada.cpp:437
 
virtual uint32_t variantReadButtons(void)=0
Perform any variant input reading (say if we use seesaw or whatnot) 
 
Adafruit_ImageReader * QSPI_imagereader
If initalized, the imagereader for the QSPI filesystem. 
Definition: arcadatype.h:216
 
int16_t readJoystickX(uint8_t oversampling=3)
Read X analog joystick. 
Definition: Adafruit_Arcada.cpp:392
 
bool saveConfigurationFile(const char *filename=ARCADA_DEFAULT_CONFIGURATION_FILENAME)
Saves the configuration JSON to the filesystem (which must be initialized before this function is cal...
Definition: Adafruit_Arcada_Config.cpp:53
 
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 t...
Definition: Adafruit_Arcada_InternalFlash.cpp:216
 
void infoBox(const char *string, uint32_t continueButtonMask=ARCADA_BUTTONMASK_A)
Display an info box with optional 'press to continue' button. 
Definition: Adafruit_Arcada_Alerts.cpp:26
 
bool chdir(const char *path)
Set working filesys directory to a given path (makes file naming easier) 
Definition: Adafruit_Arcada_Filesystem.cpp:102
 
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. 
Definition: Adafruit_Arcada_Filesystem.cpp:364
 
GFXcanvas16 * getCanvas(void)
Return pointer to GFX canvas (NULL if not allocated) 
Definition: arcadatype.h:133
 
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...
Definition: Adafruit_Arcada.cpp:802
 
uint16_t readLightSensor(void)
Read the light sensor onboard if there is one. 
Definition: Adafruit_Arcada.cpp:592
 
bool setVolume(uint8_t volume, bool saveToDisk=false)
Set the audio volume (not working at this time) 
Definition: Adafruit_Arcada.cpp:220
 
Adafruit_Arcada_SPITFT(void)
Instantiator for Arcada class, will allso inistantiate (but not init) the TFT. 
Definition: Adafruit_Arcada.cpp:27
 
uint32_t justReleasedButtons(void)
What buttons were just released as of the last readButtons() call. Use ARCADA_BUTTONMASK_* defines to...
Definition: Adafruit_Arcada.cpp:582
 
bool hasTouchscreen(void)
Does this board have a touchscreen. 
Definition: Adafruit_Arcada.cpp:692
 
bool hasWiFi(void)
Gets the status of the ESP32 module connected via SPI. 
Definition: arcadatype.h:190
 
bool filesysBeginMSD(Arcada_FilesystemType desiredFilesys=ARCADA_FILESYS_SD_AND_QSPI)
Make the raw filesystem of the Arcada board available over USB. 
Definition: Adafruit_Arcada_USBMSD.cpp:36
 
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) 
Definition: Adafruit_Arcada.cpp:662
 
uint8_t getVolume(void)
Get the audio volume (not working at this time) 
Definition: Adafruit_Arcada.cpp:237
 
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. 
Definition: Adafruit_Arcada_Alerts.cpp:200
 
uint8_t getBacklight(void)
Get the backlight brightness. 
Definition: Adafruit_Arcada.cpp:209
 
void alertBox(const char *string, uint16_t boxColor, uint16_t textColor, uint32_t continueButtonMask)
Display an alert box with optional 'press to continue' button. 
Definition: Adafruit_Arcada_Alerts.cpp:80
 
Adafruit_SPITFT * display
The Adafruit_GFX subclass display which the variant must create. 
Definition: arcadatype.h:45
 
Adafruit_NeoPixel pixels
The neopixel strip, of length ARCADA_NEOPIXEL_NUM. 
Definition: arcadatype.h:173
 
virtual void displayBegin(void)=0
Initialize TFT display, doesn't turn on the backlight. 
 
bool mkdir(const char *path)
Make a directory in the filesys. 
Definition: Adafruit_Arcada_Filesystem.cpp:215
 
Adafruit_ImageReader * SD_imagereader
If initalized, the imagereader for the SD card filesystem. 
Definition: arcadatype.h:218
 
void setTouchscreenCalibration(int16_t xmin, int16_t xmax, int16_t ymin, int16_t ymax)
Set the X/Y calibration values for the touchscreen. 
Definition: Adafruit_Arcada.cpp:703
 
uint32_t justPressedButtons(void)
What buttons were just pressed as of the last readButtons() call. Use ARCADA_BUTTONMASK_* defines to ...
Definition: Adafruit_Arcada.cpp:570
 
int16_t filesysListFiles(const char *path=NULL, const char *extensionFilter=NULL)
Debugging helper, prints to Serial a list of files in a path. 
Definition: Adafruit_Arcada_Filesystem.cpp:144
 
bool createFrameBuffer(uint16_t width, uint16_t height)
Create (allocate) an internal GFX canvas of given width and height. 
Definition: Adafruit_Arcada.cpp:622
 
virtual bool variantBegin(void)=0
Perform any specialized variant setup such as initializing accelerometers, seesaw, etc. 
 
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)...
Definition: Adafruit_Arcada_InternalFlash.cpp:81
 
void errorBox(const char *string, uint32_t continueButtonMask=ARCADA_BUTTONMASK_A)
Display an error box with optional 'press to continue' button. 
Definition: Adafruit_Arcada_Alerts.cpp:52
 
int16_t readJoystickY(uint8_t oversampling=3)
Read Y analog joystick. 
Definition: Adafruit_Arcada.cpp:414
 
uint32_t availableFlash(void)
Determine amount of unused flash memory remaining. 
Definition: Adafruit_Arcada_InternalFlash.cpp:29
 
bool timerCallback(float freq, arcada_callback_t callback)
Create a repetative callback to a function using a timer. 
Definition: Adafruit_Arcada.cpp:260
 
wavStatus WavPlayNextSample(void)
Output the next sample to the DAC(s) - should be called at 'samplerate'! 
Definition: Adafruit_Arcada_Wav.cpp:108
 
void printf(const char *format,...)
printf wrapper to serial debug, handy for logging config, C inclusion 
Definition: Adafruit_Arcada.cpp:376
 
void enableSpeaker(bool flag)
Turn on the speaker amplifier. 
Definition: Adafruit_Arcada.cpp:245
 
TSPoint getTouchscreenPoint(void)
Get a calibrated point that corresponds to the TFT. 
Definition: Adafruit_Arcada.cpp:720
 
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. 
Definition: Adafruit_Arcada_Filesystem.cpp:312
 
void timerStop(void)
Stop a previously-initiated timer. 
Definition: Adafruit_Arcada.cpp:364
 
wavStatus WavPlayComplete(char *filename)
Play a wave file completely thru by blocking until end of file. 
Definition: Adafruit_Arcada_Wav.cpp:155
 
bool arcadaBegin(void)
Initialize GPIO, NeoPixels, and speaker. 
Definition: Adafruit_Arcada.cpp:77
 
arcada_callback_t getTimerCallback(void)
Get the previous callback function we were using. 
Definition: Adafruit_Arcada.cpp:351
 
bool exists(const char *path)
Tests if a file exists on the filesys. 
Definition: Adafruit_Arcada_Filesystem.cpp:199
 
File open(const char *path=NULL, uint32_t flags=O_READ)
Opens a file and returns the object, a wrapper for our filesystem. 
Definition: Adafruit_Arcada_Filesystem.cpp:263
 
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. 
Definition: Adafruit_Arcada_ImageReader.cpp:23
 
Adafruit_ImageReader * getImageReader(void)
Reques the ImageReader object used, either for SD or QSPI. 
Definition: Adafruit_Arcada_ImageReader.cpp:43
 
void warnBox(const char *string, uint32_t continueButtonMask=ARCADA_BUTTONMASK_A)
Display an warning box with optional 'press to continue' button. 
Definition: Adafruit_Arcada_Alerts.cpp:39
 
float readBatterySensor(void)
Read the batterysensor onboard if there is one. 
Definition: Adafruit_Arcada.cpp:606
 
bool WavReadyForData()
Checks if we need to load the double buffer with WavReadFile() soon! 
Definition: Adafruit_Arcada_Wav.cpp:99
 
An abstraction class for something with a display, and possibly button controls or speaker...
Definition: arcadatype.h:42