Compare commits

...

No commits in common. "master" and "gh-pages" have entirely different histories.

253 changed files with 7606 additions and 5062 deletions

View file

@ -1,22 +0,0 @@
Language: Cpp
BasedOnStyle: Google
IndentWidth: 2
ColumnLimit: 80
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
BinPackArguments: true
BinPackParameters: true
BreakBeforeBraces: Attach
DerivePointerAlignment: false
PointerAlignment: Right
SpacesBeforeTrailingComments: 1
IndentCaseLabels: true
SortIncludes: false
AlignTrailingComments: true
MaxEmptyLinesToKeep: 2
SpaceAfterCStyleCast: false
AllowShortBlocksOnASingleLine: false
KeepEmptyLinesAtTheStartOfBlocks: true
AccessModifierOffset: -2
IndentAccessModifiers: false

View file

@ -1,46 +0,0 @@
Thank you for opening an issue on an Adafruit Arduino library repository. To
improve the speed of resolution please review the following guidelines and
common troubleshooting steps below before creating the issue:
- **Do not use GitHub issues for troubleshooting projects and issues.** Instead use
the forums at http://forums.adafruit.com to ask questions and troubleshoot why
something isn't working as expected. In many cases the problem is a common issue
that you will more quickly receive help from the forum community. GitHub issues
are meant for known defects in the code. If you don't know if there is a defect
in the code then start with troubleshooting on the forum first.
- **If following a tutorial or guide be sure you didn't miss a step.** Carefully
check all of the steps and commands to run have been followed. Consult the
forum if you're unsure or have questions about steps in a guide/tutorial.
- **For Arduino projects check these very common issues to ensure they don't apply**:
- For uploading sketches or communicating with the board make sure you're using
a **USB data cable** and **not** a **USB charge-only cable**. It is sometimes
very hard to tell the difference between a data and charge cable! Try using the
cable with other devices or swapping to another cable to confirm it is not
the problem.
- **Be sure you are supplying adequate power to the board.** Check the specs of
your board and plug in an external power supply. In many cases just
plugging a board into your computer is not enough to power it and other
peripherals.
- **Double check all soldering joints and connections.** Flakey connections
cause many mysterious problems. See the [guide to excellent soldering](https://learn.adafruit.com/adafruit-guide-excellent-soldering/tools) for examples of good solder joints.
- **Ensure you are using an official Arduino or Adafruit board.** We can't
guarantee a clone board will have the same functionality and work as expected
with this code and don't support them.
If you're sure this issue is a defect in the code and checked the steps above
please fill in the following fields to provide enough troubleshooting information.
You may delete the guideline and text above to just leave the following details:
- Arduino board: **INSERT ARDUINO BOARD NAME/TYPE HERE**
- Arduino IDE version (found in Arduino -> About Arduino menu): **INSERT ARDUINO
VERSION HERE**
- List the steps to reproduce the problem below (if possible attach a sketch or
copy the sketch code in too): **LIST REPRO STEPS BELOW**

View file

@ -1,26 +0,0 @@
Thank you for creating a pull request to contribute to Adafruit's GitHub code!
Before you open the request please review the following guidelines and tips to
help it be more easily integrated:
- **Describe the scope of your change--i.e. what the change does and what parts
of the code were modified.** This will help us understand any risks of integrating
the code.
- **Describe any known limitations with your change.** For example if the change
doesn't apply to a supported platform of the library please mention it.
- **Please run any tests or examples that can exercise your modified code.** We
strive to not break users of the code and running tests/examples helps with this
process.
Thank you again for contributing! We will try to test and integrate the change
as soon as we can, but be aware we have many GitHub repositories to manage and
can't immediately respond to every request. There is no need to bump or check in
on a pull request (it will clutter the discussion of the request).
Also don't be worried if the request is closed or not integrated--sometimes the
priorities of Adafruit's GitHub code (education, ease of use) might not match the
priorities of the pull request. Don't fret, the open source community thrives on
forks and GitHub makes it easy to keep your changes in a forked repo.
After reviewing the guidelines above you can delete this text from the pull request.

View file

@ -1,57 +0,0 @@
name: Arduino Library CI
on: [pull_request, push, repository_dispatch]
jobs:
build:
strategy:
fail-fast: false
matrix:
arduino-platform: ["uno", "leonardo", "mega2560", "esp8266", "esp32",
"zero", "metro_m4", "nrf52840", "pybadge",
"hallowing_m4", "cpb", "cpx_ada", "pyportal",
"feather_rp2040"]
runs-on: ubuntu-latest
steps:
- uses: actions/setup-python@v4
with:
python-version: '3.8'
- uses: actions/checkout@v3
- uses: actions/checkout@v3
with:
repository: adafruit/ci-arduino
path: ci
- name: pre-install
run: bash ci/actions_install.sh
- name: test platforms
run: python3 ci/build_platform.py ${{ matrix.arduino-platform }}
clang_and_doxy:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/setup-python@v4
with:
python-version: '3.x'
- uses: actions/checkout@v3
- uses: actions/checkout@v3
with:
repository: adafruit/ci-arduino
path: ci
- name: pre-install
run: bash ci/actions_install.sh
- name: clang
run: python3 ci/run-clang-format.py -e "ci/*" -e "bin/*" -r .
- name: doxygen
env:
GH_REPO_TOKEN: ${{ secrets.GH_REPO_TOKEN }}
PRETTYNAME : "Adafruit ImageReader Library"
run: bash ci/doxy_gen_and_deploy.sh

5
.gitignore vendored
View file

@ -1,5 +0,0 @@
# Our handy .gitignore for automation ease
Doxyfile*
doxygen_sqlite3.db
html
*.DS_Store

1
.nojekyll Normal file
View file

@ -0,0 +1 @@

View file

@ -1,696 +0,0 @@
/*!
* @file Adafruit_ImageReader.cpp
*
* @mainpage Companion library for Adafruit_GFX to load images from SD card.
* Load-to-display and load-to-RAM are supported.
*
* @section intro_sec Introduction
*
* This is the documentation for Adafruit's ImageReader library for the
* Arduino platform. It is designed to work in conjunction with Adafruit_GFX
* and a display-specific library (e.g. Adafruit_ILI9341).
*
* Adafruit invests time and resources providing this open source code,
* please support Adafruit and open-source hardware by purchasing
* products from Adafruit!
*
* @section dependencies Dependencies
*
* This library depends on
* <a href="https://github.com/adafruit/Adafruit_GFX">Adafruit_GFX</a>
* plus a display device-specific library such as
* <a href="https://github.com/adafruit/Adafruit_ILI9341">Adafruit_ILI9341</a>
* or other subclasses of SPITFT. Filesystem reading is handled through the
* <a href="https://github.com/adafruit/Adafruit_SPIFlash">Adafruit_SPIFlash</a>
* library, which in turn relies on
* <a href="https://github.com/adafruit/SdFat">SdFat</a>.
* Please make sure you have installed the latest versions before
* using this library.
*
* @section author Author
*
* Written by Phil "PaintYourDragon" Burgess for Adafruit Industries.
*
* @section license License
*
* BSD license, all text here must be included in any redistribution.
*/
#include "Adafruit_ImageReader.h"
// Buffers in BMP draw function (to screen) require 5 bytes/pixel: 3 bytes
// for each BMP pixel (R+G+B), 2 bytes for each TFT pixel (565 color).
// Buffers in BMP load (to canvas) require 3 bytes/pixel (R+G+B from BMP),
// no interim 16-bit buffer as data goes straight to the canvas buffer.
// Because buffers are flushed at the end of each scanline (to allow for
// cropping, vertical flip, scanline padding, etc.), no point in any of
// these pixel counts being more than the screen width.
// (Maybe to do: make non-AVR loader dynamically allocate buffer based
// on screen or image size.)
#ifdef __AVR__
#define BUFPIXELS 24 ///< 24 * 5 = 120 bytes
#else
#define BUFPIXELS 200 ///< 200 * 5 = 1000 bytes
#endif
// ADAFRUIT_IMAGE CLASS ****************************************************
// This has been created as a class here rather than in Adafruit_GFX because
// it's a new type returned specifically by the Adafruit_ImageReader class
// and needs certain flexibility not present in the latter's GFXcanvas*
// classes (having been designed for flash-resident bitmaps).
/*!
@brief Constructor.
@return 'Empty' Adafruit_Image object.
*/
Adafruit_Image::Adafruit_Image(void)
: mask(NULL), palette(NULL), format(IMAGE_NONE) {
canvas.canvas1 = NULL;
}
/*!
@brief Destructor.
@return None (void).
*/
Adafruit_Image::~Adafruit_Image(void) { dealloc(); }
/*!
@brief Deallocates memory associated with Adafruit_Image object
and resets member variables to 'empty' state.
@return None (void).
*/
void Adafruit_Image::dealloc(void) {
if (format == IMAGE_1) {
if (canvas.canvas1) {
delete canvas.canvas1;
canvas.canvas1 = NULL;
}
} else if (format == IMAGE_8) {
if (canvas.canvas8) {
delete canvas.canvas8;
canvas.canvas8 = NULL;
}
} else if (format == IMAGE_16) {
if (canvas.canvas16) {
delete canvas.canvas16;
canvas.canvas16 = NULL;
}
}
if (mask) {
delete mask;
mask = NULL;
}
if (palette) {
delete[] palette;
palette = NULL;
}
format = IMAGE_NONE;
}
/*!
@brief Get width of Adafruit_Image object.
@return Width in pixels, or 0 if no image loaded.
*/
int16_t Adafruit_Image::width(void) const {
if (format != IMAGE_NONE) { // Image allocated?
if (format == IMAGE_1)
return canvas.canvas1->width();
else if (format == IMAGE_8)
return canvas.canvas8->width();
else if (format == IMAGE_16)
return canvas.canvas16->width();
}
return 0;
}
/*!
@brief Get height of Adafruit_Image object.
@return Height in pixels, or 0 if no image loaded.
*/
int16_t Adafruit_Image::height(void) const {
if (format != IMAGE_NONE) { // Image allocated?
if (format == IMAGE_1)
return canvas.canvas1->height();
else if (format == IMAGE_8)
return canvas.canvas8->height();
else if (format == IMAGE_16)
return canvas.canvas16->height();
}
return 0;
}
/*!
@brief Return pointer to image's GFX canvas object.
@return void* pointer, must be type-converted to a GFX canvas type
consistent with the image's format (e.g. GFXcanvas16* if
image format is IMAGE_16 -- use image.format() to determine
the image format). Returns NULL if no canvas allocated.
@note Calling function must type-convert the result to one of the
supported canvas object types, and must act accordingly with
regard to calling functions on this object (e.g. doing the
right thing with an 8- or 16-bit canvas, each has distinct
drawing functions, things like that). This is here mostly to
allow more advanced applications to get directly into an
image's canvas object (and, in turn, its raw graphics buffer
via canvas->getBuffer()) to move data in or out. Potential
for a lot of mayhem here if used wrong.
*/
void *Adafruit_Image::getCanvas(void) const {
if (format != IMAGE_NONE) { // Image allocated?
if (format == IMAGE_1)
return (void *)canvas.canvas1;
else if (format == IMAGE_8)
return (void *)canvas.canvas8;
else if (format == IMAGE_16)
return (void *)canvas.canvas16;
}
return NULL;
}
/*!
@brief Draw image to an Adafruit_SPITFT-type display.
@param tft
Screen to draw to (any Adafruit_SPITFT-derived class).
@param x
Horizontal 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.
@param y
Vertical offset in pixels; top edge = 0, positive = down.
@return None (void).
*/
void Adafruit_Image::draw(Adafruit_SPITFT &tft, int16_t x, int16_t y) {
if (format == IMAGE_1) {
uint16_t foreground, background;
if (palette) {
foreground = palette[1];
background = palette[0];
} else {
foreground = 0xFFFF;
background = 0x0000;
}
tft.drawBitmap(x, y, canvas.canvas1->getBuffer(), canvas.canvas1->width(),
canvas.canvas1->height(), foreground, background);
} else if (format == IMAGE_8) {
} else if (format == IMAGE_16) {
tft.drawRGBBitmap(x, y, canvas.canvas16->getBuffer(),
canvas.canvas16->width(), canvas.canvas16->height());
}
}
// ADAFRUIT_IMAGEREADER CLASS **********************************************
// Loads images from SD card to screen or RAM.
/*!
@brief Constructor.
@return Adafruit_ImageReader object.
@param fs
FAT filesystem associated with this Adafruit_ImageReader
instance. Any images to load will come from this filesystem;
if multiple filesystems are required, each will require its
own Adafruit_ImageReader object. The filesystem does NOT need
to be initialized yet when passed in here (since this will
often be in pre-setup() declaration, but DOES need initializing
before any of the image loading or size functions are called!
*/
Adafruit_ImageReader::Adafruit_ImageReader(FatVolume &fs) { filesys = &fs; }
/*!
@brief Destructor.
@return None (void).
*/
Adafruit_ImageReader::~Adafruit_ImageReader(void) {
if (file)
file.close();
// filesystem is left as-is
}
/*!
@brief Loads BMP image file from SD card directly to SPITFT screen.
@param filename
Name of BMP image file to load.
@param tft
Adafruit_SPITFT object (e.g. one of the Adafruit TFT or OLED
displays that subclass Adafruit_SPITFT).
@param x
Horizontal 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.
@param y
Vertical offset in pixels; top edge = 0, positive = down.
@param transact
Pass 'true' if TFT and SD are on the same SPI bus, in which
case SPI transactions are necessary. If separate peripherals,
can pass 'false'.
@return One of the ImageReturnCode values (IMAGE_SUCCESS on successful
completion, other values on failure).
*/
ImageReturnCode Adafruit_ImageReader::drawBMP(const char *filename,
Adafruit_SPITFT &tft, int16_t x,
int16_t y, boolean transact) {
uint16_t tftbuf[BUFPIXELS]; // Temp space for buffering TFT data
// Call core BMP-reading function, passing address to TFT object,
// TFT working buffer, and X & Y position of top-left corner (image
// will be cropped on load if necessary). Image pointer is NULL when
// reading to TFT, and transact argument is passed through.
return coreBMP(filename, &tft, tftbuf, x, y, NULL, transact);
}
/*!
@brief Loads BMP image file from SD card into RAM (as one of the GFX
canvas object types) for use with the bitmap-drawing functions.
Not practical for most AVR microcontrollers, but some of the
more capable 32-bit micros can afford some RAM for this.
@param filename
Name of BMP image file to load.
@param img
Adafruit_Image object, contents will be initialized, allocated
and loaded on success (else cleared).
@return One of the ImageReturnCode values (IMAGE_SUCCESS on successful
completion, other values on failure).
*/
ImageReturnCode Adafruit_ImageReader::loadBMP(const char *filename,
Adafruit_Image &img) {
// Call core BMP-reading function. TFT and working buffer are NULL
// (unused and allocated in function, respectively), X & Y position are
// always 0 because full image is loaded (RAM permitting). Adafruit_Image
// argument is passed through, and SPI transactions are not needed when
// loading to RAM (bus is not shared during load).
return coreBMP(filename, NULL, NULL, 0, 0, &img, false);
}
/*!
@brief BMP-reading function common both to the draw function (to TFT)
and load function (to canvas object in RAM). BMP code has been
centralized here so if/when more BMP format variants are added
in the future, it doesn't need to be implemented, debugged and
kept in sync in two places.
@param filename
Name of BMP image file to load.
@param tft
Pointer to TFT object, if loading to screen, else NULL.
@param dest
Working buffer for loading 16-bit TFT pixel data, if loading to
screen, else NULL.
@param x
Horizontal offset in pixels (if loading to screen).
@param y
Vertical offset in pixels (if loading to screen).
@param img
Pointer to Adafruit_Image object, if loading to RAM (or NULL
if loading to screen).
@param transact
Use SPI transactions; 'true' is needed only if loading to screen
and it's on the same SPI bus as the SD card. Other situations
can use 'false'.
@return One of the ImageReturnCode values (IMAGE_SUCCESS on successful
completion, other values on failure).
*/
ImageReturnCode Adafruit_ImageReader::coreBMP(
const char *filename, // SD file to load
Adafruit_SPITFT *tft, // Pointer to TFT object, or NULL if to image
uint16_t *dest, // TFT working buffer, or NULL if to canvas
int16_t x, // Position if loading to TFT (else ignored)
int16_t y,
Adafruit_Image *img, // NULL if load-to-screen
boolean transact) { // SD & TFT sharing bus, use transactions
ImageReturnCode status = IMAGE_ERR_FORMAT; // IMAGE_SUCCESS on valid file
uint32_t offset; // Start of image data in file
uint32_t headerSize; // Indicates BMP version
int bmpWidth, bmpHeight; // BMP width & height in pixels
uint8_t planes; // BMP planes
uint8_t depth; // BMP bit depth
uint32_t compression = 0; // BMP compression mode
uint32_t colors = 0; // Number of colors in palette
uint16_t *quantized = NULL; // 16-bit 5/6/5 color palette
uint32_t rowSize; // >bmpWidth if scanline padding
uint8_t sdbuf[3 * BUFPIXELS]; // BMP read buf (R+G+B/pixel)
#if ((3 * BUFPIXELS) <= 255)
uint8_t srcidx = sizeof sdbuf; // Current position in sdbuf
#else
uint16_t srcidx = sizeof sdbuf;
#endif
uint32_t destidx = 0;
uint8_t *dest1 = NULL; // Dest ptr for 1-bit BMPs to img
boolean flip = true; // BMP is stored bottom-to-top
uint32_t bmpPos = 0; // Next pixel position in file
int loadWidth, loadHeight, // Region being loaded (clipped)
loadX, loadY; // "
int row, col; // Current pixel pos.
uint8_t r, g, b; // Current pixel color
uint8_t bitIn = 0; // Bit number for 1-bit data in
uint8_t bitOut = 0; // Column mask for 1-bit data out
// If an Adafruit_Image object is passed and currently contains anything,
// free its contents as it's about to be overwritten with new stuff.
if (img)
img->dealloc();
// If BMP is being drawn off the right or bottom edge of the screen,
// nothing to do here. NOT an error, just a trivial clip operation.
if (tft && ((x >= tft->width()) || (y >= tft->height())))
return IMAGE_SUCCESS;
// Open requested file on SD card
if (!(file = filesys->open(filename, FILE_READ))) {
return IMAGE_ERR_FILE_NOT_FOUND;
}
// Parse BMP header. 0x4D42 (ASCII 'BM') is the Windows BMP signature.
// There are other values possible in a .BMP file but these are super
// esoteric (e.g. OS/2 struct bitmap array) and NOT supported here!
if (readLE16() == 0x4D42) { // BMP signature
(void)readLE32(); // Read & ignore file size
(void)readLE32(); // Read & ignore creator bytes
offset = readLE32(); // Start of image data
// Read DIB header
headerSize = readLE32();
bmpWidth = readLE32();
bmpHeight = readLE32();
// If bmpHeight is negative, image is in top-down order.
// This is not canon but has been observed in the wild.
if (bmpHeight < 0) {
bmpHeight = -bmpHeight;
flip = false;
}
planes = readLE16();
depth = readLE16(); // Bits per pixel
// Compression mode is present in later BMP versions (default = none)
if (headerSize > 12) {
compression = readLE32();
(void)readLE32(); // Raw bitmap data size; ignore
(void)readLE32(); // Horizontal resolution, ignore
(void)readLE32(); // Vertical resolution, ignore
colors = readLE32(); // Number of colors in palette, or 0 for 2^depth
(void)readLE32(); // Number of colors used (ignore)
// File position should now be at start of palette (if present)
}
if (!colors)
colors = 1 << depth;
loadWidth = bmpWidth;
loadHeight = bmpHeight;
loadX = 0;
loadY = 0;
if (tft) {
// Crop area to be loaded (if destination is TFT)
if (x < 0) {
loadX = -x;
loadWidth += x;
x = 0;
}
if (y < 0) {
loadY = -y;
loadHeight += y;
y = 0;
}
if ((x + loadWidth) > tft->width())
loadWidth = tft->width() - x;
if ((y + loadHeight) > tft->height())
loadHeight = tft->height() - y;
}
if ((planes == 1) && (compression == 0)) { // Only uncompressed is handled
// BMP rows are padded (if needed) to 4-byte boundary
rowSize = ((depth * bmpWidth + 31) / 32) * 4;
if ((depth == 24) || (depth == 1)) { // BGR or 1-bit bitmap format
if (img) {
// Loading to RAM -- allocate GFX 16-bit canvas type
status = IMAGE_ERR_MALLOC; // Assume won't fit to start
if (depth == 24) {
if ((img->canvas.canvas16 = new GFXcanvas16(bmpWidth, bmpHeight))) {
dest = img->canvas.canvas16->getBuffer();
}
} else {
if ((img->canvas.canvas1 = new GFXcanvas1(bmpWidth, bmpHeight))) {
dest1 = img->canvas.canvas1->getBuffer();
}
}
// Future: handle other depths.
}
if (dest || dest1) { // Supported format, alloc OK, etc.
status = IMAGE_SUCCESS;
if ((loadWidth > 0) && (loadHeight > 0)) { // Clip top/left
if (tft) {
tft->startWrite(); // Start SPI (regardless of transact)
tft->setAddrWindow(x, y, loadWidth, loadHeight);
} else {
if (depth == 1) {
img->format = IMAGE_1; // Is a GFX 1-bit canvas type
} else {
img->format = IMAGE_16; // Is a GFX 16-bit canvas type
}
}
if ((depth >= 16) ||
(quantized = (uint16_t *)malloc(colors * sizeof(uint16_t)))) {
if (depth < 16) {
// Load and quantize color table
for (uint16_t c = 0; c < colors; c++) {
b = file.read();
g = file.read();
r = file.read();
(void)file.read(); // Ignore 4th byte
quantized[c] =
((r & 0xF8) << 8) | ((g & 0xFC) << 3) | (b >> 3);
}
}
for (row = 0; row < loadHeight; row++) { // For each scanline...
#ifdef ESP8266
delay(1); // Keep ESP8266 happy
#endif
// Seek to start of scan line. It might seem labor-intensive
// to be doing this on every line, but this method covers a
// lot of gritty details like cropping, flip and scanline
// padding. Also, the seek only takes place if the file
// position actually needs to change (avoids a lot of cluster
// math in SD library).
if (flip) // Bitmap is stored bottom-to-top order (normal BMP)
bmpPos = offset + (bmpHeight - 1 - (row + loadY)) * rowSize;
else // Bitmap is stored top-to-bottom
bmpPos = offset + (row + loadY) * rowSize;
if (depth == 24) {
bmpPos += loadX * 3;
} else {
bmpPos += loadX / 8;
bitIn = 7 - (loadX & 7);
bitOut = 0x80;
if (img)
destidx = ((bmpWidth + 7) / 8) * row;
}
if (file.position() != bmpPos) { // Need seek?
if (transact) {
tft->dmaWait();
tft->endWrite(); // End TFT SPI transaction
}
file.seek(bmpPos); // Seek = SD transaction
srcidx = sizeof sdbuf; // Force buffer reload
}
for (col = 0; col < loadWidth; col++) { // For each pixel...
if (srcidx >= sizeof sdbuf) { // Time to load more?
if (tft) { // Drawing to TFT?
if (transact) {
tft->dmaWait();
tft->endWrite(); // End TFT SPI transact
}
#if defined(ARDUINO_NRF52_ADAFRUIT)
// NRF52840 seems to have trouble reading more than 512
// bytes across certain boundaries. Workaround for now
// is to break the read into smaller chunks...
int32_t bytesToGo = sizeof sdbuf, bytesRead = 0,
bytesThisPass;
while (bytesToGo > 0) {
bytesThisPass = min(bytesToGo, 512);
file.read(&sdbuf[bytesRead], bytesThisPass);
bytesRead += bytesThisPass;
bytesToGo -= bytesThisPass;
}
#else
file.read(sdbuf, sizeof sdbuf); // Load from SD
#endif
if (transact)
tft->startWrite(); // Start TFT SPI transact
if (destidx) { // If buffered TFT data
// Non-blocking writes (DMA) have been temporarily
// disabled until this can be rewritten with two
// alternating 'dest' buffers (else the nonblocking
// data out is overwritten in the dest[] write below).
// tft->writePixels(dest, destidx, false); // Write it
tft->writePixels(dest, destidx, true); // Write it
destidx = 0; // and reset dest index
}
} else { // Canvas is simpler,
file.read(sdbuf, sizeof sdbuf); // just load sdbuf
} // (destidx never resets)
srcidx = 0; // Reset bmp buf index
}
if (depth == 24) {
// Convert each pixel from BMP to 565 format, save in dest
b = sdbuf[srcidx++];
g = sdbuf[srcidx++];
r = sdbuf[srcidx++];
dest[destidx++] =
((r & 0xF8) << 8) | ((g & 0xFC) << 3) | (b >> 3);
} else {
// Extract 1-bit color index
uint8_t n = (sdbuf[srcidx] >> bitIn) & 1;
if (!bitIn) {
srcidx++;
bitIn = 7;
} else {
bitIn--;
}
if (tft) {
// Look up in palette, store in tft dest buf
dest[destidx++] = quantized[n];
} else {
// Store bit in canvas1 buffer (ignore palette)
if (n)
dest1[destidx] |= bitOut;
else
dest1[destidx] &= ~bitOut;
bitOut >>= 1;
if (!bitOut) {
bitOut = 0x80;
destidx++;
}
}
}
} // end pixel loop
if (tft) { // Drawing to TFT?
if (destidx) { // Any remainders?
// See notes above re: DMA
// tft->writePixels(dest, destidx, false); // Write it
tft->writePixels(dest, destidx, true); // Write it
destidx = 0; // and reset dest index
}
tft->dmaWait();
tft->endWrite(); // End TFT (regardless of transact)
}
} // end scanline loop
if (quantized) {
if (tft)
free(quantized); // Palette no longer needed
else
img->palette = quantized; // Keep palette with img
}
} // end depth>24 or quantized malloc OK
} // end top/left clip
} // end malloc check
} // end depth check
} // end planes/compression check
} // end signature
file.close();
return status;
}
/*!
@brief Query pixel dimensions of BMP image file on SD card.
@param filename
Name of BMP image file to query.
@param width
Pointer to int32_t; image width in pixels, returned.
@param height
Pointer to int32_t; image height in pixels, returned.
@return One of the ImageReturnCode values (IMAGE_SUCCESS on successful
completion, other values on failure).
*/
ImageReturnCode Adafruit_ImageReader::bmpDimensions(const char *filename,
int32_t *width,
int32_t *height) {
ImageReturnCode status = IMAGE_ERR_FILE_NOT_FOUND; // Guilty until innocent
if ((file = filesys->open(filename, FILE_READ))) { // Open requested file
status = IMAGE_ERR_FORMAT; // File's there, might not be BMP tho
if (readLE16() == 0x4D42) { // BMP signature?
(void)readLE32(); // Read & ignore file size
(void)readLE32(); // Read & ignore creator bytes
(void)readLE32(); // Read & ignore position of image data
(void)readLE32(); // Read & ignore header size
if (width)
*width = readLE32();
if (height) {
int32_t h = readLE32(); // Don't abs() this, may be a macro
if (h < 0)
h = -h; // Do manually instead
*height = h;
}
status = IMAGE_SUCCESS; // YAY.
}
file.close();
}
return status;
}
// UTILITY FUNCTIONS *******************************************************
/*!
@brief Reads a little-endian 16-bit unsigned value from currently-
open File, converting if necessary to the microcontroller's
native endianism. (BMP files use little-endian values.)
@return Unsigned 16-bit value, native endianism.
*/
uint16_t Adafruit_ImageReader::readLE16(void) {
#if !defined(ESP32) && !defined(ESP8266) && \
(__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
// Read directly into result -- BMP data and variable both little-endian.
uint16_t result;
file.read(&result, sizeof result);
return result;
#else
// Big-endian or unknown. Byte-by-byte read will perform reversal if needed.
return file.read() | ((uint16_t)file.read() << 8);
#endif
}
/*!
@brief Reads a little-endian 32-bit unsigned value from currently-
open File, converting if necessary to the microcontroller's
native endianism. (BMP files use little-endian values.)
@return Unsigned 32-bit value, native endianism.
*/
uint32_t Adafruit_ImageReader::readLE32(void) {
#if !defined(ESP32) && !defined(ESP8266) && \
(__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
// Read directly into result -- BMP data and variable both little-endian.
uint32_t result;
file.read(&result, sizeof result);
return result;
#else
// Big-endian or unknown. Byte-by-byte read will perform reversal if needed.
return file.read() | ((uint32_t)file.read() << 8) |
((uint32_t)file.read() << 16) | ((uint32_t)file.read() << 24);
#endif
}
/*!
@brief Print human-readable status message corresponding to an
ImageReturnCode type.
@param stat
Numeric ImageReturnCode value.
@param stream
Output stream (Serial default if unspecified).
@return None (void).
*/
void Adafruit_ImageReader::printStatus(ImageReturnCode stat, Stream &stream) {
if (stat == IMAGE_SUCCESS)
stream.println(F("Success!"));
else if (stat == IMAGE_ERR_FILE_NOT_FOUND)
stream.println(F("File not found."));
else if (stat == IMAGE_ERR_FORMAT)
stream.println(F("Not a supported BMP variant."));
else if (stat == IMAGE_ERR_MALLOC)
stream.println(F("Malloc failed (insufficient RAM)."));
}

View file

@ -1,115 +0,0 @@
/*!
* @file Adafruit_ImageReader.h
*
* This is part of Adafruit's ImageReader library for Arduino, designed to
* work with Adafruit_GFX plus a display device-specific library.
*
* Adafruit invests time and resources providing this open source code,
* please support Adafruit and open-source hardware by purchasing
* products from Adafruit!
*
* Written by Phil "PaintYourDragon" Burgess for Adafruit Industries.
*
* BSD license, all text here must be included in any redistribution.
*/
#ifndef __ADAFRUIT_IMAGE_READER_H__
#define __ADAFRUIT_IMAGE_READER_H__
#include "Adafruit_SPIFlash.h"
#include "Adafruit_SPITFT.h"
/** Status codes returned by drawBMP() and loadBMP() */
enum ImageReturnCode {
IMAGE_SUCCESS, // Successful load (or image clipped off screen)
IMAGE_ERR_FILE_NOT_FOUND, // Could not open file
IMAGE_ERR_FORMAT, // Not a supported image format
IMAGE_ERR_MALLOC // Could not allocate image (loadBMP() only)
};
/** Image formats returned by loadBMP() */
enum ImageFormat {
IMAGE_NONE, // No image was loaded; IMAGE_ERR_* condition
IMAGE_1, // GFXcanvas1 image (NOT YET SUPPORTED)
IMAGE_8, // GFXcanvas8 image (NOT YET SUPPORTED)
IMAGE_16 // GFXcanvas16 image (SUPPORTED)
};
/*!
@brief Data bundle returned with an image loaded to RAM. Used by
ImageReader.loadBMP() and Image.draw(), not ImageReader.drawBMP().
*/
class Adafruit_Image {
public:
Adafruit_Image(void);
~Adafruit_Image(void);
int16_t width(void) const; // Return image width in pixels
int16_t height(void) const; // Return image height in pixels
void draw(Adafruit_SPITFT &tft, int16_t x, int16_t y);
/*!
@brief Return canvas image format.
@return An ImageFormat type: IMAGE_1 for a GFXcanvas1, IMAGE_8 for
a GFXcanvas8, IMAGE_16 for a GFXcanvas16, IMAGE_NONE if no
canvas currently allocated.
*/
ImageFormat getFormat(void) const { return (ImageFormat)format; }
void *getCanvas(void) const;
/*!
@brief Return pointer to color palette.
@return Pointer to an array of 16-bit color values, or NULL if no
palette associated with image.
*/
uint16_t *getPalette(void) const { return palette; }
/*!
@brief Return pointer to 1bpp image mask canvas.
@return GFXcanvas1* pointer (1-bit RAM-resident image) if present,
NULL otherwise.
*/
GFXcanvas1 *getMask(void) const { return mask; };
protected:
// MOST OF THESE ARE NOT SUPPORTED YET -- WIP
union { // Single pointer, only one variant is used:
GFXcanvas1 *canvas1; ///< Canvas object if 1bpp format
GFXcanvas8 *canvas8; ///< Canvas object if 8bpp format
GFXcanvas16 *canvas16; ///< Canvas object if 16bpp
} canvas; ///< Union of different GFXcanvas types
GFXcanvas1 *mask; ///< 1bpp image mask (or NULL)
uint16_t *palette; ///< Color palette for 8bpp image (or NULL)
uint8_t format; ///< Canvas bundle type in use
void dealloc(void); ///< Free/deinitialize variables
friend class Adafruit_ImageReader; ///< Loading occurs here
};
/*!
@brief An optional adjunct to Adafruit_SPITFT that reads RGB BMP
images (maybe others in the future) from a flash filesystem
(SD card or SPI/QSPI flash). It's purposefully been made an
entirely separate class (rather than part of SPITFT or GFX
classes) so that Arduino code that uses GFX or SPITFT *without*
image loading does not need to incur the RAM overhead and
additional dependencies of the Adafruit_SPIFlash library by
its mere inclusion. The syntaxes can therefore be a bit
bizarre (passing display object as an argument), see examples
for use.
*/
class Adafruit_ImageReader {
public:
Adafruit_ImageReader(FatVolume &fs);
~Adafruit_ImageReader(void);
ImageReturnCode drawBMP(const char *filename, Adafruit_SPITFT &tft, int16_t x,
int16_t y, boolean transact = true);
ImageReturnCode loadBMP(const char *filename, Adafruit_Image &img);
ImageReturnCode bmpDimensions(const char *filename, int32_t *w, int32_t *h);
void printStatus(ImageReturnCode stat, Stream &stream = Serial);
protected:
FatVolume *filesys; ///< FAT FileSystem Object
File32 file; ///< Current Open file
ImageReturnCode coreBMP(const char *filename, Adafruit_SPITFT *tft,
uint16_t *dest, int16_t x, int16_t y,
Adafruit_Image *img, boolean transact);
uint16_t readLE16(void);
uint32_t readLE32(void);
};
#endif // __ADAFRUIT_IMAGE_READER_H__

View file

@ -1,527 +0,0 @@
#include "Adafruit_ImageReader_EPD.h"
#ifdef __AVR__
#define BUFPIXELS 24 ///< 24 * 5 = 120 bytes
#else
#define BUFPIXELS 200 ///< 200 * 5 = 1000 bytes
#endif
/*!
@brief Maps RGB color values to EPD display colors based on display mode.
@param r
Red component of the color (0-255).
@param g
Green component of the color (0-255).
@param b
Blue component of the color (0-255).
@param mode
The display mode (THINKINK_MONO, THINKINK_TRICOLOR,
THINKINK_GRAYSCALE4, THINKINK_QUADCOLOR, etc.) that
determines the available colors and mapping strategy.
@return EPD color constant (EPD_BLACK, EPD_WHITE, EPD_RED, EPD_YELLOW,
EPD_DARK, EPD_LIGHT) appropriate for the display mode.
@note Color mapping thresholds:
- Monochrome: Simple average threshold at 128
- Tricolor: Black < 0x60, Red >= 0x80 (red only), White otherwise
- Grayscale: Black < 0x40, Dark < 0x80, Light < 0xC0, White >= 0xC0
- Quadcolor: Black < 0x60, White >= 0xE0 (all channels),
Yellow >= 0xC0 red + >= 0x80 green, Red >= 0xC0 red + < 0x80
green
*/
uint8_t Adafruit_ImageReader_EPD::mapColorForDisplay(uint8_t r, uint8_t g,
uint8_t b,
thinkinkmode_t mode) {
switch (mode) {
case THINKINK_MONO:
case THINKINK_MONO_PARTIAL:
if ((r + g + b) / 3 < 128) {
return EPD_BLACK;
} else {
return EPD_WHITE;
}
case THINKINK_TRICOLOR:
if ((r < 0x60) && (g < 0x60) && (b < 0x60)) {
return EPD_BLACK;
} else if ((r >= 0x80) && (g < 0x80) && (b < 0x80)) {
return EPD_RED;
} else {
return EPD_WHITE;
}
case THINKINK_GRAYSCALE4: {
uint8_t gray = (r + g + b) / 3;
if (gray < 0x40) {
return EPD_BLACK;
} else if (gray < 0x80) {
return EPD_DARK;
} else if (gray < 0xC0) {
return EPD_LIGHT;
} else {
return EPD_WHITE;
}
}
case THINKINK_QUADCOLOR:
if ((r < 0x60) && (g < 0x60) && (b < 0x60)) {
return EPD_BLACK;
} else if ((r >= 0xE0) && (g >= 0xE0) && (b >= 0xE0)) {
return EPD_WHITE;
} else if ((r >= 0xC0) && (g >= 0x80) && (b < 0x40)) {
return EPD_YELLOW;
} else if ((r >= 0xC0) && (g < 0x80) && (b < 0x40)) {
return EPD_RED;
} else {
return EPD_WHITE;
}
default:
if ((r < 0x60) && (g < 0x60) && (b < 0x60)) {
return EPD_BLACK;
} else if ((r >= 0x80) && (g < 0x80) && (b < 0x80)) {
return EPD_RED;
} else {
return EPD_WHITE;
}
}
}
/*!
@brief Draw image to an Adafruit ePaper-type display.
@param epd
Screen to draw to (any Adafruit_EPD-derived class).
@param x
Horizontal 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.
@param y
Vertical offset in pixels; top edge = 0, positive = down.
@return None (void).
*/
void Adafruit_Image_EPD::draw(Adafruit_EPD &epd, int16_t x, int16_t y) {
int16_t col = x, row = y;
if (format == IMAGE_1) {
uint8_t *buffer = canvas.canvas1->getBuffer();
uint8_t i, c;
while (row < y + canvas.canvas1->height()) {
for (i = 0; i < 8; i++) {
if ((*buffer & (0x80 >> i)) > 0) {
c = EPD_BLACK; // try to infer black
} else {
c = EPD_WHITE;
}
epd.writePixel(col, row, c);
col++;
}
if (col >= x + canvas.canvas1->width()) {
col = x;
row++;
}
buffer++;
};
} else if (format == IMAGE_8) {
} else if (format == IMAGE_16) {
uint16_t *buffer = canvas.canvas16->getBuffer();
thinkinkmode_t displayMode = epd.getMode();
while (row < y + canvas.canvas16->height()) {
// RGB in 565 format
uint8_t r = (*buffer & 0xf800) >> 8;
uint8_t g = (*buffer & 0x07e0) >> 3;
uint8_t b = (*buffer & 0x001f) << 3;
uint8_t c =
Adafruit_ImageReader_EPD::mapColorForDisplay(r, g, b, displayMode);
epd.writePixel(col, row, c);
col++;
if (col == x + canvas.canvas16->width()) {
col = x;
row++;
}
buffer++;
};
}
}
// ADAFRUIT_IMAGEREADER_EPD CLASS **********************************************
// Loads images from SD card to screen or RAM.
/*!
@brief Constructor.
@return Adafruit_ImageReader object.
@param fs
FAT filesystem associated with this Adafruit_ImageReader
instance. Any images to load will come from this filesystem;
if multiple filesystems are required, each will require its
own Adafruit_ImageReader object. The filesystem does NOT need
to be initialized yet when passed in here (since this will
often be in pre-setup() declaration, but DOES need initializing
before any of the image loading or size functions are called!
*/
Adafruit_ImageReader_EPD::Adafruit_ImageReader_EPD(FatVolume &fs)
: Adafruit_ImageReader(fs) {}
/*!
@brief Loads BMP image file from SD card directly to Adafruit_EPD screen.
@param filename
Name of BMP image file to load.
@param epd
Screen to draw to (any Adafruit_EPD-derived class).
@param x
Horizontal 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.
@param y
Vertical offset in pixels; top edge = 0, positive = down.
@param transact
Pass 'true' if TFT and SD are on the same SPI bus, in which
case SPI transactions are necessary. If separate peripherals,
can pass 'false'.
@return One of the ImageReturnCode values (IMAGE_SUCCESS on successful
completion, other values on failure).
*/
ImageReturnCode Adafruit_ImageReader_EPD::drawBMP(char *filename,
Adafruit_EPD &epd, int16_t x,
int16_t y, boolean transact) {
uint16_t epdbuf[BUFPIXELS]; // Temp space for buffering EPD data
// Call core BMP-reading function, passing address to EPD object,
// EPD working buffer, and X & Y position of top-left corner (image
// will be cropped on load if necessary). Image pointer is NULL when
// reading to EPD, and transact argument is passed through.
return coreBMP(filename, &epd, epdbuf, x, y, NULL, transact);
}
/*!
@brief BMP-reading function common both to the draw function (to EPD)
and load function (to canvas object in RAM). BMP code has been
centralized here so if/when more BMP format variants are added
in the future, it doesn't need to be implemented, debugged and
kept in sync in two places.
@param filename
Name of BMP image file to load.
@param epd
Screen to draw to (any Adafruit_EPD-derived class). if loading to
screen, else NULL.
@param dest
Working buffer for loading 16-bit TFT pixel data, if loading to
screen, else NULL.
@param x
Horizontal offset in pixels (if loading to screen).
@param y
Vertical offset in pixels (if loading to screen).
@param img
Pointer to Adafruit_Image_EPD object, if loading to RAM (or NULL
if loading to screen).
@param transact
Use SPI transactions; 'true' is needed only if loading to screen
and it's on the same SPI bus as the SD card. Other situations
can use 'false'.
@return One of the ImageReturnCode values (IMAGE_SUCCESS on successful
completion, other values on failure).
*/
ImageReturnCode Adafruit_ImageReader_EPD::coreBMP(
char *filename, // SD file to load
Adafruit_EPD *epd, // Pointer to TFT object, or NULL if to image
uint16_t *dest, // EPD working buffer, or NULL if to canvas
int16_t x, // Position if loading to EPD (else ignored)
int16_t y,
Adafruit_Image_EPD *img, // NULL if load-to-screen
boolean transact) { // SD & EPD sharing bus, use transactions
thinkinkmode_t displayMode = epd ? epd->getMode() : THINKINK_TRICOLOR;
ImageReturnCode status = IMAGE_ERR_FORMAT; // IMAGE_SUCCESS on valid file
uint32_t offset; // Start of image data in file
uint32_t headerSize; // Indicates BMP version
int bmpWidth, bmpHeight; // BMP width & height in pixels
uint8_t planes; // BMP planes
uint8_t depth; // BMP bit depth
uint32_t compression = 0; // BMP compression mode
uint32_t colors = 0; // Number of colors in palette
uint16_t *quantized = NULL; // EPD Color palette
uint32_t rowSize; // >bmpWidth if scanline padding
uint8_t sdbuf[3 * BUFPIXELS]; // BMP read buf (R+G+B/pixel)
int16_t epd_col = 0, epd_row = 0;
#if ((3 * BUFPIXELS) <= 255)
uint8_t srcidx = sizeof sdbuf; // Current position in sdbuf
#else
uint16_t srcidx = sizeof sdbuf;
#endif
uint32_t destidx = 0;
uint8_t *dest1 = NULL; // Dest ptr for 1-bit BMPs to img
boolean flip = true; // BMP is stored bottom-to-top
uint32_t bmpPos = 0; // Next pixel position in file
int loadWidth, loadHeight, // Region being loaded (clipped)
loadX, loadY; // "
int row, col; // Current pixel pos.
uint8_t r, g, b, color; // Current pixel color
uint8_t bitIn = 0; // Bit number for 1-bit data in
uint8_t bitOut = 0; // Column mask for 1-bit data out
// If an Adafruit_Image object is passed and currently contains anything,
// free its contents as it's about to be overwritten with new stuff.
if (img)
img->dealloc();
// If BMP is being drawn off the right or bottom edge of the screen,
// nothing to do here. NOT an error, just a trivial clip operation.
if (epd && ((x >= epd->width()) || (y >= epd->height())))
return IMAGE_SUCCESS;
// Open requested file on SD card
if (!(file = filesys->open(filename, FILE_READ))) {
return IMAGE_ERR_FILE_NOT_FOUND;
}
// Parse BMP header. 0x4D42 (ASCII 'BM') is the Windows BMP signature.
// There are other values possible in a .BMP file but these are super
// esoteric (e.g. OS/2 struct bitmap array) and NOT supported here!
if (readLE16() == 0x4D42) { // BMP signature
(void)readLE32(); // Read & ignore file size
(void)readLE32(); // Read & ignore creator bytes
offset = readLE32(); // Start of image data
// Read DIB header
headerSize = readLE32();
bmpWidth = readLE32();
bmpHeight = readLE32();
// If bmpHeight is negative, image is in top-down order.
// This is not canon but has been observed in the wild.
if (bmpHeight < 0) {
bmpHeight = -bmpHeight;
flip = false;
}
planes = readLE16();
depth = readLE16(); // Bits per pixel
// Compression mode is present in later BMP versions (default = none)
if (headerSize > 12) {
compression = readLE32();
(void)readLE32(); // Raw bitmap data size; ignore
(void)readLE32(); // Horizontal resolution, ignore
(void)readLE32(); // Vertical resolution, ignore
colors = readLE32(); // Number of colors in palette, or 0 for 2^depth
(void)readLE32(); // Number of colors used (ignore)
// File position should now be at start of palette (if present)
}
if (!colors)
colors = 1 << depth;
loadWidth = bmpWidth;
loadHeight = bmpHeight;
loadX = 0;
loadY = 0;
if (epd) {
// Crop area to be loaded (if destination is EPD)
if (x < 0) {
loadX = -x;
loadWidth += x;
x = 0;
}
if (y < 0) {
loadY = -y;
loadHeight += y;
y = 0;
}
if ((x + loadWidth) > epd->width())
loadWidth = epd->width() - x;
if ((y + loadHeight) > epd->height())
loadHeight = epd->height() - y;
}
if ((planes == 1) && (compression == 0)) { // Only uncompressed is handled
// BMP rows are padded (if needed) to 4-byte boundary
rowSize = ((depth * bmpWidth + 31) / 32) * 4;
if ((depth == 24) || (depth == 1)) { // BGR or 1-bit bitmap format
if (img) {
// Loading to RAM -- allocate GFX 16-bit canvas type
status = IMAGE_ERR_MALLOC; // Assume won't fit to start
if (depth == 24) {
if ((img->canvas.canvas16 = new GFXcanvas16(bmpWidth, bmpHeight))) {
dest = img->canvas.canvas16->getBuffer();
}
} else {
if ((img->canvas.canvas1 = new GFXcanvas1(bmpWidth, bmpHeight))) {
dest1 = img->canvas.canvas1->getBuffer();
}
}
// Future: handle other depths.
}
if (dest || dest1) { // Supported format, alloc OK, etc.
status = IMAGE_SUCCESS;
if ((loadWidth > 0) && (loadHeight > 0)) { // Clip top/left
if (epd) {
epd->startWrite(); // Start SPI (regardless of transact)
epd_col = x;
epd_row = y;
} else {
if (depth == 1) {
img->format = IMAGE_1; // Is a GFX 1-bit canvas type
} else {
img->format = IMAGE_16; // Is a GFX 16-bit canvas type
}
}
if ((depth >= 16) ||
(quantized = (uint16_t *)malloc(colors * sizeof(uint16_t)))) {
if (depth < 16) {
// Load and quantize color table
thinkinkmode_t displayMode =
epd ? epd->getMode() : THINKINK_TRICOLOR;
for (uint16_t c = 0; c < colors; c++) {
b = file.read();
g = file.read();
r = file.read();
(void)file.read(); // Ignore 4th byte
color = mapColorForDisplay(r, g, b, displayMode);
quantized[c] = color;
}
}
for (row = 0; row < loadHeight; row++) { // For each scanline...
yield(); // Keep ESP8266 happy
// Seek to start of scan line. It might seem labor-intensive
// to be doing this on every line, but this method covers a
// lot of gritty details like cropping, flip and scanline
// padding. Also, the seek only takes place if the file
// position actually needs to change (avoids a lot of cluster
// math in SD library).
if (flip) // Bitmap is stored bottom-to-top order (normal BMP)
bmpPos = offset + (bmpHeight - 1 - (row + loadY)) * rowSize;
else // Bitmap is stored top-to-bottom
bmpPos = offset + (row + loadY) * rowSize;
if (depth == 24) {
bmpPos += loadX * 3;
} else {
bmpPos += loadX / 8;
bitIn = 7 - (loadX & 7);
bitOut = 0x80;
if (img) {
destidx = ((bmpWidth + 7) / 8) * row;
}
}
if (file.position() != bmpPos) { // Need seek?
if (transact) {
epd->endWrite(); // End EPD SPI transaction
}
file.seek(bmpPos); // Seek = SD transaction
srcidx = sizeof sdbuf; // Force buffer reload
}
for (col = 0; col < loadWidth; col++) { // For each pixel...
if (srcidx >= sizeof sdbuf) { // Time to load more?
if (epd) { // Drawing to TFT?
if (transact) {
epd->endWrite(); // End EPD SPI transact
}
#if defined(ARDUINO_NRF52_ADAFRUIT)
// NRF52840 seems to have trouble reading more than 512
// bytes across certain boundaries. Workaround for now
// is to break the read into smaller chunks...
int32_t bytesToGo = sizeof sdbuf, bytesRead = 0,
bytesThisPass;
while (bytesToGo > 0) {
bytesThisPass = min(bytesToGo, 512);
file.read(&sdbuf[bytesRead], bytesThisPass);
bytesRead += bytesThisPass;
bytesToGo -= bytesThisPass;
}
#else
file.read(sdbuf, sizeof sdbuf); // Load from SD
#endif
if (transact)
epd->startWrite(); // Start EPD SPI transact
if (destidx) { // If buffered EPD data
// Non-blocking writes (DMA) have been temporarily
// disabled until this can be rewritten with two
// alternating 'dest' buffers (else the nonblocking
// data out is overwritten in the dest[] write below).
uint16_t index = 0;
while (index < destidx && epd_row < y + loadHeight) {
epd->writePixel(epd_col, epd_row, dest[index]);
epd_col++;
if (epd_col == x + loadWidth) {
epd_col = x;
epd_row++;
}
index++;
};
destidx = 0; // and reset dest index
}
} else { // Canvas is simpler,
file.read(sdbuf, sizeof sdbuf); // just load sdbuf
} // (destidx never resets)
srcidx = 0; // Reset bmp buf index
}
if (depth == 24) {
// Convert each pixel from BMP to 565 format, save in dest
b = sdbuf[srcidx++];
g = sdbuf[srcidx++];
r = sdbuf[srcidx++];
color = mapColorForDisplay(r, g, b, displayMode);
dest[destidx++] = color;
} else {
// Extract 1-bit color index
uint8_t n = (sdbuf[srcidx] >> bitIn) & 1;
if (!bitIn) {
srcidx++;
bitIn = 7;
} else {
bitIn--;
}
if (epd) {
// Look up in palette, store in epd dest buf
dest[destidx++] = quantized[n];
} else {
// Store bit in canvas1 buffer (ignore palette)
if (n)
dest1[destidx] |= bitOut;
else
dest1[destidx] &= ~bitOut;
bitOut >>= 1;
if (!bitOut) {
bitOut = 0x80;
destidx++;
}
}
}
} // end pixel loop
if (epd) { // Drawing to TFT?
if (destidx) { // Any remainders?
uint16_t index = 0;
while (index < destidx && epd_row < y + loadHeight) {
epd->writePixel(epd_col, epd_row, dest[index]);
epd_col++;
if (epd_col == x + loadWidth) {
epd_col = x;
epd_row++;
}
index++;
};
destidx = 0; // and reset dest index
}
epd->endWrite(); // End TFT (regardless of transact)
}
} // end scanline loop
if (quantized) {
if (epd)
free(quantized); // Palette no longer needed
else
img->palette = quantized; // Keep palette with img
}
} // end depth>24 or quantized malloc OK
} // end top/left clip
} // end malloc check
} // end depth check
} // end planes/compression check
} // end signature
file.close();
return status;
}

View file

@ -1,60 +0,0 @@
/*!
* @file Adafruit_ImageReader_EPD.h
*
* This is part of Adafruit's ImageReader library for Arduino, designed to
* work with Adafruit_GFX plus a display device-specific library.
*
* Adafruit invests time and resources providing this open source code,
* please support Adafruit and open-source hardware by purchasing
* products from Adafruit!
*
* Written by Melissa LeBlanc-Williams for Adafruit Industries.
*
* BSD license, all text here must be included in any redistribution.
*/
#ifndef __ADAFRUIT_IMAGE_READER_EPD_H__
#define __ADAFRUIT_IMAGE_READER_EPD_H__
#include "Adafruit_EPD.h"
#include "Adafruit_ImageReader.h"
/*!
@brief Data bundle returned with an image loaded to RAM. Used by
ImageReader.loadBMP() and Image.draw(), not ImageReader.drawBMP().
*/
class Adafruit_Image_EPD : public Adafruit_Image {
public:
void draw(Adafruit_EPD &epd, int16_t x, int16_t y);
protected:
friend class Adafruit_ImageReader_EPD; ///< Loading occurs here
};
/*!
@brief An optional adjunct to Adafruit_EPD that reads RGB BMP
images (maybe others in the future) from a flash filesystem
(SD card or SPI/QSPI flash). It's purposefully been made an
entirely separate class (rather than part of SPITFT or GFX
classes) so that Arduino code that uses GFX or SPITFT *without*
image loading does not need to incur the RAM overhead and
additional dependencies of the Adafruit_SPIFlash library by
its mere inclusion. The syntaxes can therefore be a bit
bizarre (passing display object as an argument), see examples
for use.
*/
class Adafruit_ImageReader_EPD : public Adafruit_ImageReader {
public:
Adafruit_ImageReader_EPD(FatVolume &fs);
ImageReturnCode drawBMP(char *filename, Adafruit_EPD &epd, int16_t x,
int16_t y, boolean transact = true);
static uint8_t mapColorForDisplay(uint8_t r, uint8_t g, uint8_t b,
thinkinkmode_t mode);
private:
ImageReturnCode coreBMP(char *filename, Adafruit_EPD *epd, uint16_t *dest,
int16_t x, int16_t y, Adafruit_Image_EPD *img,
boolean transact);
};
#endif // __ADAFRUIT_IMAGE_READER_EPD_H__

View file

@ -1,7 +0,0 @@
# Adafruit ImageReader Arduino Library [![Build Status](https://github.com/adafruit/Adafruit_ImageReader/workflows/Arduino%20Library%20CI/badge.svg)](https://github.com/adafruit/Adafruit_ImageReader/actions)[![Documentation](https://github.com/adafruit/ci-arduino/blob/master/assets/doxygen_badge.svg)](http://adafruit.github.io/Adafruit_ImageReader/html/index.html)
Companion library for Adafruit_GFX to load images from SD card or SPI Flash
Requires Adafruit_GFX library and one of the SPI color graphic display libraries, e.g. Adafruit_ILI9341.
**IMPORTANT NOTE: version 2.0 is a "breaking change"** from the 1.X releases of this library. Existing code WILL NOT COMPILE without revision. Adafruit_ImageReader now relies on the Adafruit_SPIFlash and SdFat libraries, and the Adafruit_ImageReader constructor call has changed (other functions remain the same). See the examples for reference. Very sorry about that but it brings some helpful speed and feature benefits (like loading from SPI/QSPI flash).

View file

@ -1,161 +0,0 @@
// Adafruit_ImageReader test for Adafruit ST7735 TFT Breakout for Arduino.
// Demonstrates loading images from SD card or flash memory to the screen,
// to RAM, and how to query image file dimensions.
// Requires three BMP files in root directory of SD card:
// rgbwheel.bmp, miniwoof.bmp and wales.bmp.
// As written, this uses the microcontroller's SPI interface for the screen
// (not 'bitbang') and must be wired to specific pins (e.g. for Arduino Uno,
// MOSI = pin 11, MISO = 12, SCK = 13). Other pins are configurable below.
#include <Adafruit_GFX.h> // Core graphics library
#include <Adafruit_SSD1331.h> // Hardware-specific library
#include <SdFat_Adafruit_Fork.h> // SD card & FAT filesystem library
#include <Adafruit_SPIFlash.h> // SPI / QSPI flash library
#include <Adafruit_ImageReader.h> // Image-reading functions
// Comment out the next line to load from SPI/QSPI flash instead of SD card:
#define USE_SD_CARD
// Color definitions
#define BLACK 0x0000
#define BLUE 0x001F
#define RED 0xF800
#define GREEN 0x07E0
#define CYAN 0x07FF
#define MAGENTA 0xF81F
#define YELLOW 0xFFE0
#define WHITE 0xFFFF
// TFT display and SD card share the hardware SPI interface, using
// 'select' pins for each to identify the active device on the bus.
#define TFT_CS 10 // TFT select pin
#define TFT_RST 9 // Or set to -1 and connect to Arduino RESET pin
#define TFT_DC 8 // TFT display/command pin
#define SD_CS 4 // SD card select pin
#if defined(USE_SD_CARD)
SdFat SD; // SD card filesystem
Adafruit_ImageReader reader(SD); // Image-reader object, pass in SD filesys
#else
// SPI or QSPI flash filesystem (i.e. CIRCUITPY drive)
#if defined(__SAMD51__) || defined(NRF52840_XXAA)
Adafruit_FlashTransport_QSPI flashTransport(PIN_QSPI_SCK, PIN_QSPI_CS,
PIN_QSPI_IO0, PIN_QSPI_IO1, PIN_QSPI_IO2, PIN_QSPI_IO3);
#else
#if (SPI_INTERFACES_COUNT == 1)
Adafruit_FlashTransport_SPI flashTransport(SS, &SPI);
#else
Adafruit_FlashTransport_SPI flashTransport(SS1, &SPI1);
#endif
#endif
Adafruit_SPIFlash flash(&flashTransport);
FatVolume filesys;
Adafruit_ImageReader reader(filesys); // Image-reader, pass in flash filesys
#endif
Adafruit_SSD1331 tft = Adafruit_SSD1331(&SPI, TFT_CS, TFT_DC, TFT_RST);
Adafruit_Image img; // An image loaded into RAM
int32_t width = 0, // BMP image dimensions
height = 0;
void setup(void) {
ImageReturnCode stat; // Status from image-reading functions
Serial.begin(9600);
#if !defined(ESP32)
while(!Serial); // Wait for Serial Monitor before continuing
#endif
tft.begin(); // Initialize screen
// The Adafruit_ImageReader constructor call (above, before setup())
// accepts an uninitialized SdFat or FatVolume object. This MUST
// BE INITIALIZED before using any of the image reader functions!
Serial.print(F("Initializing filesystem..."));
#if defined(USE_SD_CARD)
// SD card is pretty straightforward, a single call...
if(!SD.begin(SD_CS, SD_SCK_MHZ(10))) { // Breakouts require 10 MHz limit due to longer wires
Serial.println(F("SD begin() failed"));
for(;;); // Fatal error, do not continue
}
#else
// SPI or QSPI flash requires two steps, one to access the bare flash
// memory itself, then the second to access the filesystem within...
if(!flash.begin()) {
Serial.println(F("flash begin() failed"));
for(;;);
}
if(!filesys.begin(&flash)) {
Serial.println(F("filesys begin() failed"));
for(;;);
}
#endif
Serial.println(F("OK!"));
// Fill screen blue. Not a required step, this just shows that we're
// successfully communicating with the screen.
tft.fillScreen(BLUE);
// Load full-screen BMP file 'daffodil.bmp' at position (0,0) (top left).
// Notice the 'reader' object performs this, with 'tft' as an argument.
Serial.print(F("Loading daffodil.bmp to screen..."));
stat = reader.drawBMP("/daffodil.bmp", tft, 0, 0);
reader.printStatus(stat); // How'd we do?
// Query the dimensions of image 'miniwoof.bmp' WITHOUT loading to screen:
Serial.print(F("Querying miniwoof.bmp image size..."));
stat = reader.bmpDimensions("/miniwoof.bmp", &width, &height);
reader.printStatus(stat); // How'd we do?
if(stat == IMAGE_SUCCESS) { // If it worked, print image size...
Serial.print(F("Image dimensions: "));
Serial.print(width);
Serial.write('x');
Serial.println(height);
}
// Load small BMP 'wales.bmp' into a GFX canvas in RAM. This should fail
// gracefully on Arduino Uno and other small devices, meaning the image
// will not load, but this won't make the program stop or crash, it just
// continues on without it. Should work on Arduino Mega, Zero, etc.
Serial.print(F("Loading wales.bmp to canvas..."));
stat = reader.loadBMP("/wales.bmp", img);
reader.printStatus(stat); // How'd we do?
delay(2000); // Pause 2 seconds before moving on to loop()
}
void loop() {
for(int r=0; r<4; r++) { // For each of 4 rotations...
tft.setRotation(r); // Set rotation
tft.fillScreen(0); // and clear screen
// Load 4 copies of the 'miniwoof.bmp' image to the screen, some
// partially off screen edges to demonstrate clipping. Globals
// 'width' and 'height' were set by bmpDimensions() call in setup().
for(int i=0; i<4; i++) {
reader.drawBMP("/miniwoof.bmp", tft,
(tft.width() * i / 3) - (width / 2),
(tft.height() * i / 3) - (height / 2));
}
delay(1000); // Pause 1 sec.
// Draw 50 Welsh dragon flags in random positions. This has no effect
// on memory-constrained boards like the Arduino Uno, where the image
// failed to load due to insufficient RAM, but it's NOT fatal.
for(int i=0; i<50; i++) {
// Rather than reader.drawBMP() (which works from SD card),
// a different function is used for RAM-resident images:
img.draw(tft, // Pass in tft object
(int16_t)random(-img.width() , tft.width()) , // Horiz pos.
(int16_t)random(-img.height(), tft.height())); // Vert pos
// Reiterating a prior point: img.draw() does nothing and returns
// if the image failed to load. It's unfortunate but not disastrous.
}
delay(2000); // Pause 2 sec.
}
}

View file

@ -1,165 +0,0 @@
// Adafruit_ImageReader test for Adafruit ST7735 TFT Breakout for Arduino.
// Demonstrates loading images from SD card or flash memory to the screen,
// to RAM, and how to query image file dimensions.
// Requires three BMP files in root directory of SD card:
// rgbwheel.bmp, miniwoof.bmp and wales.bmp.
// As written, this uses the microcontroller's SPI interface for the screen
// (not 'bitbang') and must be wired to specific pins (e.g. for Arduino Uno,
// MOSI = pin 11, MISO = 12, SCK = 13). Other pins are configurable below.
#include <Adafruit_GFX.h> // Core graphics library
#include <Adafruit_SSD1351.h> // Hardware-specific library
#include <SdFat_Adafruit_Fork.h> // SD card & FAT filesystem library
#include <Adafruit_SPIFlash.h> // SPI / QSPI flash library
#include <Adafruit_ImageReader.h> // Image-reading functions
// Comment out the next line to load from SPI/QSPI flash instead of SD card:
#define USE_SD_CARD
// Color definitions
#define BLACK 0x0000
#define BLUE 0x001F
#define RED 0xF800
#define GREEN 0x07E0
#define CYAN 0x07FF
#define MAGENTA 0xF81F
#define YELLOW 0xFFE0
#define WHITE 0xFFFF
// Screen dimensions
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 128 // Change this to 96 for 1.27" OLED.
// TFT display and SD card share the hardware SPI interface, using
// 'select' pins for each to identify the active device on the bus.
#define SD_CS 7 // SD card select pin
#define TFT_CS 5 // TFT select pin
#define TFT_DC 4 // TFT display/command pin
#define TFT_RST 6 // Or set to -1 and connect to Arduino RESET pin
#if defined(USE_SD_CARD)
SdFat SD; // SD card filesystem
Adafruit_ImageReader reader(SD); // Image-reader object, pass in SD filesys
#else
// SPI or QSPI flash filesystem (i.e. CIRCUITPY drive)
#if defined(__SAMD51__) || defined(NRF52840_XXAA)
Adafruit_FlashTransport_QSPI flashTransport(PIN_QSPI_SCK, PIN_QSPI_CS,
PIN_QSPI_IO0, PIN_QSPI_IO1, PIN_QSPI_IO2, PIN_QSPI_IO3);
#else
#if (SPI_INTERFACES_COUNT == 1)
Adafruit_FlashTransport_SPI flashTransport(SS, &SPI);
#else
Adafruit_FlashTransport_SPI flashTransport(SS1, &SPI1);
#endif
#endif
Adafruit_SPIFlash flash(&flashTransport);
FatVolume filesys;
Adafruit_ImageReader reader(filesys); // Image-reader, pass in flash filesys
#endif
Adafruit_SSD1351 tft = Adafruit_SSD1351(SCREEN_WIDTH, SCREEN_HEIGHT, &SPI, TFT_CS, TFT_DC, TFT_RST);
Adafruit_Image img; // An image loaded into RAM
int32_t width = 0, // BMP image dimensions
height = 0;
void setup(void) {
ImageReturnCode stat; // Status from image-reading functions
Serial.begin(9600);
#if !defined(ESP32)
while(!Serial); // Wait for Serial Monitor before continuing
#endif
tft.begin(); // Initialize screen
// The Adafruit_ImageReader constructor call (above, before setup())
// accepts an uninitialized SdFat or FatVolume object. This MUST
// BE INITIALIZED before using any of the image reader functions!
Serial.print(F("Initializing filesystem..."));
#if defined(USE_SD_CARD)
// SD card is pretty straightforward, a single call...
if(!SD.begin(SD_CS, SD_SCK_MHZ(10))) { // Breakouts require 10 MHz limit due to longer wires
Serial.println(F("SD begin() failed"));
for(;;); // Fatal error, do not continue
}
#else
// SPI or QSPI flash requires two steps, one to access the bare flash
// memory itself, then the second to access the filesystem within...
if(!flash.begin()) {
Serial.println(F("flash begin() failed"));
for(;;);
}
if(!filesys.begin(&flash)) {
Serial.println(F("filesys begin() failed"));
for(;;);
}
#endif
Serial.println(F("OK!"));
// Fill screen blue. Not a required step, this just shows that we're
// successfully communicating with the screen.
tft.fillScreen(BLUE);
// Load full-screen BMP file 'rgbwheel.bmp' at position (0,0) (top left).
// Notice the 'reader' object performs this, with 'tft' as an argument.
Serial.print(F("Loading rgbwheel.bmp to screen..."));
stat = reader.drawBMP("/rgbwheel.bmp", tft, 0, 0);
reader.printStatus(stat); // How'd we do?
// Query the dimensions of image 'miniwoof.bmp' WITHOUT loading to screen:
Serial.print(F("Querying miniwoof.bmp image size..."));
stat = reader.bmpDimensions("/miniwoof.bmp", &width, &height);
reader.printStatus(stat); // How'd we do?
if(stat == IMAGE_SUCCESS) { // If it worked, print image size...
Serial.print(F("Image dimensions: "));
Serial.print(width);
Serial.write('x');
Serial.println(height);
}
// Load small BMP 'wales.bmp' into a GFX canvas in RAM. This should fail
// gracefully on Arduino Uno and other small devices, meaning the image
// will not load, but this won't make the program stop or crash, it just
// continues on without it. Should work on Arduino Mega, Zero, etc.
Serial.print(F("Loading wales.bmp to canvas..."));
stat = reader.loadBMP("/wales.bmp", img);
reader.printStatus(stat); // How'd we do?
delay(2000); // Pause 2 seconds before moving on to loop()
}
void loop() {
for(int r=0; r<4; r++) { // For each of 4 rotations...
tft.setRotation(r); // Set rotation
tft.fillScreen(0); // and clear screen
// Load 4 copies of the 'miniwoof.bmp' image to the screen, some
// partially off screen edges to demonstrate clipping. Globals
// 'width' and 'height' were set by bmpDimensions() call in setup().
for(int i=0; i<4; i++) {
reader.drawBMP("/miniwoof.bmp", tft,
(tft.width() * i / 3) - (width / 2),
(tft.height() * i / 3) - (height / 2));
}
delay(1000); // Pause 1 sec.
// Draw 50 Welsh dragon flags in random positions. This has no effect
// on memory-constrained boards like the Arduino Uno, where the image
// failed to load due to insufficient RAM, but it's NOT fatal.
for(int i=0; i<50; i++) {
// Rather than reader.drawBMP() (which works from SD card),
// a different function is used for RAM-resident images:
img.draw(tft, // Pass in tft object
(int16_t)random(-img.width() , tft.width()) , // Horiz pos.
(int16_t)random(-img.height(), tft.height())); // Vert pos
// Reiterating a prior point: img.draw() does nothing and returns
// if the image failed to load. It's unfortunate but not disastrous.
}
delay(2000); // Pause 2 sec.
}
}

View file

@ -1,150 +0,0 @@
// Adafruit_ImageReader test for Adafruit ST7735 TFT Breakout for Arduino.
// Demonstrates loading images from SD card or flash memory to the screen,
// to RAM, and how to query image file dimensions.
// Requires three BMP files in root directory of SD card:
// rgbwheel.bmp, miniwoof.bmp and wales.bmp.
// As written, this uses the microcontroller's SPI interface for the screen
// (not 'bitbang') and must be wired to specific pins (e.g. for Arduino Uno,
// MOSI = pin 11, MISO = 12, SCK = 13). Other pins are configurable below.
#include <Adafruit_GFX.h> // Core graphics library
#include <Adafruit_ST7735.h> // Hardware-specific library
#include <SdFat_Adafruit_Fork.h> // SD card & FAT filesystem library
#include <Adafruit_SPIFlash.h> // SPI / QSPI flash library
#include <Adafruit_ImageReader.h> // Image-reading functions
// Comment out the next line to load from SPI/QSPI flash instead of SD card:
#define USE_SD_CARD
// TFT display and SD card share the hardware SPI interface, using
// 'select' pins for each to identify the active device on the bus.
#define SD_CS 4 // SD card select pin
#define TFT_CS 10 // TFT select pin
#define TFT_DC 8 // TFT display/command pin
#define TFT_RST 9 // Or set to -1 and connect to Arduino RESET pin
#if defined(USE_SD_CARD)
SdFat SD; // SD card filesystem
Adafruit_ImageReader reader(SD); // Image-reader object, pass in SD filesys
#else
// SPI or QSPI flash filesystem (i.e. CIRCUITPY drive)
#if defined(__SAMD51__) || defined(NRF52840_XXAA)
Adafruit_FlashTransport_QSPI flashTransport(PIN_QSPI_SCK, PIN_QSPI_CS,
PIN_QSPI_IO0, PIN_QSPI_IO1, PIN_QSPI_IO2, PIN_QSPI_IO3);
#else
#if (SPI_INTERFACES_COUNT == 1)
Adafruit_FlashTransport_SPI flashTransport(SS, &SPI);
#else
Adafruit_FlashTransport_SPI flashTransport(SS1, &SPI1);
#endif
#endif
Adafruit_SPIFlash flash(&flashTransport);
FatVolume filesys;
Adafruit_ImageReader reader(filesys); // Image-reader, pass in flash filesys
#endif
Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_RST);
Adafruit_Image img; // An image loaded into RAM
int32_t width = 0, // BMP image dimensions
height = 0;
void setup(void) {
ImageReturnCode stat; // Status from image-reading functions
Serial.begin(9600);
#if !defined(ESP32)
while(!Serial); // Wait for Serial Monitor before continuing
#endif
tft.initR(INITR_144GREENTAB); // Initialize screen
// The Adafruit_ImageReader constructor call (above, before setup())
// accepts an uninitialized SdFat or FatVolume object. This MUST
// BE INITIALIZED before using any of the image reader functions!
Serial.print(F("Initializing filesystem..."));
#if defined(USE_SD_CARD)
// SD card is pretty straightforward, a single call...
if(!SD.begin(SD_CS, SD_SCK_MHZ(10))) { // Breakouts require 10 MHz limit due to longer wires
Serial.println(F("SD begin() failed"));
for(;;); // Fatal error, do not continue
}
#else
// SPI or QSPI flash requires two steps, one to access the bare flash
// memory itself, then the second to access the filesystem within...
if(!flash.begin()) {
Serial.println(F("flash begin() failed"));
for(;;);
}
if(!filesys.begin(&flash)) {
Serial.println(F("filesys begin() failed"));
for(;;);
}
#endif
Serial.println(F("OK!"));
// Fill screen blue. Not a required step, this just shows that we're
// successfully communicating with the screen.
tft.fillScreen(ST7735_BLUE);
// Load full-screen BMP file 'rgbwheel.bmp' at position (0,0) (top left).
// Notice the 'reader' object performs this, with 'tft' as an argument.
Serial.print(F("Loading rgbwheel.bmp to screen..."));
stat = reader.drawBMP("/rgbwheel.bmp", tft, 0, 0);
reader.printStatus(stat); // How'd we do?
// Query the dimensions of image 'miniwoof.bmp' WITHOUT loading to screen:
Serial.print(F("Querying miniwoof.bmp image size..."));
stat = reader.bmpDimensions("/miniwoof.bmp", &width, &height);
reader.printStatus(stat); // How'd we do?
if(stat == IMAGE_SUCCESS) { // If it worked, print image size...
Serial.print(F("Image dimensions: "));
Serial.print(width);
Serial.write('x');
Serial.println(height);
}
// Load small BMP 'wales.bmp' into a GFX canvas in RAM. This should fail
// gracefully on Arduino Uno and other small devices, meaning the image
// will not load, but this won't make the program stop or crash, it just
// continues on without it. Should work on Arduino Mega, Zero, etc.
Serial.print(F("Loading wales.bmp to canvas..."));
stat = reader.loadBMP("/wales.bmp", img);
reader.printStatus(stat); // How'd we do?
delay(2000); // Pause 2 seconds before moving on to loop()
}
void loop() {
for(int r=0; r<4; r++) { // For each of 4 rotations...
tft.setRotation(r); // Set rotation
tft.fillScreen(0); // and clear screen
// Load 4 copies of the 'miniwoof.bmp' image to the screen, some
// partially off screen edges to demonstrate clipping. Globals
// 'width' and 'height' were set by bmpDimensions() call in setup().
for(int i=0; i<4; i++) {
reader.drawBMP("/miniwoof.bmp", tft,
(tft.width() * i / 3) - (width / 2),
(tft.height() * i / 3) - (height / 2));
}
delay(1000); // Pause 1 sec.
// Draw 50 Welsh dragon flags in random positions. This has no effect
// on memory-constrained boards like the Arduino Uno, where the image
// failed to load due to insufficient RAM, but it's NOT fatal.
for(int i=0; i<50; i++) {
// Rather than reader.drawBMP() (which works from SD card),
// a different function is used for RAM-resident images:
img.draw(tft, // Pass in tft object
(int16_t)random(-img.width() , tft.width()) , // Horiz pos.
(int16_t)random(-img.height(), tft.height())); // Vert pos
// Reiterating a prior point: img.draw() does nothing and returns
// if the image failed to load. It's unfortunate but not disastrous.
}
delay(2000); // Pause 2 sec.
}
}

View file

@ -1,150 +0,0 @@
// Adafruit_ImageReader test for Adafruit ST7735 TFT Breakout for Arduino.
// Demonstrates loading images from SD card or flash memory to the screen,
// to RAM, and how to query image file dimensions.
// Requires three BMP files in root directory of SD card:
// parrot.bmp, miniwoof.bmp and wales.bmp.
// As written, this uses the microcontroller's SPI interface for the screen
// (not 'bitbang') and must be wired to specific pins (e.g. for Arduino Uno,
// MOSI = pin 11, MISO = 12, SCK = 13). Other pins are configurable below.
#include <Adafruit_GFX.h> // Core graphics library
#include <Adafruit_ST7735.h> // Hardware-specific library
#include <SdFat_Adafruit_Fork.h> // SD card & FAT filesystem library
#include <Adafruit_SPIFlash.h> // SPI / QSPI flash library
#include <Adafruit_ImageReader.h> // Image-reading functions
// Comment out the next line to load from SPI/QSPI flash instead of SD card:
#define USE_SD_CARD
// TFT display and SD card share the hardware SPI interface, using
// 'select' pins for each to identify the active device on the bus.
#define SD_CS 4 // SD card select pin
#define TFT_CS 10 // TFT select pin
#define TFT_DC 8 // TFT display/command pin
#define TFT_RST 9 // Or set to -1 and connect to Arduino RESET pin
#if defined(USE_SD_CARD)
SdFat SD; // SD card filesystem
Adafruit_ImageReader reader(SD); // Image-reader object, pass in SD filesys
#else
// SPI or QSPI flash filesystem (i.e. CIRCUITPY drive)
#if defined(__SAMD51__) || defined(NRF52840_XXAA)
Adafruit_FlashTransport_QSPI flashTransport(PIN_QSPI_SCK, PIN_QSPI_CS,
PIN_QSPI_IO0, PIN_QSPI_IO1, PIN_QSPI_IO2, PIN_QSPI_IO3);
#else
#if (SPI_INTERFACES_COUNT == 1)
Adafruit_FlashTransport_SPI flashTransport(SS, &SPI);
#else
Adafruit_FlashTransport_SPI flashTransport(SS1, &SPI1);
#endif
#endif
Adafruit_SPIFlash flash(&flashTransport);
FatVolume filesys;
Adafruit_ImageReader reader(filesys); // Image-reader, pass in flash filesys
#endif
Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_RST);
Adafruit_Image img; // An image loaded into RAM
int32_t width = 0, // BMP image dimensions
height = 0;
void setup(void) {
ImageReturnCode stat; // Status from image-reading functions
Serial.begin(9600);
#if !defined(ESP32)
while(!Serial); // Wait for Serial Monitor before continuing
#endif
tft.initR(INITR_BLACKTAB); // Initialize screen
// The Adafruit_ImageReader constructor call (above, before setup())
// accepts an uninitialized SdFat or FatVolume object. This MUST
// BE INITIALIZED before using any of the image reader functions!
Serial.print(F("Initializing filesystem..."));
#if defined(USE_SD_CARD)
// SD card is pretty straightforward, a single call...
if(!SD.begin(SD_CS, SD_SCK_MHZ(10))) { // Breakouts require 10 MHz limit due to longer wires
Serial.println(F("SD begin() failed"));
for(;;); // Fatal error, do not continue
}
#else
// SPI or QSPI flash requires two steps, one to access the bare flash
// memory itself, then the second to access the filesystem within...
if(!flash.begin()) {
Serial.println(F("flash begin() failed"));
for(;;);
}
if(!filesys.begin(&flash)) {
Serial.println(F("filesys begin() failed"));
for(;;);
}
#endif
Serial.println(F("OK!"));
// Fill screen blue. Not a required step, this just shows that we're
// successfully communicating with the screen.
tft.fillScreen(ST7735_BLUE);
// Load full-screen BMP file 'parrot.bmp' at position (0,0) (top left).
// Notice the 'reader' object performs this, with 'tft' as an argument.
Serial.print(F("Loading parrot.bmp to screen..."));
stat = reader.drawBMP("/parrot.bmp", tft, 0, 0);
reader.printStatus(stat); // How'd we do?
// Query the dimensions of image 'miniwoof.bmp' WITHOUT loading to screen:
Serial.print(F("Querying miniwoof.bmp image size..."));
stat = reader.bmpDimensions("/miniwoof.bmp", &width, &height);
reader.printStatus(stat); // How'd we do?
if(stat == IMAGE_SUCCESS) { // If it worked, print image size...
Serial.print(F("Image dimensions: "));
Serial.print(width);
Serial.write('x');
Serial.println(height);
}
// Load small BMP 'wales.bmp' into a GFX canvas in RAM. This should fail
// gracefully on Arduino Uno and other small devices, meaning the image
// will not load, but this won't make the program stop or crash, it just
// continues on without it. Should work on Arduino Mega, Zero, etc.
Serial.print(F("Loading wales.bmp to canvas..."));
stat = reader.loadBMP("/wales.bmp", img);
reader.printStatus(stat); // How'd we do?
delay(2000); // Pause 2 seconds before moving on to loop()
}
void loop() {
for(int r=0; r<4; r++) { // For each of 4 rotations...
tft.setRotation(r); // Set rotation
tft.fillScreen(0); // and clear screen
// Load 4 copies of the 'miniwoof.bmp' image to the screen, some
// partially off screen edges to demonstrate clipping. Globals
// 'width' and 'height' were set by bmpDimensions() call in setup().
for(int i=0; i<4; i++) {
reader.drawBMP("/miniwoof.bmp", tft,
(tft.width() * i / 3) - (width / 2),
(tft.height() * i / 3) - (height / 2));
}
delay(1000); // Pause 1 sec.
// Draw 50 Welsh dragon flags in random positions. This has no effect
// on memory-constrained boards like the Arduino Uno, where the image
// failed to load due to insufficient RAM, but it's NOT fatal.
for(int i=0; i<50; i++) {
// Rather than reader.drawBMP() (which works from SD card),
// a different function is used for RAM-resident images:
img.draw(tft, // Pass in tft object
(int16_t)random(-img.width() , tft.width()) , // Horiz pos.
(int16_t)random(-img.height(), tft.height())); // Vert pos
// Reiterating a prior point: img.draw() does nothing and returns
// if the image failed to load. It's unfortunate but not disastrous.
}
delay(2000); // Pause 2 sec.
}
}

View file

@ -1,154 +0,0 @@
// Adafruit_ImageReader test for Adafruit Mini TFT Breakout for Arduino.
// Demonstrates loading images from SD card or flash memory to the screen,
// to RAM, and how to query image file dimensions.
// OPEN THE ARDUINO SERIAL MONITOR WINDOW TO START PROGRAM.
// Requires three BMP files in root directory of SD card:
// minibot.bmp, rgbwheel.bmp and wales.bmp.
// As written, this uses the microcontroller's SPI interface for the screen
// (not 'bitbang') and must be wired to specific pins (e.g. for Arduino Uno,
// MOSI = pin 11, MISO = 12, SCK = 13). Other pins are configurable below.
#include <Adafruit_GFX.h> // Core graphics library
#include <Adafruit_ST7735.h> // Hardware-specific library
#include <SdFat_Adafruit_Fork.h> // SD card & FAT filesystem library
#include <Adafruit_SPIFlash.h> // SPI / QSPI flash library
#include <Adafruit_ImageReader.h> // Image-reading functions
// TFT display and SD card share the hardware SPI interface, using
// 'select' pins for each to identify the active device on the bus.
// Comment out the next line to load from SPI/QSPI flash instead of SD card:
#define USE_SD_CARD
#define SD_CS 4 // SD card chip select
#define TFT_CS 10 // TFT select pin
#define TFT_DC 8 // TFT data/command pin
#define TFT_RST 9 // Or set to -1 and connect TFT RST to Arduino reset pin
#if defined(USE_SD_CARD)
SdFat SD; // SD card filesystem
Adafruit_ImageReader reader(SD); // Image-reader object, pass in SD filesys
#else
// SPI or QSPI flash filesystem (i.e. CIRCUITPY drive)
#if defined(__SAMD51__) || defined(NRF52840_XXAA)
Adafruit_FlashTransport_QSPI flashTransport(PIN_QSPI_SCK, PIN_QSPI_CS,
PIN_QSPI_IO0, PIN_QSPI_IO1, PIN_QSPI_IO2, PIN_QSPI_IO3);
#else
#if (SPI_INTERFACES_COUNT == 1)
Adafruit_FlashTransport_SPI flashTransport(SS, &SPI);
#else
Adafruit_FlashTransport_SPI flashTransport(SS1, &SPI1);
#endif
#endif
Adafruit_SPIFlash flash(&flashTransport);
FatVolume filesys;
Adafruit_ImageReader reader(filesys); // Image-reader, pass in flash filesys
#endif
Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_RST);
Adafruit_Image img; // An image loaded into RAM
int32_t width = 0, // BMP image dimensions
height = 0;
void setup(void) {
ImageReturnCode stat; // Status from image-reading functions
Serial.begin(9600);
#if !defined(ESP32)
while(!Serial); // Wait for Serial Monitor before continuing
#endif
tft.initR(INITR_MINI160x80); // Initialize screen
Serial.println(F("TFT initialized."));
// The Adafruit_ImageReader constructor call (above, before setup())
// accepts an uninitialized SdFat or FatVolume object. This MUST
// BE INITIALIZED before using any of the image reader functions!
Serial.print(F("Initializing filesystem..."));
#if defined(USE_SD_CARD)
// SD card is pretty straightforward, a single call...
if(!SD.begin(SD_CS, SD_SCK_MHZ(10))) { // Breakouts require 10 MHz limit due to longer wires
Serial.println(F("SD begin() failed"));
for(;;); // Fatal error, do not continue
}
#else
// SPI or QSPI flash requires two steps, one to access the bare flash
// memory itself, then the second to access the filesystem within...
if(!flash.begin()) {
Serial.println(F("flash begin() failed"));
for(;;);
}
if(!filesys.begin(&flash)) {
Serial.println(F("filesys begin() failed"));
for(;;);
}
#endif
Serial.println(F("OK!"));
// Fill screen blue. Not a required step, this just shows that we're
// successfully communicating with the screen.
tft.fillScreen(ST77XX_BLUE);
// Load full-screen BMP file 'minibot.bmp' at position (0,0) (top left).
// Notice the 'reader' object performs this, with 'tft' as an argument.
Serial.print(F("Loading minibot.bmp to screen..."));
stat = reader.drawBMP("/minibot.bmp", tft, 0, 0);
// (Absolute path isn't necessary on most devices, but something
// with the ESP32 SD library seems to require it.)
reader.printStatus(stat); // How'd we do?
// Query the dimensions of image 'rgbwheel.bmp' WITHOUT loading to screen:
Serial.print(F("Querying rgbwheel.bmp image size..."));
stat = reader.bmpDimensions("/rgbwheel.bmp", &width, &height);
reader.printStatus(stat); // How'd we do?
if(stat == IMAGE_SUCCESS) { // If it worked, print image size...
Serial.print(F("Image dimensions: "));
Serial.print(width);
Serial.write('x');
Serial.println(height);
}
// Load small BMP 'wales.bmp' into a GFX canvas in RAM. This should
// fail gracefully on AVR and other small devices, meaning the image
// will not load, but this won't make the program stop or crash, it
// just continues on without it.
Serial.print(F("Loading wales.bmp to canvas..."));
stat = reader.loadBMP("/wales.bmp", img);
reader.printStatus(stat); // How'd we do?
delay(2000); // Pause 2 seconds before moving on to loop()
}
void loop() {
for(int r=0; r<4; r++) { // For each of 4 rotations...
tft.setRotation(r); // Set rotation
tft.fillScreen(0); // and clear screen
// Load 4 copies of the 'rgbwheel.bmp' image to the screen, some
// partially off screen edges to demonstrate clipping. Globals
// 'width' and 'height' were set by bmpDimensions() call in setup().
for(int i=0; i<4; i++) {
reader.drawBMP("/rgbwheel.bmp", tft,
(tft.width() * i / 3) - (width / 2),
(tft.height() * i / 3) - (height / 2));
}
delay(1000); // Pause 1 sec.
// Draw 50 Welsh dragon flags in random positions. This has no effect
// on memory-constrained boards like the Arduino Uno, where the image
// failed to load due to insufficient RAM, but it's NOT fatal.
for(int i=0; i<50; i++) {
// Rather than reader.drawBMP() (which works from SD card),
// a different function is used for RAM-resident images:
img.draw(tft, // Pass in tft object
(int16_t)random(-img.width() , tft.width()) , // Horiz pos.
(int16_t)random(-img.height(), tft.height())); // Vert pos
// Reiterating a prior point: img.draw() does nothing and returns
// if the image failed to load. It's unfortunate but not disastrous.
}
delay(2000); // Pause 2 sec.
}
}

View file

@ -1,149 +0,0 @@
// Adafruit_ImageReader test for Adafruit ST7789 320x240 TFT Breakout for Arduino.
// Demonstrates loading images to the screen, to RAM, and how to query
// image file dimensions.
// Requires three BMP files in root directory of SD card:
// parrot.bmp, miniwoof.bmp and wales.bmp.
// As written, this uses the microcontroller's SPI interface for the screen
// (not 'bitbang') and must be wired to specific pins (e.g. for Arduino Uno,
// MOSI = pin 11, MISO = 12, SCK = 13). Other pins are configurable below.
#include <Adafruit_GFX.h> // Core graphics library
#include <Adafruit_ST7789.h> // Hardware-specific library for ST7789
#include <SdFat_Adafruit_Fork.h> // SD card & FAT filesystem library
#include <Adafruit_SPIFlash.h> // SPI / QSPI flash library
#include <Adafruit_ImageReader.h> // Image-reading functions
// Comment out the next line to load from SPI/QSPI flash instead of SD card:
#define USE_SD_CARD
// TFT display and SD card share the hardware SPI interface, using
// 'select' pins for each to identify the active device on the bus.
#define SD_CS 4 // SD card select pin
#define TFT_CS 10 // TFT select pin
#define TFT_DC 8 // TFT display/command pin
#define TFT_RST 9 // Or set to -1 and connect to Arduino RESET pin
#if defined(USE_SD_CARD)
SdFat SD; // SD card filesystem
Adafruit_ImageReader reader(SD); // Image-reader object, pass in SD filesys
#else
// SPI or QSPI flash filesystem (i.e. CIRCUITPY drive)
#if defined(__SAMD51__) || defined(NRF52840_XXAA)
Adafruit_FlashTransport_QSPI flashTransport(PIN_QSPI_SCK, PIN_QSPI_CS,
PIN_QSPI_IO0, PIN_QSPI_IO1, PIN_QSPI_IO2, PIN_QSPI_IO3);
#else
#if (SPI_INTERFACES_COUNT == 1)
Adafruit_FlashTransport_SPI flashTransport(SS, &SPI);
#else
Adafruit_FlashTransport_SPI flashTransport(SS1, &SPI1);
#endif
#endif
Adafruit_SPIFlash flash(&flashTransport);
FatFileSystem filesys;
Adafruit_ImageReader reader(filesys); // Image-reader, pass in flash filesys
#endif
Adafruit_ST7789 tft = Adafruit_ST7789(TFT_CS, TFT_DC, TFT_RST);
Adafruit_Image img; // An image loaded into RAM
int32_t width = 0, // BMP image dimensions
height = 0;
void setup(void) {
ImageReturnCode stat; // Status from image-reading functions
Serial.begin(9600);
while(!Serial); // Wait for Serial Monitor before continuing
tft.init(170, 320); // Init ST7789 170x320
// The Adafruit_ImageReader constructor call (above, before setup())
// accepts an uninitialized SdFat or FatFileSystem object. This MUST
// BE INITIALIZED before using any of the image reader functions!
Serial.print(F("Initializing filesystem..."));
#if defined(USE_SD_CARD)
// SD card is pretty straightforward, a single call...
if(!SD.begin(SD_CS, SD_SCK_MHZ(10))) { // Breakouts require 10 MHz limit due to longer wires
Serial.println(F("SD begin() failed"));
for(;;); // Fatal error, do not continue
}
#else
// SPI or QSPI flash requires two steps, one to access the bare flash
// memory itself, then the second to access the filesystem within...
if(!flash.begin()) {
Serial.println(F("flash begin() failed"));
for(;;);
}
if(!filesys.begin(&flash)) {
Serial.println(F("filesys begin() failed"));
for(;;);
}
#endif
Serial.println(F("OK!"));
// Fill screen blue. Not a required step, this just shows that we're
// successfully communicating with the screen.
tft.fillScreen(ST77XX_BLUE);
tft.setRotation(3);
// Load full-screen BMP file 'adabot.bmp' at position (0,0) (top left).
// Notice the 'reader' object performs this, with 'tft' as an argument.
Serial.print(F("Loading adabot.bmp to screen..."));
stat = reader.drawBMP("/adabot.bmp", tft, 0, 0);
reader.printStatus(stat); // How'd we do?
// Query the dimensions of image 'miniwoof.bmp' WITHOUT loading to screen:
Serial.print(F("Querying miniwoof.bmp image size..."));
stat = reader.bmpDimensions("/miniwoof.bmp", &width, &height);
reader.printStatus(stat); // How'd we do?
if(stat == IMAGE_SUCCESS) { // If it worked, print image size...
Serial.print(F("Image dimensions: "));
Serial.print(width);
Serial.write('x');
Serial.println(height);
}
// Load small BMP 'wales.bmp' into a GFX canvas in RAM. This should fail
// gracefully on Arduino Uno and other small devices, meaning the image
// will not load, but this won't make the program stop or crash, it just
// continues on without it. Should work on Arduino Mega, Zero, etc.
Serial.print(F("Loading wales.bmp to canvas..."));
stat = reader.loadBMP("/wales.bmp", img);
reader.printStatus(stat); // How'd we do?
delay(2000); // Pause 2 seconds before moving on to loop()
}
void loop() {
for(int r=0; r<4; r++) { // For each of 4 rotations...
tft.setRotation(r); // Set rotation
tft.fillScreen(0); // and clear screen
// Load 4 copies of the 'miniwoof.bmp' image to the screen, some
// partially off screen edges to demonstrate clipping. Globals
// 'width' and 'height' were set by bmpDimensions() call in setup().
for(int i=0; i<4; i++) {
reader.drawBMP("/miniwoof.bmp", tft,
(tft.width() * i / 3) - (width / 2),
(tft.height() * i / 3) - (height / 2));
}
delay(1000); // Pause 1 sec.
// Draw 50 Welsh dragon flags in random positions. This has no effect
// on memory-constrained boards like the Arduino Uno, where the image
// failed to load due to insufficient RAM, but it's NOT fatal.
for(int i=0; i<50; i++) {
// Rather than reader.drawBMP() (which works from SD card),
// a different function is used for RAM-resident images:
img.draw(tft, // Pass in tft object
(int16_t)random(-img.width() , tft.width()) , // Horiz pos.
(int16_t)random(-img.height(), tft.height())); // Vert pos
// Reiterating a prior point: img.draw() does nothing and returns
// if the image failed to load. It's unfortunate but not disastrous.
}
delay(2000); // Pause 2 sec.
}
}

View file

@ -1,149 +0,0 @@
// Adafruit_ImageReader test for Adafruit ST7789 320x240 TFT Breakout for Arduino.
// Demonstrates loading images to the screen, to RAM, and how to query
// image file dimensions.
// Requires three BMP files in root directory of SD card:
// parrot.bmp, miniwoof.bmp and wales.bmp.
// As written, this uses the microcontroller's SPI interface for the screen
// (not 'bitbang') and must be wired to specific pins (e.g. for Arduino Uno,
// MOSI = pin 11, MISO = 12, SCK = 13). Other pins are configurable below.
#include <Adafruit_GFX.h> // Core graphics library
#include <Adafruit_ST7789.h> // Hardware-specific library for ST7789
#include <SdFat_Adafruit_Fork.h> // SD card & FAT filesystem library
#include <Adafruit_SPIFlash.h> // SPI / QSPI flash library
#include <Adafruit_ImageReader.h> // Image-reading functions
// Comment out the next line to load from SPI/QSPI flash instead of SD card:
#define USE_SD_CARD
// TFT display and SD card share the hardware SPI interface, using
// 'select' pins for each to identify the active device on the bus.
#define SD_CS 4 // SD card select pin
#define TFT_CS 10 // TFT select pin
#define TFT_DC 8 // TFT display/command pin
#define TFT_RST 9 // Or set to -1 and connect to Arduino RESET pin
#if defined(USE_SD_CARD)
SdFat SD; // SD card filesystem
Adafruit_ImageReader reader(SD); // Image-reader object, pass in SD filesys
#else
// SPI or QSPI flash filesystem (i.e. CIRCUITPY drive)
#if defined(__SAMD51__) || defined(NRF52840_XXAA)
Adafruit_FlashTransport_QSPI flashTransport(PIN_QSPI_SCK, PIN_QSPI_CS,
PIN_QSPI_IO0, PIN_QSPI_IO1, PIN_QSPI_IO2, PIN_QSPI_IO3);
#else
#if (SPI_INTERFACES_COUNT == 1)
Adafruit_FlashTransport_SPI flashTransport(SS, &SPI);
#else
Adafruit_FlashTransport_SPI flashTransport(SS1, &SPI1);
#endif
#endif
Adafruit_SPIFlash flash(&flashTransport);
FatFileSystem filesys;
Adafruit_ImageReader reader(filesys); // Image-reader, pass in flash filesys
#endif
Adafruit_ST7789 tft = Adafruit_ST7789(TFT_CS, TFT_DC, TFT_RST);
Adafruit_Image img; // An image loaded into RAM
int32_t width = 0, // BMP image dimensions
height = 0;
void setup(void) {
ImageReturnCode stat; // Status from image-reading functions
Serial.begin(9600);
while(!Serial); // Wait for Serial Monitor before continuing
tft.init(172, 320); // Init ST7789 172x320
// The Adafruit_ImageReader constructor call (above, before setup())
// accepts an uninitialized SdFat or FatFileSystem object. This MUST
// BE INITIALIZED before using any of the image reader functions!
Serial.print(F("Initializing filesystem..."));
#if defined(USE_SD_CARD)
// SD card is pretty straightforward, a single call...
if(!SD.begin(SD_CS, SD_SCK_MHZ(10))) { // Breakouts require 10 MHz limit due to longer wires
Serial.println(F("SD begin() failed"));
for(;;); // Fatal error, do not continue
}
#else
// SPI or QSPI flash requires two steps, one to access the bare flash
// memory itself, then the second to access the filesystem within...
if(!flash.begin()) {
Serial.println(F("flash begin() failed"));
for(;;);
}
if(!filesys.begin(&flash)) {
Serial.println(F("filesys begin() failed"));
for(;;);
}
#endif
Serial.println(F("OK!"));
// Fill screen blue. Not a required step, this just shows that we're
// successfully communicating with the screen.
tft.fillScreen(ST77XX_BLUE);
tft.setRotation(3);
// Load full-screen BMP file 'adabot.bmp' at position (0,0) (top left).
// Notice the 'reader' object performs this, with 'tft' as an argument.
Serial.print(F("Loading adabot.bmp to screen..."));
stat = reader.drawBMP("/adabot.bmp", tft, 0, 0);
reader.printStatus(stat); // How'd we do?
// Query the dimensions of image 'miniwoof.bmp' WITHOUT loading to screen:
Serial.print(F("Querying miniwoof.bmp image size..."));
stat = reader.bmpDimensions("/miniwoof.bmp", &width, &height);
reader.printStatus(stat); // How'd we do?
if(stat == IMAGE_SUCCESS) { // If it worked, print image size...
Serial.print(F("Image dimensions: "));
Serial.print(width);
Serial.write('x');
Serial.println(height);
}
// Load small BMP 'wales.bmp' into a GFX canvas in RAM. This should fail
// gracefully on Arduino Uno and other small devices, meaning the image
// will not load, but this won't make the program stop or crash, it just
// continues on without it. Should work on Arduino Mega, Zero, etc.
Serial.print(F("Loading wales.bmp to canvas..."));
stat = reader.loadBMP("/wales.bmp", img);
reader.printStatus(stat); // How'd we do?
delay(2000); // Pause 2 seconds before moving on to loop()
}
void loop() {
for(int r=0; r<4; r++) { // For each of 4 rotations...
tft.setRotation(r); // Set rotation
tft.fillScreen(0); // and clear screen
// Load 4 copies of the 'miniwoof.bmp' image to the screen, some
// partially off screen edges to demonstrate clipping. Globals
// 'width' and 'height' were set by bmpDimensions() call in setup().
for(int i=0; i<4; i++) {
reader.drawBMP("/miniwoof.bmp", tft,
(tft.width() * i / 3) - (width / 2),
(tft.height() * i / 3) - (height / 2));
}
delay(1000); // Pause 1 sec.
// Draw 50 Welsh dragon flags in random positions. This has no effect
// on memory-constrained boards like the Arduino Uno, where the image
// failed to load due to insufficient RAM, but it's NOT fatal.
for(int i=0; i<50; i++) {
// Rather than reader.drawBMP() (which works from SD card),
// a different function is used for RAM-resident images:
img.draw(tft, // Pass in tft object
(int16_t)random(-img.width() , tft.width()) , // Horiz pos.
(int16_t)random(-img.height(), tft.height())); // Vert pos
// Reiterating a prior point: img.draw() does nothing and returns
// if the image failed to load. It's unfortunate but not disastrous.
}
delay(2000); // Pause 2 sec.
}
}

View file

@ -1,149 +0,0 @@
// Adafruit_ImageReader test for Adafruit ST7789 320x240 TFT Breakout for Arduino.
// Demonstrates loading images to the screen, to RAM, and how to query
// image file dimensions.
// Requires three BMP files in root directory of SD card:
// parrot.bmp, miniwoof.bmp and wales.bmp.
// As written, this uses the microcontroller's SPI interface for the screen
// (not 'bitbang') and must be wired to specific pins (e.g. for Arduino Uno,
// MOSI = pin 11, MISO = 12, SCK = 13). Other pins are configurable below.
#include <Adafruit_GFX.h> // Core graphics library
#include <Adafruit_ST7789.h> // Hardware-specific library for ST7789
#include <SdFat_Adafruit_Fork.h> // SD card & FAT filesystem library
#include <Adafruit_SPIFlash.h> // SPI / QSPI flash library
#include <Adafruit_ImageReader.h> // Image-reading functions
// Comment out the next line to load from SPI/QSPI flash instead of SD card:
#define USE_SD_CARD
// TFT display and SD card share the hardware SPI interface, using
// 'select' pins for each to identify the active device on the bus.
#define SD_CS 4 // SD card select pin
#define TFT_CS 10 // TFT select pin
#define TFT_DC 8 // TFT display/command pin
#define TFT_RST 9 // Or set to -1 and connect to Arduino RESET pin
#if defined(USE_SD_CARD)
SdFat SD; // SD card filesystem
Adafruit_ImageReader reader(SD); // Image-reader object, pass in SD filesys
#else
// SPI or QSPI flash filesystem (i.e. CIRCUITPY drive)
#if defined(__SAMD51__) || defined(NRF52840_XXAA)
Adafruit_FlashTransport_QSPI flashTransport(PIN_QSPI_SCK, PIN_QSPI_CS,
PIN_QSPI_IO0, PIN_QSPI_IO1, PIN_QSPI_IO2, PIN_QSPI_IO3);
#else
#if (SPI_INTERFACES_COUNT == 1)
Adafruit_FlashTransport_SPI flashTransport(SS, &SPI);
#else
Adafruit_FlashTransport_SPI flashTransport(SS1, &SPI1);
#endif
#endif
Adafruit_SPIFlash flash(&flashTransport);
FatFileSystem filesys;
Adafruit_ImageReader reader(filesys); // Image-reader, pass in flash filesys
#endif
Adafruit_ST7789 tft = Adafruit_ST7789(TFT_CS, TFT_DC, TFT_RST);
Adafruit_Image img; // An image loaded into RAM
int32_t width = 0, // BMP image dimensions
height = 0;
void setup(void) {
ImageReturnCode stat; // Status from image-reading functions
Serial.begin(9600);
while(!Serial); // Wait for Serial Monitor before continuing
tft.init(135, 240); // Init ST7789 172x320
// The Adafruit_ImageReader constructor call (above, before setup())
// accepts an uninitialized SdFat or FatFileSystem object. This MUST
// BE INITIALIZED before using any of the image reader functions!
Serial.print(F("Initializing filesystem..."));
#if defined(USE_SD_CARD)
// SD card is pretty straightforward, a single call...
if(!SD.begin(SD_CS, SD_SCK_MHZ(10))) { // Breakouts require 10 MHz limit due to longer wires
Serial.println(F("SD begin() failed"));
for(;;); // Fatal error, do not continue
}
#else
// SPI or QSPI flash requires two steps, one to access the bare flash
// memory itself, then the second to access the filesystem within...
if(!flash.begin()) {
Serial.println(F("flash begin() failed"));
for(;;);
}
if(!filesys.begin(&flash)) {
Serial.println(F("filesys begin() failed"));
for(;;);
}
#endif
Serial.println(F("OK!"));
// Fill screen blue. Not a required step, this just shows that we're
// successfully communicating with the screen.
tft.fillScreen(ST77XX_BLUE);
tft.setRotation(3);
// Load full-screen BMP file 'adabot.bmp' at position (0,0) (top left).
// Notice the 'reader' object performs this, with 'tft' as an argument.
Serial.print(F("Loading adabot.bmp to screen..."));
stat = reader.drawBMP("/adabot.bmp", tft, 0, 0);
reader.printStatus(stat); // How'd we do?
// Query the dimensions of image 'miniwoof.bmp' WITHOUT loading to screen:
Serial.print(F("Querying miniwoof.bmp image size..."));
stat = reader.bmpDimensions("/miniwoof.bmp", &width, &height);
reader.printStatus(stat); // How'd we do?
if(stat == IMAGE_SUCCESS) { // If it worked, print image size...
Serial.print(F("Image dimensions: "));
Serial.print(width);
Serial.write('x');
Serial.println(height);
}
// Load small BMP 'wales.bmp' into a GFX canvas in RAM. This should fail
// gracefully on Arduino Uno and other small devices, meaning the image
// will not load, but this won't make the program stop or crash, it just
// continues on without it. Should work on Arduino Mega, Zero, etc.
Serial.print(F("Loading wales.bmp to canvas..."));
stat = reader.loadBMP("/wales.bmp", img);
reader.printStatus(stat); // How'd we do?
delay(2000); // Pause 2 seconds before moving on to loop()
}
void loop() {
for(int r=0; r<4; r++) { // For each of 4 rotations...
tft.setRotation(r); // Set rotation
tft.fillScreen(0); // and clear screen
// Load 4 copies of the 'miniwoof.bmp' image to the screen, some
// partially off screen edges to demonstrate clipping. Globals
// 'width' and 'height' were set by bmpDimensions() call in setup().
for(int i=0; i<4; i++) {
reader.drawBMP("/miniwoof.bmp", tft,
(tft.width() * i / 3) - (width / 2),
(tft.height() * i / 3) - (height / 2));
}
delay(1000); // Pause 1 sec.
// Draw 50 Welsh dragon flags in random positions. This has no effect
// on memory-constrained boards like the Arduino Uno, where the image
// failed to load due to insufficient RAM, but it's NOT fatal.
for(int i=0; i<50; i++) {
// Rather than reader.drawBMP() (which works from SD card),
// a different function is used for RAM-resident images:
img.draw(tft, // Pass in tft object
(int16_t)random(-img.width() , tft.width()) , // Horiz pos.
(int16_t)random(-img.height(), tft.height())); // Vert pos
// Reiterating a prior point: img.draw() does nothing and returns
// if the image failed to load. It's unfortunate but not disastrous.
}
delay(2000); // Pause 2 sec.
}
}

View file

@ -1,148 +0,0 @@
// Adafruit_ImageReader test for Adafruit ST7789 320x240 TFT Breakout for Arduino.
// Demonstrates loading images to the screen, to RAM, and how to query
// image file dimensions.
// Requires three BMP files in root directory of SD card:
// adabot.bmp, miniwoof.bmp and wales.bmp.
// As written, this uses the microcontroller's SPI interface for the screen
// (not 'bitbang') and must be wired to specific pins (e.g. for Arduino Uno,
// MOSI = pin 11, MISO = 12, SCK = 13). Other pins are configurable below.
#include <Adafruit_GFX.h> // Core graphics library
#include <Adafruit_ST7789.h> // Hardware-specific library for ST7789
#include <SdFat_Adafruit_Fork.h> // SD card & FAT filesystem library
#include <Adafruit_SPIFlash.h> // SPI / QSPI flash library
#include <Adafruit_ImageReader.h> // Image-reading functions
// Comment out the next line to load from SPI/QSPI flash instead of SD card:
#define USE_SD_CARD
// TFT display and SD card share the hardware SPI interface, using
// 'select' pins for each to identify the active device on the bus.
#define SD_CS 4 // SD card select pin
#define TFT_CS 10 // TFT select pin
#define TFT_DC 8 // TFT display/command pin
#define TFT_RST 9 // Or set to -1 and connect to Arduino RESET pin
#if defined(USE_SD_CARD)
SdFat SD; // SD card filesystem
Adafruit_ImageReader reader(SD); // Image-reader object, pass in SD filesys
#else
// SPI or QSPI flash filesystem (i.e. CIRCUITPY drive)
#if defined(__SAMD51__) || defined(NRF52840_XXAA)
Adafruit_FlashTransport_QSPI flashTransport(PIN_QSPI_SCK, PIN_QSPI_CS,
PIN_QSPI_IO0, PIN_QSPI_IO1, PIN_QSPI_IO2, PIN_QSPI_IO3);
#else
#if (SPI_INTERFACES_COUNT == 1)
Adafruit_FlashTransport_SPI flashTransport(SS, &SPI);
#else
Adafruit_FlashTransport_SPI flashTransport(SS1, &SPI1);
#endif
#endif
Adafruit_SPIFlash flash(&flashTransport);
FatFileSystem filesys;
Adafruit_ImageReader reader(filesys); // Image-reader, pass in flash filesys
#endif
Adafruit_ST7789 tft = Adafruit_ST7789(TFT_CS, TFT_DC, TFT_RST);
Adafruit_Image img; // An image loaded into RAM
int32_t width = 0, // BMP image dimensions
height = 0;
void setup(void) {
ImageReturnCode stat; // Status from image-reading functions
Serial.begin(9600);
while(!Serial); // Wait for Serial Monitor before continuing
tft.init(240, 240); // Init ST7789 172x320
// The Adafruit_ImageReader constructor call (above, before setup())
// accepts an uninitialized SdFat or FatFileSystem object. This MUST
// BE INITIALIZED before using any of the image reader functions!
Serial.print(F("Initializing filesystem..."));
#if defined(USE_SD_CARD)
// SD card is pretty straightforward, a single call...
if(!SD.begin(SD_CS, SD_SCK_MHZ(10))) { // Breakouts require 10 MHz limit due to longer wires
Serial.println(F("SD begin() failed"));
for(;;); // Fatal error, do not continue
}
#else
// SPI or QSPI flash requires two steps, one to access the bare flash
// memory itself, then the second to access the filesystem within...
if(!flash.begin()) {
Serial.println(F("flash begin() failed"));
for(;;);
}
if(!filesys.begin(&flash)) {
Serial.println(F("filesys begin() failed"));
for(;;);
}
#endif
Serial.println(F("OK!"));
// Fill screen blue. Not a required step, this just shows that we're
// successfully communicating with the screen.
tft.fillScreen(ST77XX_BLUE);
// Load full-screen BMP file 'adabot.bmp' at position (0,0) (top left).
// Notice the 'reader' object performs this, with 'tft' as an argument.
Serial.print(F("Loading adabot.bmp to screen..."));
stat = reader.drawBMP("/adabot.bmp", tft, 0, 0);
reader.printStatus(stat); // How'd we do?
// Query the dimensions of image 'miniwoof.bmp' WITHOUT loading to screen:
Serial.print(F("Querying miniwoof.bmp image size..."));
stat = reader.bmpDimensions("/miniwoof.bmp", &width, &height);
reader.printStatus(stat); // How'd we do?
if(stat == IMAGE_SUCCESS) { // If it worked, print image size...
Serial.print(F("Image dimensions: "));
Serial.print(width);
Serial.write('x');
Serial.println(height);
}
// Load small BMP 'wales.bmp' into a GFX canvas in RAM. This should fail
// gracefully on Arduino Uno and other small devices, meaning the image
// will not load, but this won't make the program stop or crash, it just
// continues on without it. Should work on Arduino Mega, Zero, etc.
Serial.print(F("Loading wales.bmp to canvas..."));
stat = reader.loadBMP("/wales.bmp", img);
reader.printStatus(stat); // How'd we do?
delay(2000); // Pause 2 seconds before moving on to loop()
}
void loop() {
for(int r=0; r<4; r++) { // For each of 4 rotations...
tft.setRotation(r); // Set rotation
tft.fillScreen(0); // and clear screen
// Load 4 copies of the 'miniwoof.bmp' image to the screen, some
// partially off screen edges to demonstrate clipping. Globals
// 'width' and 'height' were set by bmpDimensions() call in setup().
for(int i=0; i<4; i++) {
reader.drawBMP("/miniwoof.bmp", tft,
(tft.width() * i / 3) - (width / 2),
(tft.height() * i / 3) - (height / 2));
}
delay(1000); // Pause 1 sec.
// Draw 50 Welsh dragon flags in random positions. This has no effect
// on memory-constrained boards like the Arduino Uno, where the image
// failed to load due to insufficient RAM, but it's NOT fatal.
for(int i=0; i<50; i++) {
// Rather than reader.drawBMP() (which works from SD card),
// a different function is used for RAM-resident images:
img.draw(tft, // Pass in tft object
(int16_t)random(-img.width() , tft.width()) , // Horiz pos.
(int16_t)random(-img.height(), tft.height())); // Vert pos
// Reiterating a prior point: img.draw() does nothing and returns
// if the image failed to load. It's unfortunate but not disastrous.
}
delay(2000); // Pause 2 sec.
}
}

View file

@ -1,148 +0,0 @@
// Adafruit_ImageReader test for Adafruit ST7789 320x240 TFT Breakout for Arduino.
// Demonstrates loading images to the screen, to RAM, and how to query
// image file dimensions.
// Requires three BMP files in root directory of SD card:
// parrot.bmp, miniwoof.bmp and wales.bmp.
// As written, this uses the microcontroller's SPI interface for the screen
// (not 'bitbang') and must be wired to specific pins (e.g. for Arduino Uno,
// MOSI = pin 11, MISO = 12, SCK = 13). Other pins are configurable below.
#include <Adafruit_GFX.h> // Core graphics library
#include <Adafruit_ST7789.h> // Hardware-specific library for ST7789
#include <SdFat_Adafruit_Fork.h> // SD card & FAT filesystem library
#include <Adafruit_SPIFlash.h> // SPI / QSPI flash library
#include <Adafruit_ImageReader.h> // Image-reading functions
// Comment out the next line to load from SPI/QSPI flash instead of SD card:
#define USE_SD_CARD
// TFT display and SD card share the hardware SPI interface, using
// 'select' pins for each to identify the active device on the bus.
#define SD_CS 4 // SD card select pin
#define TFT_CS 10 // TFT select pin
#define TFT_DC 8 // TFT display/command pin
#define TFT_RST 9 // Or set to -1 and connect to Arduino RESET pin
#if defined(USE_SD_CARD)
SdFat SD; // SD card filesystem
Adafruit_ImageReader reader(SD); // Image-reader object, pass in SD filesys
#else
// SPI or QSPI flash filesystem (i.e. CIRCUITPY drive)
#if defined(__SAMD51__) || defined(NRF52840_XXAA)
Adafruit_FlashTransport_QSPI flashTransport(PIN_QSPI_SCK, PIN_QSPI_CS,
PIN_QSPI_IO0, PIN_QSPI_IO1, PIN_QSPI_IO2, PIN_QSPI_IO3);
#else
#if (SPI_INTERFACES_COUNT == 1)
Adafruit_FlashTransport_SPI flashTransport(SS, &SPI);
#else
Adafruit_FlashTransport_SPI flashTransport(SS1, &SPI1);
#endif
#endif
Adafruit_SPIFlash flash(&flashTransport);
FatFileSystem filesys;
Adafruit_ImageReader reader(filesys); // Image-reader, pass in flash filesys
#endif
Adafruit_ST7789 tft = Adafruit_ST7789(TFT_CS, TFT_DC, TFT_RST);
Adafruit_Image img; // An image loaded into RAM
int32_t width = 0, // BMP image dimensions
height = 0;
void setup(void) {
ImageReturnCode stat; // Status from image-reading functions
Serial.begin(9600);
while(!Serial); // Wait for Serial Monitor before continuing
tft.init(240, 280); // Init ST7789 172x320
// The Adafruit_ImageReader constructor call (above, before setup())
// accepts an uninitialized SdFat or FatFileSystem object. This MUST
// BE INITIALIZED before using any of the image reader functions!
Serial.print(F("Initializing filesystem..."));
#if defined(USE_SD_CARD)
// SD card is pretty straightforward, a single call...
if(!SD.begin(SD_CS, SD_SCK_MHZ(10))) { // Breakouts require 10 MHz limit due to longer wires
Serial.println(F("SD begin() failed"));
for(;;); // Fatal error, do not continue
}
#else
// SPI or QSPI flash requires two steps, one to access the bare flash
// memory itself, then the second to access the filesystem within...
if(!flash.begin()) {
Serial.println(F("flash begin() failed"));
for(;;);
}
if(!filesys.begin(&flash)) {
Serial.println(F("filesys begin() failed"));
for(;;);
}
#endif
Serial.println(F("OK!"));
// Fill screen blue. Not a required step, this just shows that we're
// successfully communicating with the screen.
tft.fillScreen(ST77XX_BLUE);
// Load full-screen BMP file 'adabot.bmp' at position (0,0) (top left).
// Notice the 'reader' object performs this, with 'tft' as an argument.
Serial.print(F("Loading adabot.bmp to screen..."));
stat = reader.drawBMP("/adabot.bmp", tft, 0, 0);
reader.printStatus(stat); // How'd we do?
// Query the dimensions of image 'miniwoof.bmp' WITHOUT loading to screen:
Serial.print(F("Querying miniwoof.bmp image size..."));
stat = reader.bmpDimensions("/miniwoof.bmp", &width, &height);
reader.printStatus(stat); // How'd we do?
if(stat == IMAGE_SUCCESS) { // If it worked, print image size...
Serial.print(F("Image dimensions: "));
Serial.print(width);
Serial.write('x');
Serial.println(height);
}
// Load small BMP 'wales.bmp' into a GFX canvas in RAM. This should fail
// gracefully on Arduino Uno and other small devices, meaning the image
// will not load, but this won't make the program stop or crash, it just
// continues on without it. Should work on Arduino Mega, Zero, etc.
Serial.print(F("Loading wales.bmp to canvas..."));
stat = reader.loadBMP("/wales.bmp", img);
reader.printStatus(stat); // How'd we do?
delay(2000); // Pause 2 seconds before moving on to loop()
}
void loop() {
for(int r=0; r<4; r++) { // For each of 4 rotations...
tft.setRotation(r); // Set rotation
tft.fillScreen(0); // and clear screen
// Load 4 copies of the 'miniwoof.bmp' image to the screen, some
// partially off screen edges to demonstrate clipping. Globals
// 'width' and 'height' were set by bmpDimensions() call in setup().
for(int i=0; i<4; i++) {
reader.drawBMP("/miniwoof.bmp", tft,
(tft.width() * i / 3) - (width / 2),
(tft.height() * i / 3) - (height / 2));
}
delay(1000); // Pause 1 sec.
// Draw 50 Welsh dragon flags in random positions. This has no effect
// on memory-constrained boards like the Arduino Uno, where the image
// failed to load due to insufficient RAM, but it's NOT fatal.
for(int i=0; i<50; i++) {
// Rather than reader.drawBMP() (which works from SD card),
// a different function is used for RAM-resident images:
img.draw(tft, // Pass in tft object
(int16_t)random(-img.width() , tft.width()) , // Horiz pos.
(int16_t)random(-img.height(), tft.height())); // Vert pos
// Reiterating a prior point: img.draw() does nothing and returns
// if the image failed to load. It's unfortunate but not disastrous.
}
delay(2000); // Pause 2 sec.
}
}

View file

@ -1,150 +0,0 @@
// Adafruit_ImageReader test for Adafruit ST7789 320x240 TFT Breakout for Arduino.
// Demonstrates loading images to the screen, to RAM, and how to query
// image file dimensions.
// Requires three BMP files in root directory of SD card:
// parrot.bmp, miniwoof.bmp and wales.bmp.
// As written, this uses the microcontroller's SPI interface for the screen
// (not 'bitbang') and must be wired to specific pins (e.g. for Arduino Uno,
// MOSI = pin 11, MISO = 12, SCK = 13). Other pins are configurable below.
#include <Adafruit_GFX.h> // Core graphics library
#include <Adafruit_ST7789.h> // Hardware-specific library for ST7789
#include <SdFat_Adafruit_Fork.h> // SD card & FAT filesystem library
#include <Adafruit_SPIFlash.h> // SPI / QSPI flash library
#include <Adafruit_ImageReader.h> // Image-reading functions
// Comment out the next line to load from SPI/QSPI flash instead of SD card:
#define USE_SD_CARD
// TFT display and SD card share the hardware SPI interface, using
// 'select' pins for each to identify the active device on the bus.
#define SD_CS 4 // SD card select pin
#define TFT_CS 10 // TFT select pin
#define TFT_DC 8 // TFT display/command pin
#define TFT_RST 9 // Or set to -1 and connect to Arduino RESET pin
#if defined(USE_SD_CARD)
SdFat SD; // SD card filesystem
Adafruit_ImageReader reader(SD); // Image-reader object, pass in SD filesys
#else
// SPI or QSPI flash filesystem (i.e. CIRCUITPY drive)
#if defined(__SAMD51__) || defined(NRF52840_XXAA)
Adafruit_FlashTransport_QSPI flashTransport(PIN_QSPI_SCK, PIN_QSPI_CS,
PIN_QSPI_IO0, PIN_QSPI_IO1, PIN_QSPI_IO2, PIN_QSPI_IO3);
#else
#if (SPI_INTERFACES_COUNT == 1)
Adafruit_FlashTransport_SPI flashTransport(SS, &SPI);
#else
Adafruit_FlashTransport_SPI flashTransport(SS1, &SPI1);
#endif
#endif
Adafruit_SPIFlash flash(&flashTransport);
FatVolume filesys;
Adafruit_ImageReader reader(filesys); // Image-reader, pass in flash filesys
#endif
Adafruit_ST7789 tft = Adafruit_ST7789(TFT_CS, TFT_DC, TFT_RST);
Adafruit_Image img; // An image loaded into RAM
int32_t width = 0, // BMP image dimensions
height = 0;
void setup(void) {
ImageReturnCode stat; // Status from image-reading functions
Serial.begin(9600);
#if !defined(ESP32)
while(!Serial); // Wait for Serial Monitor before continuing
#endif
tft.init(240, 320); // Init ST7789 320x240
// The Adafruit_ImageReader constructor call (above, before setup())
// accepts an uninitialized SdFat or FatVolume object. This MUST
// BE INITIALIZED before using any of the image reader functions!
Serial.print(F("Initializing filesystem..."));
#if defined(USE_SD_CARD)
// SD card is pretty straightforward, a single call...
if(!SD.begin(SD_CS, SD_SCK_MHZ(10))) { // Breakouts require 10 MHz limit due to longer wires
Serial.println(F("SD begin() failed"));
for(;;); // Fatal error, do not continue
}
#else
// SPI or QSPI flash requires two steps, one to access the bare flash
// memory itself, then the second to access the filesystem within...
if(!flash.begin()) {
Serial.println(F("flash begin() failed"));
for(;;);
}
if(!filesys.begin(&flash)) {
Serial.println(F("filesys begin() failed"));
for(;;);
}
#endif
Serial.println(F("OK!"));
// Fill screen blue. Not a required step, this just shows that we're
// successfully communicating with the screen.
tft.fillScreen(ST77XX_BLUE);
// Load full-screen BMP file 'purple.bmp' at position (0,0) (top left).
// Notice the 'reader' object performs this, with 'tft' as an argument.
Serial.print(F("Loading purple.bmp to screen..."));
stat = reader.drawBMP("/purple.bmp", tft, 0, 0);
reader.printStatus(stat); // How'd we do?
// Query the dimensions of image 'miniwoof.bmp' WITHOUT loading to screen:
Serial.print(F("Querying miniwoof.bmp image size..."));
stat = reader.bmpDimensions("/miniwoof.bmp", &width, &height);
reader.printStatus(stat); // How'd we do?
if(stat == IMAGE_SUCCESS) { // If it worked, print image size...
Serial.print(F("Image dimensions: "));
Serial.print(width);
Serial.write('x');
Serial.println(height);
}
// Load small BMP 'wales.bmp' into a GFX canvas in RAM. This should fail
// gracefully on Arduino Uno and other small devices, meaning the image
// will not load, but this won't make the program stop or crash, it just
// continues on without it. Should work on Arduino Mega, Zero, etc.
Serial.print(F("Loading wales.bmp to canvas..."));
stat = reader.loadBMP("/wales.bmp", img);
reader.printStatus(stat); // How'd we do?
delay(2000); // Pause 2 seconds before moving on to loop()
}
void loop() {
for(int r=0; r<4; r++) { // For each of 4 rotations...
tft.setRotation(r); // Set rotation
tft.fillScreen(0); // and clear screen
// Load 4 copies of the 'miniwoof.bmp' image to the screen, some
// partially off screen edges to demonstrate clipping. Globals
// 'width' and 'height' were set by bmpDimensions() call in setup().
for(int i=0; i<4; i++) {
reader.drawBMP("/miniwoof.bmp", tft,
(tft.width() * i / 3) - (width / 2),
(tft.height() * i / 3) - (height / 2));
}
delay(1000); // Pause 1 sec.
// Draw 50 Welsh dragon flags in random positions. This has no effect
// on memory-constrained boards like the Arduino Uno, where the image
// failed to load due to insufficient RAM, but it's NOT fatal.
for(int i=0; i<50; i++) {
// Rather than reader.drawBMP() (which works from SD card),
// a different function is used for RAM-resident images:
img.draw(tft, // Pass in tft object
(int16_t)random(-img.width() , tft.width()) , // Horiz pos.
(int16_t)random(-img.height(), tft.height())); // Vert pos
// Reiterating a prior point: img.draw() does nothing and returns
// if the image failed to load. It's unfortunate but not disastrous.
}
delay(2000); // Pause 2 sec.
}
}

View file

@ -1,152 +0,0 @@
// Adafruit_ImageReader test for Adafruit E-Ink Breakouts.
// Demonstrates loading images from SD card or flash memory to the screen,
// to RAM, and how to query image file dimensions.
// Requires BMP file in root directory of QSPI Flash:
// blinka.bmp.
#include <Adafruit_GFX.h> // Core graphics library
#include "Adafruit_EPD.h" // Hardware-specific library for EPD
#include <SdFat_Adafruit_Fork.h> // SD card & FAT filesystem library
#include <Adafruit_SPIFlash.h> // SPI / QSPI flash library
#include <Adafruit_ImageReader_EPD.h> // Image-reading functions
// Comment out the next line to load from SPI/QSPI flash instead of SD card:
#define USE_SD_CARD
#define EPD_CS 10
#define EPD_DC 9
#define SRAM_CS 8
#define EPD_RESET 5 // can set to -1 and share with microcontroller Reset!
#define EPD_BUSY 3 // can set to -1 to not use a pin (will wait a fixed delay)
#define SD_CS 4 // SD card chip select
/* Uncomment the following line if you are using 1.54" tricolor EPD */
Adafruit_IL0373 display(152, 152, EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
/* Uncomment the following line if you are using 1.54" monochrome EPD */
//Adafruit_SSD1608 display(200, 200, EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
/* Uncomment the following line if you are using 2.13" tricolor EPD */
//Adafruit_IL0373 display(212, 104, EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
//#define FLEXIBLE_213
/* Uncomment the following line if you are using 2.13" monochrome 250*122 EPD */
//Adafruit_SSD1675 display(250, 122, EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
/* Uncomment the following line if you are using 2.7" tricolor or grayscale EPD */
//Adafruit_IL91874 display(264, 176, EPD_DC, EPD_RESET, EPD_CS, SRAM_CS);
/* Uncomment the following line if you are using 2.9" EPD */
//Adafruit_IL0373 display(296, 128, EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
//#define FLEXIBLE_290
/* Uncomment the following line if you are using 4.2" tricolor EPD */
//Adafruit_IL0398 display(300, 400, EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
#if defined(USE_SD_CARD)
SdFat SD; // SD card filesystem
Adafruit_ImageReader_EPD reader(SD); // Image-reader object, pass in SD filesys
#else
// SPI or QSPI flash filesystem (i.e. CIRCUITPY drive)
#if defined(__SAMD51__) || defined(NRF52840_XXAA)
Adafruit_FlashTransport_QSPI flashTransport(PIN_QSPI_SCK, PIN_QSPI_CS,
PIN_QSPI_IO0, PIN_QSPI_IO1, PIN_QSPI_IO2, PIN_QSPI_IO3);
#else
#if (SPI_INTERFACES_COUNT == 1 || defined(ADAFRUIT_CIRCUITPLAYGROUND_M0))
Adafruit_FlashTransport_SPI flashTransport(SS, &SPI);
#else
Adafruit_FlashTransport_SPI flashTransport(SS1, &SPI1);
#endif
#endif
Adafruit_SPIFlash flash(&flashTransport);
FatVolume filesys;
Adafruit_ImageReader_EPD reader(filesys); // Image-reader, pass in flash filesys
#endif
Adafruit_Image_EPD img; // An image loaded into RAM
int32_t width = 0, // BMP image dimensions
height = 0;
void setup(void) {
ImageReturnCode stat; // Status from image-reading functions
Serial.begin(9600);
//while(!Serial); // Wait for Serial Monitor before continuing
display.begin();
#if defined(FLEXIBLE_213) || defined(FLEXIBLE_290)
// The flexible displays have different buffers and invert settings!
display.setBlackBuffer(1, false);
display.setColorBuffer(1, false);
#endif
// The Adafruit_ImageReader constructor call (above, before setup())
// accepts an uninitialized SdFat or FatVolume object. This MUST
// BE INITIALIZED before using any of the image reader functions!
Serial.print(F("Initializing filesystem..."));
// SPI or QSPI flash requires two steps, one to access the bare flash
// memory itself, then the second to access the filesystem within...
#if defined(USE_SD_CARD)
// SD card is pretty straightforward, a single call...
if(!SD.begin(SD_CS, SD_SCK_MHZ(10))) { // Breakouts require 10 MHz limit due to longer wires
Serial.println(F("SD begin() failed"));
for(;;); // Fatal error, do not continue
}
#else
// SPI or QSPI flash requires two steps, one to access the bare flash
// memory itself, then the second to access the filesystem within...
if(!flash.begin()) {
Serial.println(F("flash begin() failed"));
for(;;);
}
if(!filesys.begin(&flash)) {
Serial.println(F("filesys begin() failed"));
for(;;);
}
#endif
Serial.println(F("OK!"));
// Load full-screen BMP file 'blinka.bmp' at position (0,0) (top left).
// Notice the 'reader' object performs this, with 'epd' as an argument.
Serial.print(F("Loading blinka.bmp to canvas..."));
stat = reader.drawBMP((char *)"/blinka.bmp", display, 0, 0);
reader.printStatus(stat); // How'd we do?
display.display();
// Query the dimensions of image 'blinka.bmp' WITHOUT loading to screen:
Serial.print(F("Querying blinka.bmp image size..."));
stat = reader.bmpDimensions("blinka.bmp", &width, &height);
reader.printStatus(stat); // How'd we do?
if(stat == IMAGE_SUCCESS) { // If it worked, print image size...
Serial.print(F("Image dimensions: "));
Serial.print(width);
Serial.write('x');
Serial.println(height);
}
delay(30 * 1000); // Pause 30 seconds before continuing because it's eInk
Serial.print(F("Drawing canvas to EPD..."));
display.clearBuffer();
// Load small BMP 'blinka.bmp' into a GFX canvas in RAM. This should fail
// gracefully on Arduino Uno and other small devices, meaning the image
// will not load, but this won't make the program stop or crash, it just
// continues on without it. Should work on larger ram boards like M4, etc.
stat = reader.loadBMP("/blinka.bmp", img);
reader.printStatus(stat); // How'd we do?
}
void loop() {
for(int r=0; r<4; r++) { // For each of 4 rotations...
display.setRotation(r); // Set rotation
display.fillScreen(0); // and clear screen
display.clearBuffer();
img.draw(display, 0, 0);
display.display();
delay(30 * 1000); // Pause 30 sec.
}
}

View file

@ -1,168 +0,0 @@
// Adafruit_ImageReader test for Adafruit E-Ink Breakouts.
// Demonstrates loading images from SD card or flash memory to the screen,
// to RAM, and how to query image file dimensions.
// Requires BMP file in root directory of QSPI Flash:
// blinka.bmp.
#include <Adafruit_GFX.h> // Core graphics library
#include "Adafruit_EPD.h" // Hardware-specific library for EPD
#include <SdFat_Adafruit_Fork.h> // SD card & FAT filesystem library
#include <Adafruit_SPIFlash.h> // SPI / QSPI flash library
#include <Adafruit_ImageReader_EPD.h> // Image-reading functions
// Comment out the next line to load from SPI/QSPI flash instead of SD card:
#define USE_SD_CARD
#if defined(ESP8266)
#define SD_CS 2
#define SRAM_CS 16
#define EPD_CS 0
#define EPD_DC 15
#elif defined(ESP32)
#define SD_CS 14
#define SRAM_CS 32
#define EPD_CS 15
#define EPD_DC 33
#elif defined(TEENSYDUINO)
#define SD_CS 8
#define SRAM_CS 3
#define EPD_CS 4
#define EPD_DC 10
#elif defined(ARDUINO_STM32_FEATHER)
#define TFT_DC PB4
#define TFT_CS PA15
#define STMPE_CS PC7
#define SD_CS PC5
#elif defined(ARDUINO_NRF52832_FEATHER) // BSP 0.6.5 and higher!
#define SD_CS 27
#define SRAM_CS 30
#define EPD_CS 31
#define EPD_DC 11
#else // Anything else!
#define SD_CS 5
#define SRAM_CS 6
#define EPD_CS 9
#define EPD_DC 10
#endif
#define EPD_RESET -1 // can set to -1 and share with microcontroller Reset!
#define EPD_BUSY -1 // can set to -1 to not use a pin (will wait a fixed delay)
/* Uncomment the following line if you are using 2.13" tricolor EPD */
Adafruit_IL0373 display(212, 104, EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
//#define FLEXIBLE_213
/* Uncomment the following line if you are using 2.13" monochrome 250*122 EPD */
//Adafruit_SSD1675 display(250, 122, EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
/* Uncomment the following line if you are using 2.9" EPD with E-Ink Feather Friend */
//Adafruit_IL0373 display(296, 128, EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
//#define FLEXIBLE_290
#if defined(USE_SD_CARD)
SdFat SD; // SD card filesystem
Adafruit_ImageReader_EPD reader(SD); // Image-reader object, pass in SD filesys
#else
// SPI or QSPI flash filesystem (i.e. CIRCUITPY drive)
#if defined(__SAMD51__) || defined(NRF52840_XXAA)
Adafruit_FlashTransport_QSPI flashTransport(PIN_QSPI_SCK, PIN_QSPI_CS,
PIN_QSPI_IO0, PIN_QSPI_IO1, PIN_QSPI_IO2, PIN_QSPI_IO3);
#else
#if (SPI_INTERFACES_COUNT == 1 || defined(ADAFRUIT_CIRCUITPLAYGROUND_M0))
Adafruit_FlashTransport_SPI flashTransport(SS, &SPI);
#else
Adafruit_FlashTransport_SPI flashTransport(SS1, &SPI1);
#endif
#endif
Adafruit_SPIFlash flash(&flashTransport);
FatVolume filesys;
Adafruit_ImageReader_EPD reader(filesys); // Image-reader, pass in flash filesys
#endif
Adafruit_Image_EPD img; // An image loaded into RAM
int32_t width = 0, // BMP image dimensions
height = 0;
void setup(void) {
ImageReturnCode stat; // Status from image-reading functions
Serial.begin(9600);
//while(!Serial); // Wait for Serial Monitor before continuing
display.begin();
#if defined(FLEXIBLE_213) || defined(FLEXIBLE_290)
// The flexible displays have different buffers and invert settings!
display.setBlackBuffer(1, false);
display.setColorBuffer(1, false);
#endif
// The Adafruit_ImageReader constructor call (above, before setup())
// accepts an uninitialized SdFat or FatVolume object. This MUST
// BE INITIALIZED before using any of the image reader functions!
Serial.print(F("Initializing filesystem..."));
// SPI or QSPI flash requires two steps, one to access the bare flash
// memory itself, then the second to access the filesystem within...
#if defined(USE_SD_CARD)
// SD card is pretty straightforward, a single call...
if(!SD.begin(SD_CS, SD_SCK_MHZ(10))) { // Breakouts require 10 MHz limit due to longer wires
Serial.println(F("SD begin() failed"));
for(;;); // Fatal error, do not continue
}
#else
// SPI or QSPI flash requires two steps, one to access the bare flash
// memory itself, then the second to access the filesystem within...
if(!flash.begin()) {
Serial.println(F("flash begin() failed"));
for(;;);
}
if(!filesys.begin(&flash)) {
Serial.println(F("filesys begin() failed"));
for(;;);
}
#endif
Serial.println(F("OK!"));
// Load full-screen BMP file 'blinka.bmp' at position (0,0) (top left).
// Notice the 'reader' object performs this, with 'epd' as an argument.
Serial.print(F("Loading blinka.bmp to canvas..."));
stat = reader.drawBMP((char *)"/blinka.bmp", display, 0, 0);
reader.printStatus(stat); // How'd we do?
display.display();
// Query the dimensions of image 'blinka.bmp' WITHOUT loading to screen:
Serial.print(F("Querying blinka.bmp image size..."));
stat = reader.bmpDimensions("blinka.bmp", &width, &height);
reader.printStatus(stat); // How'd we do?
if(stat == IMAGE_SUCCESS) { // If it worked, print image size...
Serial.print(F("Image dimensions: "));
Serial.print(width);
Serial.write('x');
Serial.println(height);
}
delay(30 * 1000); // Pause 30 seconds before continuing because it's eInk
Serial.print(F("Drawing canvas to EPD..."));
display.clearBuffer();
// Load small BMP 'blinka.bmp' into a GFX canvas in RAM. This should fail
// gracefully on Arduino Uno and other small devices, meaning the image
// will not load, but this won't make the program stop or crash, it just
// continues on without it. Should work on larger ram boards like M4, etc.
stat = reader.loadBMP("/blinka.bmp", img);
reader.printStatus(stat); // How'd we do?
}
void loop() {
for(int r=0; r<4; r++) { // For each of 4 rotations...
display.setRotation(r); // Set rotation
display.fillScreen(0); // and clear screen
display.clearBuffer();
img.draw(display, 0, 0);
display.display();
delay(30 * 1000); // Pause 30 sec.
}
}

View file

@ -1,123 +0,0 @@
// Adafruit_ImageReader test for Adafruit E-Ink Gizmo for CircuitPlayground.
// Demonstrates loading images to the screen, to RAM, and how to query
// image file dimensions.
// Requires BMP file in root directory of QSPI Flash:
// blinka.bmp.
#include "Adafruit_ThinkInk.h" // Hardware-specific library for EPD
#include <Adafruit_SPIFlash.h> // SPI / QSPI flash library
#include <Adafruit_ImageReader_EPD.h> // Image-reading functions
#define EPD_CS 0
#define EPD_DC 1
#define SRAM_CS -1
#define EPD_RESET PIN_A3
#define EPD_BUSY -1
// 1.54" 152x152 Tricolor EPD with ILI0373 chipset
//ThinkInk_154_Tricolor_Z17 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
// 1.54" 200x200 Tricolor EPD with SSD1681 chipset
ThinkInk_154_Tricolor_Z90 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
// SPI or QSPI flash filesystem (i.e. CIRCUITPY drive)
#if defined(__SAMD51__) || defined(NRF52840_XXAA)
Adafruit_FlashTransport_QSPI flashTransport(PIN_QSPI_SCK, PIN_QSPI_CS,
PIN_QSPI_IO0, PIN_QSPI_IO1, PIN_QSPI_IO2, PIN_QSPI_IO3);
#else
#if (SPI_INTERFACES_COUNT == 1 || defined(ADAFRUIT_CIRCUITPLAYGROUND_M0))
Adafruit_FlashTransport_SPI flashTransport(SS, &SPI);
#else
Adafruit_FlashTransport_SPI flashTransport(SS1, &SPI1);
#endif
#endif
Adafruit_SPIFlash flash(&flashTransport);
FatVolume filesys;
Adafruit_ImageReader_EPD reader(filesys); // Image-reader, pass in flash filesys
Adafruit_Image_EPD img; // An image loaded into RAM
int32_t width = 0, // BMP image dimensions
height = 0;
void setup(void) {
ImageReturnCode stat; // Status from image-reading functions
Serial.begin(115200);
//while(!Serial) delay(10); // Wait for Serial Monitor before continuing
display.begin(THINKINK_TRICOLOR);
display.setRotation(3);
// The Adafruit_ImageReader constructor call (above, before setup())
// accepts an uninitialized SdFat or FatVolume object. This MUST
// BE INITIALIZED before using any of the image reader functions!
Serial.print(F("Initializing filesystem..."));
// SPI or QSPI flash requires two steps, one to access the bare flash
// memory itself, then the second to access the filesystem within...
if(!flash.begin()) {
errorEPD("Flash begin() failed");
}
if(!filesys.begin(&flash)) {
errorEPD("filesys begin() failed");
}
Serial.println(F("OK!"));
// Load full-screen BMP file 'blinka.bmp' at position (0,0) (top left).
// Notice the 'reader' object performs this, with 'epd' as an argument.
Serial.print(F("Loading blinka.bmp to canvas..."));
stat = reader.drawBMP((char *)"/blinka.bmp", display, 0, 0);
reader.printStatus(stat); // How'd we do?
if (stat != IMAGE_SUCCESS) {
errorEPD("Unable to draw image");
}
display.display();
// Query the dimensions of image 'blinka.bmp' WITHOUT loading to screen:
Serial.print(F("Querying blinka.bmp image size..."));
stat = reader.bmpDimensions("blinka.bmp", &width, &height);
reader.printStatus(stat); // How'd we do?
if(stat == IMAGE_SUCCESS) { // If it worked, print image size...
Serial.print(F("Image dimensions: "));
Serial.print(width);
Serial.write('x');
Serial.println(height);
}
delay(30 * 1000); // Pause 30 seconds before continuing because it's eInk
Serial.print(F("Drawing canvas to EPD..."));
display.clearBuffer();
// Load small BMP 'blinka.bmp' into a GFX canvas in RAM. This should fail
// gracefully on Arduino Uno and other small devices, meaning the image
// will not load, but this won't make the program stop or crash, it just
// continues on without it. Should work on larger ram boards like M4, etc.
stat = reader.loadBMP("/blinka.bmp", img);
reader.printStatus(stat); // How'd we do?
}
void loop() {
for(int r=0; r<4; r++) { // For each of 4 rotations...
display.setRotation(r); // Set rotation
display.fillScreen(0); // and clear screen
display.clearBuffer();
img.draw(display, 0, 0);
display.display();
delay(30 * 1000); // Pause 30 sec.
}
}
void errorEPD(const char *errormsg) {
display.fillScreen(0); // clear screen
display.clearBuffer();
display.setTextSize(2);
display.setCursor(10, 10);
display.setTextColor(EPD_BLACK);
display.print(errormsg);
display.display();
while (1) {
delay(10);
}
}

View file

@ -1,99 +0,0 @@
#include <Adafruit_GFX.h> // Core graphics library
#include "Adafruit_ThinkInk.h"
#include <SdFat_Adafruit_Fork.h> // SD card & FAT filesystem library
#include <Adafruit_ImageReader_EPD.h> // Image-reading functions
#define SD_CS 5
#define SRAM_CS -1
#define EPD_CS 9
#define EPD_DC 10
#define EPD_RESET -1 // can set to -1 and share with microcontroller Reset!
#define EPD_BUSY -1 // can set to -1 to not use a pin (will wait a fixed delay)
ThinkInk_290_Grayscale4_T5 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
SdFat SD; // SD card filesystem
Adafruit_ImageReader_EPD reader(SD); // Image-reader object, pass in SD filesys
#define FILENAME1 "/adabot_head.bmp"
#define FILENAME2 "/panda_head.bmp"
#define FILENAME3 "/29gray4.bmp"
#define BUTTON1 11
#define BUTTON2 12
#define BUTTON3 13
void setup(void) {
Serial.begin(9600);
//while(!Serial); // Wait for Serial Monitor before continuing
display.begin();
display.clearBuffer();
/*
Serial.print("Initializing filesystem...");
display.setTextSize(3);
display.setCursor(10,10);
display.setTextColor(EPD_BLACK);
display.print("SD Card...");
*/
display.display();
// SD card is pretty straightforward, a single call...
if(!SD.begin(SD_CS, SD_SCK_MHZ(10))) { // Breakouts require 10 MHz limit due to longer wires
Serial.println(F("SD begin() failed"));
display.println("failed!");
display.display();
for(;;); // Fatal error, do not continue
}
Serial.println("OK!");
/*
display.println("OK!");
display.display();
display.setCursor(10,100);
display.setTextSize(1);
display.println("Press buttons to display images!");
display.display();
*/
pinMode(BUTTON1, INPUT_PULLUP);
pinMode(BUTTON2, INPUT_PULLUP);
pinMode(BUTTON3, INPUT_PULLUP);
delay(10);
}
void loop() {
char selected_file[80] = {0};
ImageReturnCode stat; // Status from image-reading functions
if (!digitalRead(BUTTON1)) {
strcpy(selected_file, FILENAME1);
Serial.println("Button 1 pressed");
}
if (!digitalRead(BUTTON2)) {
strcpy(selected_file, FILENAME2);
Serial.println("Button 2 pressed");
}
if (!digitalRead(BUTTON3)) {
strcpy(selected_file, FILENAME3);
Serial.println("Button 3 pressed");
}
if (selected_file[0] != 0) {
display.clearBuffer();
display.display();
delay(500);
Serial.print("Loading ");
Serial.print(selected_file);
Serial.println(" to canvas...");
display.clearBuffer();
stat = reader.drawBMP(selected_file, display, 0, 0);
reader.printStatus(stat); // How'd we do?
display.display();
}
}

View file

@ -1,180 +0,0 @@
// Adafruit_ImageReader test for 3.5" TFT FeatherWing. Demonstrates loading
// images from SD card or flash memory to the screen, to RAM, and how to
// query image file dimensions. OPEN THE ARDUINO SERIAL MONITOR WINDOW TO
// START PROGRAM. Requires three BMP files in root directory of SD card or
// flash: adabot.bmp, parrot.bmp and wales.bmp.
#include <Adafruit_GFX.h> // Core graphics library
#include <Adafruit_HX8357.h> // Hardware-specific library
#include <SdFat_Adafruit_Fork.h> // SD card & FAT filesystem library
#include <Adafruit_SPIFlash.h> // SPI / QSPI flash library
#include <Adafruit_ImageReader.h> // Image-reading functions
// Comment out the next line to load from SPI/QSPI flash instead of SD card:
#define USE_SD_CARD
// Pin definitions for 2.4" TFT FeatherWing vary among boards...
#if defined(ESP8266)
#define TFT_CS 0
#define TFT_DC 15
#define SD_CS 2
#elif defined(ESP32) && !defined(ARDUINO_ADAFRUIT_FEATHER_ESP32S2)
#define TFT_CS 15
#define TFT_DC 33
#define SD_CS 14
#elif defined(TEENSYDUINO)
#define TFT_DC 10
#define TFT_CS 4
#define SD_CS 8
#elif defined(ARDUINO_STM32_FEATHER)
#define TFT_DC PB4
#define TFT_CS PA15
#define SD_CS PC5
#elif defined(ARDUINO_NRF52832_FEATHER) // BSP 0.6.5 and higher!
#define TFT_DC 11
#define TFT_CS 31
#define SD_CS 27
#elif defined(ARDUINO_MAX32620FTHR) || defined(ARDUINO_MAX32630FTHR)
#define TFT_DC P5_4
#define TFT_CS P5_3
#define STMPE_CS P3_3
#define SD_CS P3_2
#elif defined(ARDUINO_ADAFRUIT_FEATHER_RP2040)
#define TFT_CS 9
#define TFT_DC 10
#define SD_CS 7 // "pin 5" on original rp2040 feather ONLY
#else // Anything else!
#define TFT_CS 9
#define TFT_DC 10
#define SD_CS 5
#endif
#if defined(USE_SD_CARD)
SdFat SD; // SD card filesystem
Adafruit_ImageReader reader(SD); // Image-reader object, pass in SD filesys
#else
// SPI or QSPI flash filesystem (i.e. CIRCUITPY drive)
#if defined(__SAMD51__) || defined(NRF52840_XXAA)
Adafruit_FlashTransport_QSPI flashTransport(PIN_QSPI_SCK, PIN_QSPI_CS,
PIN_QSPI_IO0, PIN_QSPI_IO1, PIN_QSPI_IO2, PIN_QSPI_IO3);
#else
#if (SPI_INTERFACES_COUNT == 1)
Adafruit_FlashTransport_SPI flashTransport(SS, &SPI);
#else
Adafruit_FlashTransport_SPI flashTransport(SS1, &SPI1);
#endif
#endif
Adafruit_SPIFlash flash(&flashTransport);
FatVolume filesys;
Adafruit_ImageReader reader(filesys); // Image-reader, pass in flash filesys
#endif
Adafruit_HX8357 tft = Adafruit_HX8357(TFT_CS, TFT_DC);
Adafruit_Image img; // An image loaded into RAM
int32_t width = 0, // BMP image dimensions
height = 0;
void setup(void) {
ImageReturnCode stat; // Status from image-reading functions
Serial.begin(9600);
#if !defined(ESP32)
while(!Serial); // Wait for Serial Monitor before continuing
#endif
tft.begin(); // Initialize screen
// The Adafruit_ImageReader constructor call (above, before setup())
// accepts an uninitialized SdFat or FatVolume object. This MUST
// BE INITIALIZED before using any of the image reader functions!
Serial.print(F("Initializing filesystem..."));
#if defined(USE_SD_CARD)
// SD card is pretty straightforward, a single call...
// M0 max SPI is 12 MHz
// ESP32 can handl 25 MHz
if(!SD.begin(SD_CS, SD_SCK_MHZ(12))) {
Serial.println(F("SD begin() failed"));
for(;;); // Fatal error, do not continue
}
#else
// SPI or QSPI flash requires two steps, one to access the bare flash
// memory itself, then the second to access the filesystem within...
if(!flash.begin()) {
Serial.println(F("flash begin() failed"));
for(;;);
}
if(!filesys.begin(&flash)) {
Serial.println(F("filesys begin() failed"));
for(;;);
}
#endif
Serial.println(F("OK!"));
// Fill screen blue. Not a required step, this just shows that we're
// successfully communicating with the screen.
tft.fillScreen(HX8357_BLUE);
// Load full-screen BMP file 'adabot.bmp' at position (0,0) (top left).
// Notice the 'reader' object performs this, with 'tft' as an argument.
Serial.print(F("Loading adabot.bmp to screen..."));
stat = reader.drawBMP("/adabot.bmp", tft, 0, 0);
// (Absolute path isn't necessary on most devices, but something
// with the ESP32 SD library seems to require it.)
reader.printStatus(stat); // How'd we do?
// Query the dimensions of image 'parrot.bmp' WITHOUT loading to screen:
Serial.print(F("Querying parrot.bmp image size..."));
stat = reader.bmpDimensions("/parrot.bmp", &width, &height);
reader.printStatus(stat); // How'd we do?
if(stat == IMAGE_SUCCESS) { // If it worked, print image size...
Serial.print(F("Image dimensions: "));
Serial.print(width);
Serial.write('x');
Serial.println(height);
}
// Load small BMP 'wales.bmp' into a GFX canvas in RAM. This should
// fail gracefully on AVR and other small devices, meaning the image
// will not load, but this won't make the program stop or crash, it
// just continues on without it.
Serial.print(F("Loading wales.bmp to canvas..."));
stat = reader.loadBMP("/wales.bmp", img);
reader.printStatus(stat); // How'd we do?
delay(2000); // Pause 2 seconds before moving on to loop()
}
void loop() {
for(int r=0; r<4; r++) { // For each of 4 rotations...
tft.setRotation(r); // Set rotation
tft.fillScreen(0); // and clear screen
// Load 4 copies of the 'parrot.bmp' image to the screen, some
// partially off screen edges to demonstrate clipping. Globals
// 'width' and 'height' were set by bmpDimensions() call in setup().
for(int i=0; i<4; i++) {
reader.drawBMP("/parrot.bmp", tft,
(tft.width() * i / 3) - (width / 2),
(tft.height() * i / 3) - (height / 2));
}
delay(1000); // Pause 1 sec.
// Draw 50 Welsh dragon flags in random positions. This has no effect
// on memory-constrained boards like the Arduino Uno, where the image
// failed to load due to insufficient RAM, but it's NOT fatal.
for(int i=0; i<50; i++) {
// Rather than reader.drawBMP() (which works from SD card),
// a different function is used for RAM-resident images:
img.draw(tft, // Pass in tft object
(int16_t)random(-img.width() , tft.width()) , // Horiz pos.
(int16_t)random(-img.height(), tft.height())); // Vert pos
// Reiterating a prior point: img.draw() does nothing and returns
// if the image failed to load. It's unfortunate but not disastrous.
}
delay(1000); // Pause 2 sec.
}
}

View file

@ -1,178 +0,0 @@
// Adafruit_ImageReader test for 2.4" TFT FeatherWing. Demonstrates loading
// images from SD card or flash memory to the screen, to RAM, and how to
// query image file dimensions. OPEN THE ARDUINO SERIAL MONITOR WINDOW TO
// START PROGRAM. Requires three BMP files in root directory of SD card or
// flash: purple.bmp, parrot.bmp and wales.bmp.
#include <Adafruit_GFX.h> // Core graphics library
#include <Adafruit_ILI9341.h> // Hardware-specific library
#include <SdFat_Adafruit_Fork.h> // SD card & FAT filesystem library
#include <Adafruit_SPIFlash.h> // SPI / QSPI flash library
#include <Adafruit_ImageReader.h> // Image-reading functions
// Comment out the next line to load from SPI/QSPI flash instead of SD card:
#define USE_SD_CARD
// Pin definitions for 2.4" TFT FeatherWing vary among boards...
#if defined(ESP8266)
#define TFT_CS 0
#define TFT_DC 15
#define SD_CS 2
#elif defined(ESP32) && !defined(ARDUINO_ADAFRUIT_FEATHER_ESP32S2)
#define TFT_CS 15
#define TFT_DC 33
#define SD_CS 14
#elif defined(TEENSYDUINO)
#define TFT_DC 10
#define TFT_CS 4
#define SD_CS 8
#elif defined(ARDUINO_STM32_FEATHER)
#define TFT_DC PB4
#define TFT_CS PA15
#define SD_CS PC5
#elif defined(ARDUINO_NRF52832_FEATHER) // BSP 0.6.5 and higher!
#define TFT_DC 11
#define TFT_CS 31
#define SD_CS 27
#elif defined(ARDUINO_MAX32620FTHR) || defined(ARDUINO_MAX32630FTHR)
#define TFT_DC P5_4
#define TFT_CS P5_3
#define STMPE_CS P3_3
#define SD_CS P3_2
#elif defined(ARDUINO_ADAFRUIT_FEATHER_RP2040)
#define TFT_CS 9
#define TFT_DC 10
#define SD_CS 7 // "pin 5" on original rp2040 feather ONLY
#else // Anything else!
#define TFT_CS 9
#define TFT_DC 10
#define SD_CS 5
#endif
#if defined(USE_SD_CARD)
SdFat SD; // SD card filesystem
Adafruit_ImageReader reader(SD); // Image-reader object, pass in SD filesys
#else
// SPI or QSPI flash filesystem (i.e. CIRCUITPY drive)
#if defined(__SAMD51__) || defined(NRF52840_XXAA)
Adafruit_FlashTransport_QSPI flashTransport(PIN_QSPI_SCK, PIN_QSPI_CS,
PIN_QSPI_IO0, PIN_QSPI_IO1, PIN_QSPI_IO2, PIN_QSPI_IO3);
#else
#if (SPI_INTERFACES_COUNT == 1)
Adafruit_FlashTransport_SPI flashTransport(SS, &SPI);
#else
Adafruit_FlashTransport_SPI flashTransport(SS1, &SPI1);
#endif
#endif
Adafruit_SPIFlash flash(&flashTransport);
FatVolume filesys;
Adafruit_ImageReader reader(filesys); // Image-reader, pass in flash filesys
#endif
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);
Adafruit_Image img; // An image loaded into RAM
int32_t width = 0, // BMP image dimensions
height = 0;
void setup(void) {
ImageReturnCode stat; // Status from image-reading functions
Serial.begin(9600);
while(!Serial) delay(100); // Wait for Serial Monitor before continuing
tft.begin(); // Initialize screen
// The Adafruit_ImageReader constructor call (above, before setup())
// accepts an uninitialized SdFat or FatVolume object. This MUST
// BE INITIALIZED before using any of the image reader functions!
Serial.print(F("Initializing filesystem..."));
#if defined(USE_SD_CARD)
// SD card is pretty straightforward, a single call...
// M0 max SPI is 12 MHz
// ESP32 can handl 25 MHz
if(!SD.begin(SD_CS, SD_SCK_MHZ(12))) {
Serial.println(F("SD begin() failed"));
for(;;); // Fatal error, do not continue
}
#else
// SPI or QSPI flash requires two steps, one to access the bare flash
// memory itself, then the second to access the filesystem within...
if(!flash.begin()) {
Serial.println(F("flash begin() failed"));
for(;;);
}
if(!filesys.begin(&flash)) {
Serial.println(F("filesys begin() failed"));
for(;;);
}
#endif
Serial.println(F("OK!"));
// Fill screen blue. Not a required step, this just shows that we're
// successfully communicating with the screen.
tft.fillScreen(ILI9341_BLUE);
// Load full-screen BMP file 'purple.bmp' at position (0,0) (top left).
// Notice the 'reader' object performs this, with 'tft' as an argument.
Serial.print(F("Loading purple.bmp to screen..."));
stat = reader.drawBMP("/purple.bmp", tft, 0, 0);
// (Absolute path isn't necessary on most devices, but something
// with the ESP32 SD library seems to require it.)
reader.printStatus(stat); // How'd we do?
// Query the dimensions of image 'parrot.bmp' WITHOUT loading to screen:
Serial.print(F("Querying parrot.bmp image size..."));
stat = reader.bmpDimensions("/parrot.bmp", &width, &height);
reader.printStatus(stat); // How'd we do?
if(stat == IMAGE_SUCCESS) { // If it worked, print image size...
Serial.print(F("Image dimensions: "));
Serial.print(width);
Serial.write('x');
Serial.println(height);
}
// Load small BMP 'wales.bmp' into a GFX canvas in RAM. This should
// fail gracefully on AVR and other small devices, meaning the image
// will not load, but this won't make the program stop or crash, it
// just continues on without it.
Serial.print(F("Loading wales.bmp to canvas..."));
stat = reader.loadBMP("/wales.bmp", img);
reader.printStatus(stat); // How'd we do?
delay(2000); // Pause 2 seconds before moving on to loop()
}
void loop() {
for(int r=0; r<4; r++) { // For each of 4 rotations...
tft.setRotation(r); // Set rotation
tft.fillScreen(0); // and clear screen
// Load 4 copies of the 'parrot.bmp' image to the screen, some
// partially off screen edges to demonstrate clipping. Globals
// 'width' and 'height' were set by bmpDimensions() call in setup().
for(int i=0; i<4; i++) {
reader.drawBMP("/parrot.bmp", tft,
(tft.width() * i / 3) - (width / 2),
(tft.height() * i / 3) - (height / 2));
}
delay(1000); // Pause 1 sec.
// Draw 50 Welsh dragon flags in random positions. This has no effect
// on memory-constrained boards like the Arduino Uno, where the image
// failed to load due to insufficient RAM, but it's NOT fatal.
for(int i=0; i<50; i++) {
// Rather than reader.drawBMP() (which works from SD card),
// a different function is used for RAM-resident images:
img.draw(tft, // Pass in tft object
(int16_t)random(-img.width() , tft.width()) , // Horiz pos.
(int16_t)random(-img.height(), tft.height())); // Vert pos
// Reiterating a prior point: img.draw() does nothing and returns
// if the image failed to load. It's unfortunate but not disastrous.
}
delay(2000); // Pause 2 sec.
}
}

View file

@ -1,164 +0,0 @@
// Adafruit_ImageReader test for Mini TFT FeatherWing. Demonstrates loading
// images from SD card or flash memory to the screen, to RAM, and how to
// query image file dimensions. OPEN THE ARDUINO SERIAL MONITOR WINDOW TO
// START PROGRAM. Requires three BMP files in root directory of SD card or
// flash: minibot.bmp, rgbwheel.bmp and wales.bmp.
// This ONLY demonstrates BMP loading. Other features of the FeatherWing
// (stick, buttons, backlight control) are NOT demonstrated here,
// see other ST7735 library examples for that.
// MINI TFT FEATHERWING REQUIRES Adafruit_Seesaw LIBRARY.
#include <Adafruit_GFX.h> // Core graphics library
#include <Adafruit_ST7735.h> // Hardware-specific library
#include <SdFat_Adafruit_Fork.h> // SD card & FAT filesystem library
#include <Adafruit_SPIFlash.h> // SPI / QSPI flash library
#include <Adafruit_ImageReader.h> // Image-reading functions
#include <Adafruit_miniTFTWing.h> // Part of Seesaw library
// Comment out the next line to load from SPI/QSPI flash instead of SD card:
#define USE_SD_CARD
#define TFT_CS 5 // TFT chip select (FeatherWing)
#define TFT_DC 6 // TFT data/command select (FeatherWing)
#define TFT_RST -1 // FeatherWing uses Seesaw for TFT reset
#define SD_CS 4 // SD card chip select (Feather AdaLogger 32u4 or M0) OR use 10
// for Adalogger FeatherWing
#if defined(USE_SD_CARD)
SdFat SD; // SD card filesystem
Adafruit_ImageReader reader(SD); // Image-reader object, pass in SD filesys
#else
// SPI or QSPI flash filesystem (i.e. CIRCUITPY drive)
#if defined(__SAMD51__) || defined(NRF52840_XXAA)
Adafruit_FlashTransport_QSPI flashTransport(PIN_QSPI_SCK, PIN_QSPI_CS,
PIN_QSPI_IO0, PIN_QSPI_IO1, PIN_QSPI_IO2, PIN_QSPI_IO3);
#else
#if (SPI_INTERFACES_COUNT == 1)
Adafruit_FlashTransport_SPI flashTransport(SS, &SPI);
#else
Adafruit_FlashTransport_SPI flashTransport(SS1, &SPI1);
#endif
#endif
Adafruit_SPIFlash flash(&flashTransport);
FatVolume filesys;
Adafruit_ImageReader reader(filesys); // Image-reader, pass in flash filesys
#endif
Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_RST);
Adafruit_Image img; // An image loaded into RAM
int32_t width = 0, // BMP image dimensions
height = 0;
Adafruit_miniTFTWing seesaw;
void setup(void) {
ImageReturnCode stat; // Status from image-reading functions
Serial.begin(9600);
#if !defined(ESP32)
while(!Serial); // Wait for Serial Monitor before continuing
#endif
if(!seesaw.begin()) {
Serial.println(F("Couldn't find Seesaw!"));
for(;;);
}
seesaw.tftReset(); // Reset display
seesaw.setBacklight(TFTWING_BACKLIGHT_ON); // Turn on backlight
tft.initR(INITR_MINI160x80); // Initialize screen
Serial.println(F("TFT initialized."));
// The Adafruit_ImageReader constructor call (above, before setup())
// accepts an uninitialized SdFat or FatVolume object. This MUST
// BE INITIALIZED before using any of the image reader functions!
Serial.print(F("Initializing filesystem..."));
#if defined(USE_SD_CARD)
// SD card is pretty straightforward, a single call...
// M0 max SPI is 12 MHz
// ESP32 can handl 25 MHz
if(!SD.begin(SD_CS, SD_SCK_MHZ(12))) {
Serial.println(F("SD begin() failed"));
for(;;); // Fatal error, do not continue
}
#else
// SPI or QSPI flash requires two steps, one to access the bare flash
// memory itself, then the second to access the filesystem within...
if(!flash.begin()) {
Serial.println(F("flash begin() failed"));
for(;;);
}
if(!filesys.begin(&flash)) {
Serial.println(F("filesys begin() failed"));
for(;;);
}
#endif
Serial.println(F("OK!"));
// Fill screen blue. Not a required step, this just shows that we're
// successfully communicating with the screen.
tft.fillScreen(ST77XX_BLUE);
// Load full-screen BMP file 'minibot.bmp' at position (0,0) (top left).
// Notice the 'reader' object performs this, with 'tft' as an argument.
Serial.print(F("Loading minibot.bmp to screen..."));
stat = reader.drawBMP("/minibot.bmp", tft, 0, 0);
// (Absolute path isn't necessary on most devices, but something
// with the ESP32 SD library seems to require it.)
reader.printStatus(stat); // How'd we do?
// Query the dimensions of image 'rgbwheel.bmp' WITHOUT loading to screen:
Serial.print(F("Querying rgbwheel.bmp image size..."));
stat = reader.bmpDimensions("/rgbwheel.bmp", &width, &height);
reader.printStatus(stat); // How'd we do?
if(stat == IMAGE_SUCCESS) { // If it worked, print image size...
Serial.print(F("Image dimensions: "));
Serial.print(width);
Serial.write('x');
Serial.println(height);
}
// Load small BMP 'wales.bmp' into a GFX canvas in RAM. This should
// fail gracefully on AVR and other small devices, meaning the image
// will not load, but this won't make the program stop or crash, it
// just continues on without it.
Serial.print(F("Loading wales.bmp to canvas..."));
stat = reader.loadBMP("/wales.bmp", img);
reader.printStatus(stat); // How'd we do?
delay(2000); // Pause 2 seconds before moving on to loop()
}
void loop() {
for(int r=0; r<4; r++) { // For each of 4 rotations...
tft.setRotation(r); // Set rotation
tft.fillScreen(0); // and clear screen
// Load 4 copies of the 'rgbwheel.bmp' image to the screen, some
// partially off screen edges to demonstrate clipping. Globals
// 'width' and 'height' were set by bmpDimensions() call in setup().
for(int i=0; i<4; i++) {
reader.drawBMP("/rgbwheel.bmp", tft,
(tft.width() * i / 3) - (width / 2),
(tft.height() * i / 3) - (height / 2));
}
delay(1000); // Pause 1 sec.
// Draw 50 Welsh dragon flags in random positions. This has no effect
// on memory-constrained boards like the Arduino Uno, where the image
// failed to load due to insufficient RAM, but it's NOT fatal.
for(int i=0; i<50; i++) {
// Rather than reader.drawBMP() (which works from SD card),
// a different function is used for RAM-resident images:
img.draw(tft, // Pass in tft object
(int16_t)random(-img.width() , tft.width()) , // Horiz pos.
(int16_t)random(-img.height(), tft.height())); // Vert pos
// Reiterating a prior point: img.draw() does nothing and returns
// if the image failed to load. It's unfortunate but not disastrous.
}
delay(2000); // Pause 2 sec.
}
}

View file

@ -1,151 +0,0 @@
// Adafruit_ImageReader test for PyPortal. Demonstrates loading images from
// from SD card or flash memory to screen, to RAM, and how to query image
// file dimensions. OPEN THE ARDUINO SERIAL MONITOR WINDOW TO START PROGRAM.
// Requires three BMP files in root directory of SD card or flash:
// purple.bmp, parrot.bmp and wales.bmp.
#include <Adafruit_GFX.h> // Core graphics library
#include <Adafruit_ILI9341.h> // Hardware-specific library
#include <SdFat.h> // SD card & FAT filesystem library
#include <Adafruit_SPIFlash.h> // SPI / QSPI flash library
#include <Adafruit_ImageReader.h> // Image-reading functions
// Comment out the next line to load from SPI/QSPI flash instead of SD card:
#define USE_SD_CARD
#define TFT_D0 34 // Data bit 0 pin (MUST be on PORT byte boundary)
#define TFT_WR 26 // Write-strobe pin (CCL-inverted timer output)
#define TFT_DC 10 // Data/command pin
#define TFT_CS 11 // Chip-select pin
#define TFT_RST 24 // Reset pin
#define TFT_RD 9 // Read-strobe pin
#define TFT_BACKLIGHT 25
#define SD_CS 32
#if defined(USE_SD_CARD)
SdFat SD; // SD card filesystem
Adafruit_ImageReader reader(SD); // Image-reader object, pass in SD filesys
#else
// SPI or QSPI flash filesystem (i.e. CIRCUITPY drive)
#if defined(__SAMD51__) || defined(NRF52840_XXAA)
Adafruit_FlashTransport_QSPI flashTransport(PIN_QSPI_SCK, PIN_QSPI_CS,
PIN_QSPI_IO0, PIN_QSPI_IO1, PIN_QSPI_IO2, PIN_QSPI_IO3);
#else
#if (SPI_INTERFACES_COUNT == 1)
Adafruit_FlashTransport_SPI flashTransport(SS, &SPI);
#else
Adafruit_FlashTransport_SPI flashTransport(SS1, &SPI1);
#endif
#endif
Adafruit_SPIFlash flash(&flashTransport);
FatVolume filesys;
Adafruit_ImageReader reader(filesys); // Image-reader, pass in flash filesys
#endif
Adafruit_ILI9341 tft(tft8bitbus, TFT_D0, TFT_WR, TFT_DC, TFT_CS, TFT_RST, TFT_RD);
Adafruit_Image img; // An image loaded into RAM
int32_t width = 0, // BMP image dimensions
height = 0;
void setup(void) {
ImageReturnCode stat; // Status from image-reading functions
Serial.begin(9600);
while(!Serial); // Wait for Serial Monitor before continuing
// Turn on backlight (required on PyPortal)
pinMode(TFT_BACKLIGHT, OUTPUT);
digitalWrite(TFT_BACKLIGHT, HIGH);
tft.begin(); // Initialize screen
// The Adafruit_ImageReader constructor call (above, before setup())
// accepts an uninitialized SdFat or FatVolume object. This MUST
// BE INITIALIZED before using any of the image reader functions!
Serial.print(F("Initializing filesystem..."));
#if defined(USE_SD_CARD)
// SD card is pretty straightforward, a single call...
if(!SD.begin(SD_CS, SD_SCK_MHZ(25))) { // ESP32 requires 25 MHz limit
Serial.println(F("SD begin() failed"));
for(;;); // Fatal error, do not continue
}
#else
// SPI or QSPI flash requires two steps, one to access the bare flash
// memory itself, then the second to access the filesystem within...
if(!flash.begin()) {
Serial.println(F("flash begin() failed"));
for(;;);
}
if(!filesys.begin(&flash)) {
Serial.println(F("filesys begin() failed"));
for(;;);
}
#endif
Serial.println(F("OK!"));
// Fill screen blue. Not a required step, this just shows that we're
// successfully communicating with the screen.
tft.fillScreen(ILI9341_BLUE);
// Load full-screen BMP file 'purple.bmp' at position (0,0) (top left).
// Notice the 'reader' object performs this, with 'tft' as an argument.
Serial.print(F("Loading purple.bmp to screen..."));
stat = reader.drawBMP("/purple.bmp", tft, 0, 0);
// (Absolute path isn't necessary on most devices, but something
// with the ESP32 SD library seems to require it.)
reader.printStatus(stat); // How'd we do?
// Query the dimensions of image 'parrot.bmp' WITHOUT loading to screen:
Serial.print(F("Querying parrot.bmp image size..."));
stat = reader.bmpDimensions("/parrot.bmp", &width, &height);
reader.printStatus(stat); // How'd we do?
if(stat == IMAGE_SUCCESS) { // If it worked, print image size...
Serial.print(F("Image dimensions: "));
Serial.print(width);
Serial.write('x');
Serial.println(height);
}
// Load small BMP 'wales.bmp' into a GFX canvas in RAM. This should
// fail gracefully on AVR and other small devices, meaning the image
// will not load, but this won't make the program stop or crash, it
// just continues on without it.
Serial.print(F("Loading wales.bmp to canvas..."));
stat = reader.loadBMP("/wales.bmp", img);
reader.printStatus(stat); // How'd we do?
delay(2000); // Pause 2 seconds before moving on to loop()
}
void loop() {
for(int r=0; r<4; r++) { // For each of 4 rotations...
tft.setRotation(r); // Set rotation
tft.fillScreen(0); // and clear screen
// Load 4 copies of the 'parrot.bmp' image to the screen, some
// partially off screen edges to demonstrate clipping. Globals
// 'width' and 'height' were set by bmpDimensions() call in setup().
for(int i=0; i<4; i++) {
reader.drawBMP("/parrot.bmp", tft,
(tft.width() * i / 3) - (width / 2),
(tft.height() * i / 3) - (height / 2));
}
delay(1000); // Pause 1 sec.
// Draw 50 Welsh dragon flags in random positions. This has no effect
// on memory-constrained boards like the Arduino Uno, where the image
// failed to load due to insufficient RAM, but it's NOT fatal.
for(int i=0; i<50; i++) {
// Rather than reader.drawBMP() (which works from SD card),
// a different function is used for RAM-resident images:
img.draw(tft, // Pass in tft object
(int16_t)random(-img.width() , tft.width()) , // Horiz pos.
(int16_t)random(-img.height(), tft.height())); // Vert pos
// Reiterating a prior point: img.draw() does nothing and returns
// if the image failed to load. It's unfortunate but not disastrous.
}
delay(2000); // Pause 2 sec.
}
}

View file

@ -1,149 +0,0 @@
// Adafruit_ImageReader test for Adafruit ILI9341 TFT Shield for Arduino.
// Demonstrates loading images from SD card or flash memory to the screen,
// to RAM, and how to query image file dimensions.
// Requires three BMP files in root directory of SD card:
// purple.bmp, parrot.bmp and wales.bmp.
// As written, this uses the microcontroller's SPI interface for the screen
// (not 'bitbang') and must be wired to specific pins (e.g. for Arduino Uno,
// MOSI = pin 11, MISO = 12, SCK = 13). Other pins are configurable below.
#include <Adafruit_GFX.h> // Core graphics library
#include <Adafruit_ILI9341.h> // Hardware-specific library
#include <SdFat_Adafruit_Fork.h> // SD card & FAT filesystem library
#include <Adafruit_SPIFlash.h> // SPI / QSPI flash library
#include <Adafruit_ImageReader.h> // Image-reading functions
// Comment out the next line to load from SPI/QSPI flash instead of SD card:
#define USE_SD_CARD
// TFT display and SD card share the hardware SPI interface, using
// 'select' pins for each to identify the active device on the bus.
#define SD_CS 4 // SD card select pin
#define TFT_CS 10 // TFT select pin
#define TFT_DC 9 // TFT display/command pin
#if defined(USE_SD_CARD)
SdFat SD; // SD card filesystem
Adafruit_ImageReader reader(SD); // Image-reader object, pass in SD filesys
#else
// SPI or QSPI flash filesystem (i.e. CIRCUITPY drive)
#if defined(__SAMD51__) || defined(NRF52840_XXAA)
Adafruit_FlashTransport_QSPI flashTransport(PIN_QSPI_SCK, PIN_QSPI_CS,
PIN_QSPI_IO0, PIN_QSPI_IO1, PIN_QSPI_IO2, PIN_QSPI_IO3);
#else
#if (SPI_INTERFACES_COUNT == 1)
Adafruit_FlashTransport_SPI flashTransport(SS, &SPI);
#else
Adafruit_FlashTransport_SPI flashTransport(SS1, &SPI1);
#endif
#endif
Adafruit_SPIFlash flash(&flashTransport);
FatVolume filesys;
Adafruit_ImageReader reader(filesys); // Image-reader, pass in flash filesys
#endif
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);
Adafruit_Image img; // An image loaded into RAM
int32_t width = 0, // BMP image dimensions
height = 0;
void setup(void) {
ImageReturnCode stat; // Status from image-reading functions
Serial.begin(9600);
#if !defined(ESP32)
while(!Serial); // Wait for Serial Monitor before continuing
#endif
tft.begin(); // Initialize screen
// The Adafruit_ImageReader constructor call (above, before setup())
// accepts an uninitialized SdFat or FatVolume object. This MUST
// BE INITIALIZED before using any of the image reader functions!
Serial.print(F("Initializing filesystem..."));
#if defined(USE_SD_CARD)
// SD card is pretty straightforward, a single call...
if(!SD.begin(SD_CS, SD_SCK_MHZ(25))) { // ESP32 requires 25 MHz limit
Serial.println(F("SD begin() failed"));
for(;;); // Fatal error, do not continue
}
#else
// SPI or QSPI flash requires two steps, one to access the bare flash
// memory itself, then the second to access the filesystem within...
if(!flash.begin()) {
Serial.println(F("flash begin() failed"));
for(;;);
}
if(!filesys.begin(&flash)) {
Serial.println(F("filesys begin() failed"));
for(;;);
}
#endif
Serial.println(F("OK!"));
// Fill screen blue. Not a required step, this just shows that we're
// successfully communicating with the screen.
tft.fillScreen(ILI9341_BLUE);
// Load full-screen BMP file 'purple.bmp' at position (0,0) (top left).
// Notice the 'reader' object performs this, with 'tft' as an argument.
Serial.print(F("Loading purple.bmp to screen..."));
stat = reader.drawBMP("/purple.bmp", tft, 0, 0);
reader.printStatus(stat); // How'd we do?
// Query the dimensions of image 'parrot.bmp' WITHOUT loading to screen:
Serial.print(F("Querying parrot.bmp image size..."));
stat = reader.bmpDimensions("/parrot.bmp", &width, &height);
reader.printStatus(stat); // How'd we do?
if(stat == IMAGE_SUCCESS) { // If it worked, print image size...
Serial.print(F("Image dimensions: "));
Serial.print(width);
Serial.write('x');
Serial.println(height);
}
// Load small BMP 'wales.bmp' into a GFX canvas in RAM. This should fail
// gracefully on Arduino Uno and other small devices, meaning the image
// will not load, but this won't make the program stop or crash, it just
// continues on without it. Should work on Arduino Mega, Zero, etc.
Serial.print(F("Loading wales.bmp to canvas..."));
stat = reader.loadBMP("/wales.bmp", img);
reader.printStatus(stat); // How'd we do?
delay(2000); // Pause 2 seconds before moving on to loop()
}
void loop() {
for(int r=0; r<4; r++) { // For each of 4 rotations...
tft.setRotation(r); // Set rotation
tft.fillScreen(0); // and clear screen
// Load 4 copies of the 'parrot.bmp' image to the screen, some
// partially off screen edges to demonstrate clipping. Globals
// 'width' and 'height' were set by bmpDimensions() call in setup().
for(int i=0; i<4; i++) {
reader.drawBMP("/parrot.bmp", tft,
(tft.width() * i / 3) - (width / 2),
(tft.height() * i / 3) - (height / 2));
}
delay(1000); // Pause 1 sec.
// Draw 50 Welsh dragon flags in random positions. This has no effect
// on memory-constrained boards like the Arduino Uno, where the image
// failed to load due to insufficient RAM, but it's NOT fatal.
for(int i=0; i<50; i++) {
// Rather than reader.drawBMP() (which works from SD card),
// a different function is used for RAM-resident images:
img.draw(tft, // Pass in tft object
(int16_t)random(-img.width() , tft.width()) , // Horiz pos.
(int16_t)random(-img.height(), tft.height())); // Vert pos
// Reiterating a prior point: img.draw() does nothing and returns
// if the image failed to load. It's unfortunate but not disastrous.
}
delay(2000); // Pause 2 sec.
}
}

View file

@ -1,162 +0,0 @@
// Adafruit_ImageReader test for Adafruit ST7735 TFT Shield for Arduino.
// Demonstrates loading images from SD card or flash memory to the screen,
// to RAM, and how to query image file dimensions.
// Requires three BMP files in root directory of SD card:
// parrot.bmp, miniwoof.bmp and wales.bmp.
// This ONLY demonstrates BMP loading. Other features of the shield
// (stick, buttons, backlight control) are NOT demonstrated here,
// see other ST7735 library examples for that.
// CURRENT TFT SHIELD REQUIRES Adafruit_Seesaw LIBRARY.
#include <Adafruit_GFX.h> // Core graphics library
#include <Adafruit_ST7735.h> // Hardware-specific library
#include <SdFat_Adafruit_Fork.h> // SD card & FAT filesystem library
#include <Adafruit_SPIFlash.h> // SPI / QSPI flash library
#include <Adafruit_ImageReader.h> // Image-reading functions
#include <Adafruit_seesaw.h> // IF EARLY TFT SHIELD (no Seesaw),
#include <Adafruit_TFTShield18.h> // THESE TWO LINES CAN BE REMOVED.
// Comment out the next line to load from SPI/QSPI flash instead of SD card:
#define USE_SD_CARD
// TFT display and SD card share the hardware SPI interface, using
// 'select' pins for each to identify the active device on the bus.
#define SD_CS 4 // SD card select pin
#define TFT_CS 10 // TFT select pin
#define TFT_DC 8 // TFT display/command pin
#define TFT_RST -1 // TFT reset pin
#if defined(USE_SD_CARD)
SdFat SD; // SD card filesystem
Adafruit_ImageReader reader(SD); // Image-reader object, pass in SD filesys
#else
// SPI or QSPI flash filesystem (i.e. CIRCUITPY drive)
#if defined(__SAMD51__) || defined(NRF52840_XXAA)
Adafruit_FlashTransport_QSPI flashTransport(PIN_QSPI_SCK, PIN_QSPI_CS,
PIN_QSPI_IO0, PIN_QSPI_IO1, PIN_QSPI_IO2, PIN_QSPI_IO3);
#else
#if (SPI_INTERFACES_COUNT == 1)
Adafruit_FlashTransport_SPI flashTransport(SS, &SPI);
#else
Adafruit_FlashTransport_SPI flashTransport(SS1, &SPI1);
#endif
#endif
Adafruit_SPIFlash flash(&flashTransport);
FatVolume filesys;
Adafruit_ImageReader reader(filesys); // Image-reader, pass in flash filesys
#endif
Adafruit_TFTShield18 seesaw;
Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_RST);
Adafruit_Image img; // An image loaded into RAM
int32_t width = 0, // BMP image dimensions
height = 0;
void setup(void) {
ImageReturnCode stat; // Status from image-reading functions
Serial.begin(9600);
#if !defined(ESP32)
while(!Serial); // Wait for Serial Monitor before continuing
#endif
// Normally we'd check the return value of seesaw.begin() to
// confirm we're talking to the chip...but in this example we'll
// skip it and assume it's there. This way the code works the
// same on both new and old (pre-Seesaw) TFT shields:
seesaw.begin();
seesaw.tftReset();
seesaw.setBacklight(TFTSHIELD_BACKLIGHT_ON);
tft.initR(INITR_BLACKTAB); // Initialize screen
// The Adafruit_ImageReader constructor call (above, before setup())
// accepts an uninitialized SdFat or FatVolume object. This MUST
// BE INITIALIZED before using any of the image reader functions!
Serial.print(F("Initializing filesystem..."));
#if defined(USE_SD_CARD)
// SD card is pretty straightforward, a single call...
if(!SD.begin(SD_CS, SD_SCK_MHZ(25))) { // ESP32 requires 25 MHz limit
Serial.println(F("SD begin() failed"));
for(;;); // Fatal error, do not continue
}
#else
// SPI or QSPI flash requires two steps, one to access the bare flash
// memory itself, then the second to access the filesystem within...
if(!flash.begin()) {
Serial.println(F("flash begin() failed"));
for(;;);
}
if(!filesys.begin(&flash)) {
Serial.println(F("filesys begin() failed"));
for(;;);
}
#endif
Serial.println(F("OK!"));
// Fill screen blue. Not a required step, this just shows that we're
// successfully communicating with the screen.
tft.fillScreen(ST7735_BLUE);
// Load full-screen BMP file 'parrot.bmp' at position (0,0) (top left).
// Notice the 'reader' object performs this, with 'tft' as an argument.
Serial.print(F("Loading parrot.bmp to screen..."));
stat = reader.drawBMP("/parrot.bmp", tft, 0, 0);
reader.printStatus(stat); // How'd we do?
// Query the dimensions of image 'miniwoof.bmp' WITHOUT loading to screen:
Serial.print(F("Querying miniwoof.bmp image size..."));
stat = reader.bmpDimensions("/miniwoof.bmp", &width, &height);
reader.printStatus(stat); // How'd we do?
if(stat == IMAGE_SUCCESS) { // If it worked, print image size...
Serial.print(F("Image dimensions: "));
Serial.print(width);
Serial.write('x');
Serial.println(height);
}
// Load small BMP 'wales.bmp' into a GFX canvas in RAM. This should fail
// gracefully on Arduino Uno and other small devices, meaning the image
// will not load, but this won't make the program stop or crash, it just
// continues on without it. Should work on Arduino Mega, Zero, etc.
Serial.print(F("Loading wales.bmp to canvas..."));
stat = reader.loadBMP("/wales.bmp", img);
reader.printStatus(stat); // How'd we do?
delay(2000); // Pause 2 seconds before moving on to loop()
}
void loop() {
for(int r=0; r<4; r++) { // For each of 4 rotations...
tft.setRotation(r); // Set rotation
tft.fillScreen(0); // and clear screen
// Load 4 copies of the 'miniwoof.bmp' image to the screen, some
// partially off screen edges to demonstrate clipping. Globals
// 'width' and 'height' were set by bmpDimensions() call in setup().
for(int i=0; i<4; i++) {
reader.drawBMP("/miniwoof.bmp", tft,
(tft.width() * i / 3) - (width / 2),
(tft.height() * i / 3) - (height / 2));
}
delay(1000); // Pause 1 sec.
// Draw 50 Welsh dragon flags in random positions. This has no effect
// on memory-constrained boards like the Arduino Uno, where the image
// failed to load due to insufficient RAM, but it's NOT fatal.
for(int i=0; i<50; i++) {
// Rather than reader.drawBMP() (which works from SD card),
// a different function is used for RAM-resident images:
img.draw(tft, // Pass in tft object
(int16_t)random(-img.width() , tft.width()) , // Horiz pos.
(int16_t)random(-img.height(), tft.height())); // Vert pos
// Reiterating a prior point: img.draw() does nothing and returns
// if the image failed to load. It's unfortunate but not disastrous.
}
delay(2000); // Pause 2 sec.
}
}

View file

@ -1,137 +0,0 @@
// Adafruit_ImageReader test for Adafruit TFT Gizmo for CircuitPlayground.
// Demonstrates loading images to the screen, to RAM, and how to query
// image file dimensions.
// Requires three BMP files in root directory of SD card:
// parrot.bmp, miniwoof.bmp and wales.bmp.
#include <Adafruit_GFX.h> // Core graphics library
#include <Adafruit_ST7789.h> // Hardware-specific library for ST7789
#include <Adafruit_SPIFlash.h> // SPI / QSPI flash library
#include <Adafruit_ImageReader.h> // Image-reading functions
// TFT display and SD card share the hardware SPI interface, using
// 'select' pins for each to identify the active device on the bus.
#define TFT_CS 0
#define TFT_RST -1 // Or set to -1 and connect to Arduino RESET pin
#define TFT_DC 1
#define TFT_BACKLIGHT PIN_A3 // Display backlight pin
// SPI or QSPI flash filesystem (i.e. CIRCUITPY drive)
#if defined(__SAMD51__) || defined(NRF52840_XXAA)
Adafruit_FlashTransport_QSPI flashTransport(PIN_QSPI_SCK, PIN_QSPI_CS,
PIN_QSPI_IO0, PIN_QSPI_IO1, PIN_QSPI_IO2, PIN_QSPI_IO3);
#else
#if (SPI_INTERFACES_COUNT == 1 || defined(ADAFRUIT_CIRCUITPLAYGROUND_M0))
Adafruit_FlashTransport_SPI flashTransport(SS, &SPI);
#else
Adafruit_FlashTransport_SPI flashTransport(SS1, &SPI1);
#endif
#endif
// TFT SPI interface selection
#if (SPI_INTERFACES_COUNT == 1)
SPIClass* spi = &SPI;
#else
SPIClass* spi = &SPI1;
#endif
Adafruit_SPIFlash flash(&flashTransport);
FatVolume filesys;
Adafruit_ImageReader reader(filesys); // Image-reader, pass in flash filesys
Adafruit_ST7789 tft = Adafruit_ST7789(spi, TFT_CS, TFT_DC, TFT_RST);
Adafruit_Image img; // An image loaded into RAM
int32_t width = 0, // BMP image dimensions
height = 0;
void setup(void) {
ImageReturnCode stat; // Status from image-reading functions
Serial.begin(9600);
//while(!Serial); // Wait for Serial Monitor before continuing
tft.init(240, 240); // Init ST7789 240x240
tft.setRotation(2);
pinMode(TFT_BACKLIGHT, OUTPUT);
digitalWrite(TFT_BACKLIGHT, HIGH); // Backlight on
// The Adafruit_ImageReader constructor call (above, before setup())
// accepts an uninitialized SdFat or FatVolume object. This MUST
// BE INITIALIZED before using any of the image reader functions!
Serial.print(F("Initializing filesystem..."));
// SPI or QSPI flash requires two steps, one to access the bare flash
// memory itself, then the second to access the filesystem within...
if(!flash.begin()) {
Serial.println(F("flash begin() failed"));
for(;;);
}
if(!filesys.begin(&flash)) {
Serial.println(F("filesys begin() failed"));
for(;;);
}
Serial.println(F("OK!"));
// Fill screen blue. Not a required step, this just shows that we're
// successfully communicating with the screen.
tft.fillScreen(ST77XX_BLUE);
// Load full-screen BMP file 'adabot240.bmp' at position (0,0) (top left).
// Notice the 'reader' object performs this, with 'tft' as an argument.
Serial.print(F("Loading adabot240.bmp to screen..."));
stat = reader.drawBMP("/adabot240.bmp", tft, 0, 0);
reader.printStatus(stat); // How'd we do?
// Query the dimensions of image 'miniwoof.bmp' WITHOUT loading to screen:
Serial.print(F("Querying miniwoof.bmp image size..."));
stat = reader.bmpDimensions("/miniwoof.bmp", &width, &height);
reader.printStatus(stat); // How'd we do?
if(stat == IMAGE_SUCCESS) { // If it worked, print image size...
Serial.print(F("Image dimensions: "));
Serial.print(width);
Serial.write('x');
Serial.println(height);
}
// Load small BMP 'wales.bmp' into a GFX canvas in RAM.
Serial.print(F("Loading wales.bmp to canvas..."));
stat = reader.loadBMP("/wales.bmp", img);
reader.printStatus(stat); // How'd we do?
delay(2000); // Pause 2 seconds before moving on to loop()
}
void loop() {
for(int r=0; r<4; r++) { // For each of 4 rotations...
tft.setRotation(r); // Set rotation
tft.fillScreen(0); // and clear screen
// Load 4 copies of the 'miniwoof.bmp' image to the screen, some
// partially off screen edges to demonstrate clipping. Globals
// 'width' and 'height' were set by bmpDimensions() call in setup().
for(int i=0; i<4; i++) {
reader.drawBMP("/miniwoof.bmp", tft,
(tft.width() * i / 3) - (width / 2),
(tft.height() * i / 3) - (height / 2));
}
delay(1000); // Pause 1 sec.
// Draw 50 Welsh dragon flags in random positions. This has no effect
// on memory-constrained boards like the Arduino Uno, where the image
// failed to load due to insufficient RAM, but it's NOT fatal.
for(int i=0; i<50; i++) {
// Rather than reader.drawBMP() (which works from SD card),
// a different function is used for RAM-resident images:
img.draw(tft, // Pass in tft object
(int16_t)random(-img.width() , tft.width()) , // Horiz pos.
(int16_t)random(-img.height(), tft.height())); // Vert pos
// Reiterating a prior point: img.draw() does nothing and returns
// if the image failed to load. It's unfortunate but not disastrous.
}
delay(2000); // Pause 2 sec.
}
}

View file

@ -1,155 +0,0 @@
// Adafruit_ImageReader test for Adafruit E-Ink Breakouts.
// Demonstrates loading images from SD card or flash memory to the screen,
// to RAM, and how to query image file dimensions.
// Requires BMP file in root directory of QSPI Flash:
// blinka.bmp.
#include <Adafruit_GFX.h> // Core graphics library
#include "Adafruit_ThinkInk.h"
#include <SdFat_Adafruit_Fork.h> // SD card & FAT filesystem library
#include <Adafruit_SPIFlash.h> // SPI / QSPI flash library
#include <Adafruit_ImageReader_EPD.h> // Image-reading functions
// Comment out the next line to load from SPI/QSPI flash instead of SD card:
#define USE_SD_CARD
#define EPD_DC 10 // can be any pin, but required!
#define EPD_CS 9 // can be any pin, but required!
#define SRAM_CS 6 // can set to -1 to not use a pin (uses a lot of RAM!)
#define EPD_BUSY 7 // can set to -1 to not use a pin (will wait a fixed delay)
#define EPD_RESET 8 // can set to -1 and share with chip Reset (can't deep sleep)
#define SD_CS 5 // SD card chip select
// Mono Displays
//ThinkInk_154_Mono_D67 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
//ThinkInk_154_Mono_D27 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
//ThinkInk_213_Mono_B72 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
//ThinkInk_213_Mono_B73 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
//ThinkInk_213_Mono_BN display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
//ThinkInk_290_Mono_M06 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
//ThinkInk_420_Mono_BN display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
// Tri-Color Displays
//ThinkInk_154_Tricolor_Z17 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
//ThinkInk_154_Tricolor_RW display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
//ThinkInk_213_Tricolor_RW display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
//ThinkInk_213_Tricolor_Z16 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
//ThinkInk_270_Tricolor_C44 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
ThinkInk_290_Tricolor_Z10 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
//ThinkInk_420_Tricolor_RW display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
//ThinkInk_290_Tricolor_Z13 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
//ThinkInk_290_Tricolor_Z94 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
// Grayscale Displays
//ThinkInk_154_Grayscale4_T8 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
//ThinkInk_213_Grayscale4_T5 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
//ThinkInk_290_Grayscale4_T5 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
#if defined(USE_SD_CARD)
SdFat SD; // SD card filesystem
Adafruit_ImageReader_EPD reader(SD); // Image-reader object, pass in SD filesys
#else
// SPI or QSPI flash filesystem (i.e. CIRCUITPY drive)
#if defined(__SAMD51__) || defined(NRF52840_XXAA)
Adafruit_FlashTransport_QSPI flashTransport(PIN_QSPI_SCK, PIN_QSPI_CS,
PIN_QSPI_IO0, PIN_QSPI_IO1, PIN_QSPI_IO2, PIN_QSPI_IO3);
#else
#if (SPI_INTERFACES_COUNT == 1 || defined(ADAFRUIT_CIRCUITPLAYGROUND_M0))
Adafruit_FlashTransport_SPI flashTransport(SS, &SPI);
#else
Adafruit_FlashTransport_SPI flashTransport(SS1, &SPI1);
#endif
#endif
Adafruit_SPIFlash flash(&flashTransport);
FatVolume filesys;
Adafruit_ImageReader_EPD reader(filesys); // Image-reader, pass in flash filesys
#endif
Adafruit_Image_EPD img; // An image loaded into RAM
int32_t width = 0, // BMP image dimensions
height = 0;
void setup(void) {
ImageReturnCode stat; // Status from image-reading functions
Serial.begin(9600);
//while(!Serial); // Wait for Serial Monitor before continuing
display.begin();
#if defined(FLEXIBLE_213) || defined(FLEXIBLE_290)
// The flexible displays have different buffers and invert settings!
display.setBlackBuffer(1, false);
display.setColorBuffer(1, false);
#endif
// The Adafruit_ImageReader constructor call (above, before setup())
// accepts an uninitialized SdFat or FatVolume object. This MUST
// BE INITIALIZED before using any of the image reader functions!
Serial.print(F("Initializing filesystem..."));
// SPI or QSPI flash requires two steps, one to access the bare flash
// memory itself, then the second to access the filesystem within...
#if defined(USE_SD_CARD)
// SD card is pretty straightforward, a single call...
if(!SD.begin(SD_CS, SD_SCK_MHZ(10))) { // Breakouts require 10 MHz limit due to longer wires
Serial.println(F("SD begin() failed"));
for(;;); // Fatal error, do not continue
}
#else
// SPI or QSPI flash requires two steps, one to access the bare flash
// memory itself, then the second to access the filesystem within...
if(!flash.begin()) {
Serial.println(F("flash begin() failed"));
for(;;);
}
if(!filesys.begin(&flash)) {
Serial.println(F("filesys begin() failed"));
for(;;);
}
#endif
Serial.println(F("OK!"));
// Load full-screen BMP file 'blinka.bmp' at position (0,0) (top left).
// Notice the 'reader' object performs this, with 'epd' as an argument.
Serial.print(F("Loading blinka.bmp to canvas..."));
stat = reader.drawBMP((char *)"/blinka.bmp", display, 0, 0);
reader.printStatus(stat); // How'd we do?
display.display();
// Query the dimensions of image 'blinka.bmp' WITHOUT loading to screen:
Serial.print(F("Querying blinka.bmp image size..."));
stat = reader.bmpDimensions("blinka.bmp", &width, &height);
reader.printStatus(stat); // How'd we do?
if(stat == IMAGE_SUCCESS) { // If it worked, print image size...
Serial.print(F("Image dimensions: "));
Serial.print(width);
Serial.write('x');
Serial.println(height);
}
delay(30 * 1000); // Pause 30 seconds before continuing because it's eInk
Serial.print(F("Drawing canvas to EPD..."));
display.clearBuffer();
// Load small BMP 'blinka.bmp' into a GFX canvas in RAM. This should fail
// gracefully on Arduino Uno and other small devices, meaning the image
// will not load, but this won't make the program stop or crash, it just
// continues on without it. Should work on larger ram boards like M4, etc.
stat = reader.loadBMP("/blinka.bmp", img);
reader.printStatus(stat); // How'd we do?
}
void loop() {
for(int r=0; r<4; r++) { // For each of 4 rotations...
display.setRotation(r); // Set rotation
display.fillScreen(0); // and clear screen
display.clearBuffer();
img.draw(display, 0, 0);
display.display();
delay(30 * 1000); // Pause 30 sec.
}
}

View file

@ -0,0 +1,84 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Adafruit ImageReader Library: Adafruit_ImageReader.cpp File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">Adafruit ImageReader Library
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#define-members">Macros</a> </div>
<div class="headertitle">
<div class="title">Adafruit_ImageReader.cpp File Reference</div> </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><code>#include &quot;<a class="el" href="_adafruit___image_reader_8h_source.html">Adafruit_ImageReader.h</a>&quot;</code><br />
</div><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="define-members"></a>
Macros</h2></td></tr>
<tr class="memitem:a44f45736cdd7b9783bf58207c0be80dd"><td class="memItemLeft" align="right" valign="top"><a id="a44f45736cdd7b9783bf58207c0be80dd"></a>
#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_adafruit___image_reader_8cpp.html#a44f45736cdd7b9783bf58207c0be80dd">BUFPIXELS</a>&#160;&#160;&#160;200</td></tr>
<tr class="memdesc:a44f45736cdd7b9783bf58207c0be80dd"><td class="mdescLeft">&#160;</td><td class="mdescRight">200 * 5 = 1000 bytes <br /></td></tr>
<tr class="separator:a44f45736cdd7b9783bf58207c0be80dd"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.13
</small></address>
</body>
</html>

View file

@ -0,0 +1,141 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Adafruit ImageReader Library: Adafruit_ImageReader.h File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">Adafruit ImageReader Library
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#nested-classes">Classes</a> &#124;
<a href="#enum-members">Enumerations</a> </div>
<div class="headertitle">
<div class="title">Adafruit_ImageReader.h File Reference</div> </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><code>#include &quot;Adafruit_SPIFlash.h&quot;</code><br />
<code>#include &quot;Adafruit_SPITFT.h&quot;</code><br />
</div>
<p><a href="_adafruit___image_reader_8h_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
Classes</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_adafruit___image.html">Adafruit_Image</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">Data bundle returned with an image loaded to RAM. Used by ImageReader.loadBMP() and Image.draw(), not ImageReader.drawBMP(). <a href="class_adafruit___image.html#details">More...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_adafruit___image_reader.html">Adafruit_ImageReader</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">An optional adjunct to Adafruit_SPITFT that reads RGB BMP images (maybe others in the future) from a flash filesystem (SD card or SPI/QSPI flash). It's purposefully been made an entirely separate class (rather than part of SPITFT or GFX classes) so that Arduino code that uses GFX or SPITFT <em>without</em> image loading does not need to incur the RAM overhead and additional dependencies of the Adafruit_SPIFlash library by its mere inclusion. The syntaxes can therefore be a bit bizarre (passing display object as an argument), see examples for use. <a href="class_adafruit___image_reader.html#details">More...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="enum-members"></a>
Enumerations</h2></td></tr>
<tr class="memitem:acb79d38140fda8bba70a1282ecfaff51"><td class="memItemLeft" align="right" valign="top">enum &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_adafruit___image_reader_8h.html#acb79d38140fda8bba70a1282ecfaff51">ImageReturnCode</a> { <b>IMAGE_SUCCESS</b>,
<b>IMAGE_ERR_FILE_NOT_FOUND</b>,
<b>IMAGE_ERR_FORMAT</b>,
<b>IMAGE_ERR_MALLOC</b>
}</td></tr>
<tr class="separator:acb79d38140fda8bba70a1282ecfaff51"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a22f6b18e781e3c412e7d243f7de6aa5c"><td class="memItemLeft" align="right" valign="top">enum &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_adafruit___image_reader_8h.html#a22f6b18e781e3c412e7d243f7de6aa5c">ImageFormat</a> { <b>IMAGE_NONE</b>,
<b>IMAGE_1</b>,
<b>IMAGE_8</b>,
<b>IMAGE_16</b>
}</td></tr>
<tr class="separator:a22f6b18e781e3c412e7d243f7de6aa5c"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>This is part of Adafruit's ImageReader library for Arduino, designed to work with Adafruit_GFX plus a display device-specific library.</p>
<p>Adafruit invests time and resources providing this open source code, please support Adafruit and open-source hardware by purchasing products from Adafruit!</p>
<p>Written by Phil "PaintYourDragon" Burgess for Adafruit Industries.</p>
<p>BSD license, all text here must be included in any redistribution. </p>
</div><h2 class="groupheader">Enumeration Type Documentation</h2>
<a id="acb79d38140fda8bba70a1282ecfaff51"></a>
<h2 class="memtitle"><span class="permalink"><a href="#acb79d38140fda8bba70a1282ecfaff51">&#9670;&nbsp;</a></span>ImageReturnCode</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">enum <a class="el" href="_adafruit___image_reader_8h.html#acb79d38140fda8bba70a1282ecfaff51">ImageReturnCode</a></td>
</tr>
</table>
</div><div class="memdoc">
<p>Status codes returned by drawBMP() and loadBMP() </p>
</div>
</div>
<a id="a22f6b18e781e3c412e7d243f7de6aa5c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a22f6b18e781e3c412e7d243f7de6aa5c">&#9670;&nbsp;</a></span>ImageFormat</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">enum <a class="el" href="_adafruit___image_reader_8h.html#a22f6b18e781e3c412e7d243f7de6aa5c">ImageFormat</a></td>
</tr>
</table>
</div><div class="memdoc">
<p>Image formats returned by loadBMP() </p>
</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.13
</small></address>
</body>
</html>

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,94 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Adafruit ImageReader Library: Adafruit_ImageReader_EPD.h File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">Adafruit ImageReader Library
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#nested-classes">Classes</a> </div>
<div class="headertitle">
<div class="title">Adafruit_ImageReader_EPD.h File Reference</div> </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><code>#include &quot;Adafruit_EPD.h&quot;</code><br />
<code>#include &quot;<a class="el" href="_adafruit___image_reader_8h_source.html">Adafruit_ImageReader.h</a>&quot;</code><br />
</div>
<p><a href="_adafruit___image_reader___e_p_d_8h_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
Classes</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_adafruit___image___e_p_d.html">Adafruit_Image_EPD</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">Data bundle returned with an image loaded to RAM. Used by ImageReader.loadBMP() and Image.draw(), not ImageReader.drawBMP(). <a href="class_adafruit___image___e_p_d.html#details">More...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_adafruit___image_reader___e_p_d.html">Adafruit_ImageReader_EPD</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">An optional adjunct to Adafruit_EPD that reads RGB BMP images (maybe others in the future) from a flash filesystem (SD card or SPI/QSPI flash). It's purposefully been made an entirely separate class (rather than part of SPITFT or GFX classes) so that Arduino code that uses GFX or SPITFT <em>without</em> image loading does not need to incur the RAM overhead and additional dependencies of the Adafruit_SPIFlash library by its mere inclusion. The syntaxes can therefore be a bit bizarre (passing display object as an argument), see examples for use. <a href="class_adafruit___image_reader___e_p_d.html#details">More...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>This is part of Adafruit's ImageReader library for Arduino, designed to work with Adafruit_GFX plus a display device-specific library.</p>
<p>Adafruit invests time and resources providing this open source code, please support Adafruit and open-source hardware by purchasing products from Adafruit!</p>
<p>Written by Melissa LeBlanc-Williams for Adafruit Industries.</p>
<p>BSD license, all text here must be included in any redistribution. </p>
</div></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.13
</small></address>
</body>
</html>

File diff suppressed because one or more lines are too long

81
html/annotated.html Normal file
View file

@ -0,0 +1,81 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Adafruit ImageReader Library: Class List</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">Adafruit ImageReader Library
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="header">
<div class="headertitle">
<div class="title">Class List</div> </div>
</div><!--header-->
<div class="contents">
<div class="textblock">Here are the classes, structs, unions and interfaces with brief descriptions:</div><div class="directory">
<table class="directory">
<tr id="row_0_" class="even"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="class_adafruit___image.html" target="_self">Adafruit_Image</a></td><td class="desc">Data bundle returned with an image loaded to RAM. Used by ImageReader.loadBMP() and Image.draw(), not ImageReader.drawBMP() </td></tr>
<tr id="row_1_"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="class_adafruit___image___e_p_d.html" target="_self">Adafruit_Image_EPD</a></td><td class="desc">Data bundle returned with an image loaded to RAM. Used by ImageReader.loadBMP() and Image.draw(), not ImageReader.drawBMP() </td></tr>
<tr id="row_2_" class="even"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="class_adafruit___image_reader.html" target="_self">Adafruit_ImageReader</a></td><td class="desc">An optional adjunct to Adafruit_SPITFT that reads RGB BMP images (maybe others in the future) from a flash filesystem (SD card or SPI/QSPI flash). It's purposefully been made an entirely separate class (rather than part of SPITFT or GFX classes) so that Arduino code that uses GFX or SPITFT <em>without</em> image loading does not need to incur the RAM overhead and additional dependencies of the Adafruit_SPIFlash library by its mere inclusion. The syntaxes can therefore be a bit bizarre (passing display object as an argument), see examples for use </td></tr>
<tr id="row_3_"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="class_adafruit___image_reader___e_p_d.html" target="_self">Adafruit_ImageReader_EPD</a></td><td class="desc">An optional adjunct to Adafruit_EPD that reads RGB BMP images (maybe others in the future) from a flash filesystem (SD card or SPI/QSPI flash). It's purposefully been made an entirely separate class (rather than part of SPITFT or GFX classes) so that Arduino code that uses GFX or SPITFT <em>without</em> image loading does not need to incur the RAM overhead and additional dependencies of the Adafruit_SPIFlash library by its mere inclusion. The syntaxes can therefore be a bit bizarre (passing display object as an argument), see examples for use </td></tr>
</table>
</div><!-- directory -->
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.13
</small></address>
</body>
</html>

BIN
html/bc_s.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 676 B

BIN
html/bdwn.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 B

View file

@ -0,0 +1,94 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Adafruit ImageReader Library: Member List</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">Adafruit ImageReader Library
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
</div><!-- top -->
<div class="header">
<div class="headertitle">
<div class="title">Adafruit_Image Member List</div> </div>
</div><!--header-->
<div class="contents">
<p>This is the complete list of members for <a class="el" href="class_adafruit___image.html">Adafruit_Image</a>, including all inherited members.</p>
<table class="directory">
<tr class="even"><td class="entry"><a class="el" href="class_adafruit___image.html#aa5a1da89887e7a7df28cc55237ec152a">Adafruit_Image</a>(void)</td><td class="entry"><a class="el" href="class_adafruit___image.html">Adafruit_Image</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="class_adafruit___image.html#a9341d83caa4d7e3787873a0e51d0ef6f">Adafruit_ImageReader</a> class</td><td class="entry"><a class="el" href="class_adafruit___image.html">Adafruit_Image</a></td><td class="entry"><span class="mlabel">friend</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="class_adafruit___image.html#ad8ca08bb1ea16535c4c7dd4e29f3bce0">canvas</a></td><td class="entry"><a class="el" href="class_adafruit___image.html">Adafruit_Image</a></td><td class="entry"><span class="mlabel">protected</span></td></tr>
<tr><td class="entry"><a class="el" href="class_adafruit___image.html#a1e1ddc95dacb90317de556031b25a2ba">canvas1</a></td><td class="entry"><a class="el" href="class_adafruit___image.html">Adafruit_Image</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="class_adafruit___image.html#a50f37a60aa0cd46ef2464bd309279adc">canvas16</a></td><td class="entry"><a class="el" href="class_adafruit___image.html">Adafruit_Image</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="class_adafruit___image.html#a927a61bc53c96761065f51e7aac1e225">canvas8</a></td><td class="entry"><a class="el" href="class_adafruit___image.html">Adafruit_Image</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="class_adafruit___image.html#a775ca41829f41398bea9e719d0297e34">dealloc</a>(void)</td><td class="entry"><a class="el" href="class_adafruit___image.html">Adafruit_Image</a></td><td class="entry"><span class="mlabel">protected</span></td></tr>
<tr><td class="entry"><a class="el" href="class_adafruit___image.html#a96f77402b729e22bf375ec07116d91cd">draw</a>(Adafruit_SPITFT &amp;tft, int16_t x, int16_t y)</td><td class="entry"><a class="el" href="class_adafruit___image.html">Adafruit_Image</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="class_adafruit___image.html#a82b9a1f0d9c219a68fc541ef80523a0d">format</a></td><td class="entry"><a class="el" href="class_adafruit___image.html">Adafruit_Image</a></td><td class="entry"><span class="mlabel">protected</span></td></tr>
<tr><td class="entry"><a class="el" href="class_adafruit___image.html#afe83af3e18c81c583c7a88a395fdbe85">getCanvas</a>(void) const</td><td class="entry"><a class="el" href="class_adafruit___image.html">Adafruit_Image</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="class_adafruit___image.html#a7148217b19c3f9d13b02bbf09b5bbd9d">getFormat</a>(void) const</td><td class="entry"><a class="el" href="class_adafruit___image.html">Adafruit_Image</a></td><td class="entry"><span class="mlabel">inline</span></td></tr>
<tr><td class="entry"><a class="el" href="class_adafruit___image.html#a4edc497bd644efbdc1caa39abbd672a2">getMask</a>(void) const</td><td class="entry"><a class="el" href="class_adafruit___image.html">Adafruit_Image</a></td><td class="entry"><span class="mlabel">inline</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="class_adafruit___image.html#abf50c5b45823ae7717027532df7e9345">getPalette</a>(void) const</td><td class="entry"><a class="el" href="class_adafruit___image.html">Adafruit_Image</a></td><td class="entry"><span class="mlabel">inline</span></td></tr>
<tr><td class="entry"><a class="el" href="class_adafruit___image.html#a41e38c82ffe69f9b28f694a4427b05fe">height</a>(void) const</td><td class="entry"><a class="el" href="class_adafruit___image.html">Adafruit_Image</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="class_adafruit___image.html#a11231812b0043d596b4f89cba6752e2a">mask</a></td><td class="entry"><a class="el" href="class_adafruit___image.html">Adafruit_Image</a></td><td class="entry"><span class="mlabel">protected</span></td></tr>
<tr><td class="entry"><a class="el" href="class_adafruit___image.html#a393bf73f70871257cf41e5b1ddca5d6e">palette</a></td><td class="entry"><a class="el" href="class_adafruit___image.html">Adafruit_Image</a></td><td class="entry"><span class="mlabel">protected</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="class_adafruit___image.html#a72b36c5a0721b34a82420e325f0b793c">width</a>(void) const</td><td class="entry"><a class="el" href="class_adafruit___image.html">Adafruit_Image</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="class_adafruit___image.html#a649c3d18296356105831073fa1776661">~Adafruit_Image</a>(void)</td><td class="entry"><a class="el" href="class_adafruit___image.html">Adafruit_Image</a></td><td class="entry"></td></tr>
</table></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.13
</small></address>
</body>
</html>

View file

@ -0,0 +1,445 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Adafruit ImageReader Library: Adafruit_Image Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">Adafruit ImageReader Library
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pro-methods">Protected Member Functions</a> &#124;
<a href="#pro-attribs">Protected Attributes</a> &#124;
<a href="#friends">Friends</a> &#124;
<a href="class_adafruit___image-members.html">List of all members</a> </div>
<div class="headertitle">
<div class="title">Adafruit_Image Class Reference</div> </div>
</div><!--header-->
<div class="contents">
<p>Data bundle returned with an image loaded to RAM. Used by ImageReader.loadBMP() and Image.draw(), not ImageReader.drawBMP().
<a href="class_adafruit___image.html#details">More...</a></p>
<p><code>#include &lt;<a class="el" href="_adafruit___image_reader_8h_source.html">Adafruit_ImageReader.h</a>&gt;</code></p>
<div class="dynheader">
Inheritance diagram for Adafruit_Image:</div>
<div class="dyncontent">
<div class="center">
<img src="class_adafruit___image.png" usemap="#Adafruit_5FImage_map" alt=""/>
<map id="Adafruit_5FImage_map" name="Adafruit_5FImage_map">
<area href="class_adafruit___image___e_p_d.html" title="Data bundle returned with an image loaded to RAM. Used by ImageReader.loadBMP() and Image..." alt="Adafruit_Image_EPD" shape="rect" coords="0,56,129,80"/>
</map>
</div></div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:aa5a1da89887e7a7df28cc55237ec152a"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_adafruit___image.html#aa5a1da89887e7a7df28cc55237ec152a">Adafruit_Image</a> (void)</td></tr>
<tr class="memdesc:aa5a1da89887e7a7df28cc55237ec152a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Constructor. <a href="#aa5a1da89887e7a7df28cc55237ec152a">More...</a><br /></td></tr>
<tr class="separator:aa5a1da89887e7a7df28cc55237ec152a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a649c3d18296356105831073fa1776661"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_adafruit___image.html#a649c3d18296356105831073fa1776661">~Adafruit_Image</a> (void)</td></tr>
<tr class="memdesc:a649c3d18296356105831073fa1776661"><td class="mdescLeft">&#160;</td><td class="mdescRight">Destructor. <a href="#a649c3d18296356105831073fa1776661">More...</a><br /></td></tr>
<tr class="separator:a649c3d18296356105831073fa1776661"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a72b36c5a0721b34a82420e325f0b793c"><td class="memItemLeft" align="right" valign="top">int16_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_adafruit___image.html#a72b36c5a0721b34a82420e325f0b793c">width</a> (void) const</td></tr>
<tr class="memdesc:a72b36c5a0721b34a82420e325f0b793c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get width of <a class="el" href="class_adafruit___image.html" title="Data bundle returned with an image loaded to RAM. Used by ImageReader.loadBMP() and Image...">Adafruit_Image</a> object. <a href="#a72b36c5a0721b34a82420e325f0b793c">More...</a><br /></td></tr>
<tr class="separator:a72b36c5a0721b34a82420e325f0b793c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a41e38c82ffe69f9b28f694a4427b05fe"><td class="memItemLeft" align="right" valign="top">int16_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_adafruit___image.html#a41e38c82ffe69f9b28f694a4427b05fe">height</a> (void) const</td></tr>
<tr class="memdesc:a41e38c82ffe69f9b28f694a4427b05fe"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get height of <a class="el" href="class_adafruit___image.html" title="Data bundle returned with an image loaded to RAM. Used by ImageReader.loadBMP() and Image...">Adafruit_Image</a> object. <a href="#a41e38c82ffe69f9b28f694a4427b05fe">More...</a><br /></td></tr>
<tr class="separator:a41e38c82ffe69f9b28f694a4427b05fe"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a96f77402b729e22bf375ec07116d91cd"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_adafruit___image.html#a96f77402b729e22bf375ec07116d91cd">draw</a> (Adafruit_SPITFT &amp;tft, int16_t x, int16_t y)</td></tr>
<tr class="memdesc:a96f77402b729e22bf375ec07116d91cd"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw image to an Adafruit_SPITFT-type display. <a href="#a96f77402b729e22bf375ec07116d91cd">More...</a><br /></td></tr>
<tr class="separator:a96f77402b729e22bf375ec07116d91cd"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7148217b19c3f9d13b02bbf09b5bbd9d"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_adafruit___image_reader_8h.html#a22f6b18e781e3c412e7d243f7de6aa5c">ImageFormat</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_adafruit___image.html#a7148217b19c3f9d13b02bbf09b5bbd9d">getFormat</a> (void) const</td></tr>
<tr class="memdesc:a7148217b19c3f9d13b02bbf09b5bbd9d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return canvas image format. <a href="#a7148217b19c3f9d13b02bbf09b5bbd9d">More...</a><br /></td></tr>
<tr class="separator:a7148217b19c3f9d13b02bbf09b5bbd9d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:afe83af3e18c81c583c7a88a395fdbe85"><td class="memItemLeft" align="right" valign="top">void *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_adafruit___image.html#afe83af3e18c81c583c7a88a395fdbe85">getCanvas</a> (void) const</td></tr>
<tr class="memdesc:afe83af3e18c81c583c7a88a395fdbe85"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return pointer to image's GFX canvas object. <a href="#afe83af3e18c81c583c7a88a395fdbe85">More...</a><br /></td></tr>
<tr class="separator:afe83af3e18c81c583c7a88a395fdbe85"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:abf50c5b45823ae7717027532df7e9345"><td class="memItemLeft" align="right" valign="top">uint16_t *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_adafruit___image.html#abf50c5b45823ae7717027532df7e9345">getPalette</a> (void) const</td></tr>
<tr class="memdesc:abf50c5b45823ae7717027532df7e9345"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return pointer to color palette. <a href="#abf50c5b45823ae7717027532df7e9345">More...</a><br /></td></tr>
<tr class="separator:abf50c5b45823ae7717027532df7e9345"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4edc497bd644efbdc1caa39abbd672a2"><td class="memItemLeft" align="right" valign="top">GFXcanvas1 *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_adafruit___image.html#a4edc497bd644efbdc1caa39abbd672a2">getMask</a> (void) const</td></tr>
<tr class="memdesc:a4edc497bd644efbdc1caa39abbd672a2"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return pointer to 1bpp image mask canvas. <a href="#a4edc497bd644efbdc1caa39abbd672a2">More...</a><br /></td></tr>
<tr class="separator:a4edc497bd644efbdc1caa39abbd672a2"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pro-methods"></a>
Protected Member Functions</h2></td></tr>
<tr class="memitem:a775ca41829f41398bea9e719d0297e34"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_adafruit___image.html#a775ca41829f41398bea9e719d0297e34">dealloc</a> (void)</td></tr>
<tr class="memdesc:a775ca41829f41398bea9e719d0297e34"><td class="mdescLeft">&#160;</td><td class="mdescRight">Free/deinitialize variables. <a href="#a775ca41829f41398bea9e719d0297e34">More...</a><br /></td></tr>
<tr class="separator:a775ca41829f41398bea9e719d0297e34"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pro-attribs"></a>
Protected Attributes</h2></td></tr>
<tr class="memitem:ad8ca08bb1ea16535c4c7dd4e29f3bce0"><td class="memItemLeft" ><a id="ad8ca08bb1ea16535c4c7dd4e29f3bce0"></a>
union {</td></tr>
<tr class="memitem:a42a6b09ff3d2317e3611e3856c503923"><td class="memItemLeft" >
&#160;&#160;&#160;GFXcanvas1 *&#160;&#160;&#160;<a class="el" href="class_adafruit___image.html#a1e1ddc95dacb90317de556031b25a2ba">canvas1</a></td></tr>
<tr class="memdesc:a42a6b09ff3d2317e3611e3856c503923"><td class="mdescLeft">&#160;</td><td class="mdescRight">Canvas object if 1bpp format. <br /></td></tr>
<tr class="separator:a42a6b09ff3d2317e3611e3856c503923"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3a26c5e5ee67b134e35a194037fd633e"><td class="memItemLeft" >
&#160;&#160;&#160;GFXcanvas8 *&#160;&#160;&#160;<a class="el" href="class_adafruit___image.html#a927a61bc53c96761065f51e7aac1e225">canvas8</a></td></tr>
<tr class="memdesc:a3a26c5e5ee67b134e35a194037fd633e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Canvas object if 8bpp format. <br /></td></tr>
<tr class="separator:a3a26c5e5ee67b134e35a194037fd633e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aae0f90c9b38a3b8815f36ee12a181652"><td class="memItemLeft" >
&#160;&#160;&#160;GFXcanvas16 *&#160;&#160;&#160;<a class="el" href="class_adafruit___image.html#a50f37a60aa0cd46ef2464bd309279adc">canvas16</a></td></tr>
<tr class="memdesc:aae0f90c9b38a3b8815f36ee12a181652"><td class="mdescLeft">&#160;</td><td class="mdescRight">Canvas object if 16bpp. <br /></td></tr>
<tr class="separator:aae0f90c9b38a3b8815f36ee12a181652"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad8ca08bb1ea16535c4c7dd4e29f3bce0"><td class="memItemLeft" valign="top">}&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_adafruit___image.html#ad8ca08bb1ea16535c4c7dd4e29f3bce0">canvas</a></td></tr>
<tr class="memdesc:ad8ca08bb1ea16535c4c7dd4e29f3bce0"><td class="mdescLeft">&#160;</td><td class="mdescRight">Union of different GFXcanvas types. <br /></td></tr>
<tr class="separator:ad8ca08bb1ea16535c4c7dd4e29f3bce0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a11231812b0043d596b4f89cba6752e2a"><td class="memItemLeft" align="right" valign="top"><a id="a11231812b0043d596b4f89cba6752e2a"></a>
GFXcanvas1 *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_adafruit___image.html#a11231812b0043d596b4f89cba6752e2a">mask</a></td></tr>
<tr class="memdesc:a11231812b0043d596b4f89cba6752e2a"><td class="mdescLeft">&#160;</td><td class="mdescRight">1bpp image mask (or NULL) <br /></td></tr>
<tr class="separator:a11231812b0043d596b4f89cba6752e2a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a393bf73f70871257cf41e5b1ddca5d6e"><td class="memItemLeft" align="right" valign="top"><a id="a393bf73f70871257cf41e5b1ddca5d6e"></a>
uint16_t *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_adafruit___image.html#a393bf73f70871257cf41e5b1ddca5d6e">palette</a></td></tr>
<tr class="memdesc:a393bf73f70871257cf41e5b1ddca5d6e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Color palette for 8bpp image (or NULL) <br /></td></tr>
<tr class="separator:a393bf73f70871257cf41e5b1ddca5d6e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a82b9a1f0d9c219a68fc541ef80523a0d"><td class="memItemLeft" align="right" valign="top"><a id="a82b9a1f0d9c219a68fc541ef80523a0d"></a>
uint8_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_adafruit___image.html#a82b9a1f0d9c219a68fc541ef80523a0d">format</a></td></tr>
<tr class="memdesc:a82b9a1f0d9c219a68fc541ef80523a0d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Canvas bundle type in use. <br /></td></tr>
<tr class="separator:a82b9a1f0d9c219a68fc541ef80523a0d"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="friends"></a>
Friends</h2></td></tr>
<tr class="memitem:a9341d83caa4d7e3787873a0e51d0ef6f"><td class="memItemLeft" align="right" valign="top"><a id="a9341d83caa4d7e3787873a0e51d0ef6f"></a>
class&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_adafruit___image.html#a9341d83caa4d7e3787873a0e51d0ef6f">Adafruit_ImageReader</a></td></tr>
<tr class="memdesc:a9341d83caa4d7e3787873a0e51d0ef6f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Loading occurs here. <br /></td></tr>
<tr class="separator:a9341d83caa4d7e3787873a0e51d0ef6f"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Data bundle returned with an image loaded to RAM. Used by ImageReader.loadBMP() and Image.draw(), not ImageReader.drawBMP(). </p>
</div><h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a id="aa5a1da89887e7a7df28cc55237ec152a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aa5a1da89887e7a7df28cc55237ec152a">&#9670;&nbsp;</a></span>Adafruit_Image()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">Adafruit_Image::Adafruit_Image </td>
<td>(</td>
<td class="paramtype">void&#160;</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Constructor. </p>
<dl class="section return"><dt>Returns</dt><dd>'Empty' <a class="el" href="class_adafruit___image.html" title="Data bundle returned with an image loaded to RAM. Used by ImageReader.loadBMP() and Image...">Adafruit_Image</a> object. </dd></dl>
</div>
</div>
<a id="a649c3d18296356105831073fa1776661"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a649c3d18296356105831073fa1776661">&#9670;&nbsp;</a></span>~Adafruit_Image()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">Adafruit_Image::~Adafruit_Image </td>
<td>(</td>
<td class="paramtype">void&#160;</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Destructor. </p>
<dl class="section return"><dt>Returns</dt><dd>None (void). </dd></dl>
</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a id="a72b36c5a0721b34a82420e325f0b793c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a72b36c5a0721b34a82420e325f0b793c">&#9670;&nbsp;</a></span>width()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int16_t Adafruit_Image::width </td>
<td>(</td>
<td class="paramtype">void&#160;</td>
<td class="paramname"></td><td>)</td>
<td> const</td>
</tr>
</table>
</div><div class="memdoc">
<p>Get width of <a class="el" href="class_adafruit___image.html" title="Data bundle returned with an image loaded to RAM. Used by ImageReader.loadBMP() and Image...">Adafruit_Image</a> object. </p>
<dl class="section return"><dt>Returns</dt><dd>Width in pixels, or 0 if no image loaded. </dd></dl>
</div>
</div>
<a id="a41e38c82ffe69f9b28f694a4427b05fe"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a41e38c82ffe69f9b28f694a4427b05fe">&#9670;&nbsp;</a></span>height()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int16_t Adafruit_Image::height </td>
<td>(</td>
<td class="paramtype">void&#160;</td>
<td class="paramname"></td><td>)</td>
<td> const</td>
</tr>
</table>
</div><div class="memdoc">
<p>Get height of <a class="el" href="class_adafruit___image.html" title="Data bundle returned with an image loaded to RAM. Used by ImageReader.loadBMP() and Image...">Adafruit_Image</a> object. </p>
<dl class="section return"><dt>Returns</dt><dd>Height in pixels, or 0 if no image loaded. </dd></dl>
</div>
</div>
<a id="a96f77402b729e22bf375ec07116d91cd"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a96f77402b729e22bf375ec07116d91cd">&#9670;&nbsp;</a></span>draw()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void Adafruit_Image::draw </td>
<td>(</td>
<td class="paramtype">Adafruit_SPITFT &amp;&#160;</td>
<td class="paramname"><em>tft</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int16_t&#160;</td>
<td class="paramname"><em>x</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int16_t&#160;</td>
<td class="paramname"><em>y</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Draw image to an Adafruit_SPITFT-type display. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">tft</td><td>Screen to draw to (any Adafruit_SPITFT-derived class). </td></tr>
<tr><td class="paramname">x</td><td>Horizontal 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. </td></tr>
<tr><td class="paramname">y</td><td>Vertical offset in pixels; top edge = 0, positive = down. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>None (void). </dd></dl>
</div>
</div>
<a id="a7148217b19c3f9d13b02bbf09b5bbd9d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a7148217b19c3f9d13b02bbf09b5bbd9d">&#9670;&nbsp;</a></span>getFormat()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="_adafruit___image_reader_8h.html#a22f6b18e781e3c412e7d243f7de6aa5c">ImageFormat</a> Adafruit_Image::getFormat </td>
<td>(</td>
<td class="paramtype">void&#160;</td>
<td class="paramname"></td><td>)</td>
<td> const</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Return canvas image format. </p>
<dl class="section return"><dt>Returns</dt><dd>An ImageFormat type: IMAGE_1 for a GFXcanvas1, IMAGE_8 for a GFXcanvas8, IMAGE_16 for a GFXcanvas16, IMAGE_NONE if no canvas currently allocated. </dd></dl>
</div>
</div>
<a id="afe83af3e18c81c583c7a88a395fdbe85"></a>
<h2 class="memtitle"><span class="permalink"><a href="#afe83af3e18c81c583c7a88a395fdbe85">&#9670;&nbsp;</a></span>getCanvas()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void * Adafruit_Image::getCanvas </td>
<td>(</td>
<td class="paramtype">void&#160;</td>
<td class="paramname"></td><td>)</td>
<td> const</td>
</tr>
</table>
</div><div class="memdoc">
<p>Return pointer to image's GFX canvas object. </p>
<dl class="section return"><dt>Returns</dt><dd>void* pointer, must be type-converted to a GFX canvas type consistent with the image's format (e.g. GFXcanvas16* if image format is IMAGE_16 &ndash; use image.format() to determine the image format). Returns NULL if no canvas allocated. </dd></dl>
<dl class="section note"><dt>Note</dt><dd>Calling function must type-convert the result to one of the supported canvas object types, and must act accordingly with regard to calling functions on this object (e.g. doing the right thing with an 8- or 16-bit canvas, each has distinct drawing functions, things like that). This is here mostly to allow more advanced applications to get directly into an image's canvas object (and, in turn, its raw graphics buffer via canvas-&gt;getBuffer()) to move data in or out. Potential for a lot of mayhem here if used wrong. </dd></dl>
</div>
</div>
<a id="abf50c5b45823ae7717027532df7e9345"></a>
<h2 class="memtitle"><span class="permalink"><a href="#abf50c5b45823ae7717027532df7e9345">&#9670;&nbsp;</a></span>getPalette()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">uint16_t* Adafruit_Image::getPalette </td>
<td>(</td>
<td class="paramtype">void&#160;</td>
<td class="paramname"></td><td>)</td>
<td> const</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Return pointer to color palette. </p>
<dl class="section return"><dt>Returns</dt><dd>Pointer to an array of 16-bit color values, or NULL if no palette associated with image. </dd></dl>
</div>
</div>
<a id="a4edc497bd644efbdc1caa39abbd672a2"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a4edc497bd644efbdc1caa39abbd672a2">&#9670;&nbsp;</a></span>getMask()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">GFXcanvas1* Adafruit_Image::getMask </td>
<td>(</td>
<td class="paramtype">void&#160;</td>
<td class="paramname"></td><td>)</td>
<td> const</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Return pointer to 1bpp image mask canvas. </p>
<dl class="section return"><dt>Returns</dt><dd>GFXcanvas1* pointer (1-bit RAM-resident image) if present, NULL otherwise. </dd></dl>
</div>
</div>
<a id="a775ca41829f41398bea9e719d0297e34"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a775ca41829f41398bea9e719d0297e34">&#9670;&nbsp;</a></span>dealloc()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">void Adafruit_Image::dealloc </td>
<td>(</td>
<td class="paramtype">void&#160;</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">protected</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Free/deinitialize variables. </p>
<p>Deallocates memory associated with <a class="el" href="class_adafruit___image.html" title="Data bundle returned with an image loaded to RAM. Used by ImageReader.loadBMP() and Image...">Adafruit_Image</a> object and resets member variables to 'empty' state.</p>
<dl class="section return"><dt>Returns</dt><dd>None (void). </dd></dl>
</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li><a class="el" href="_adafruit___image_reader_8h_source.html">Adafruit_ImageReader.h</a></li>
<li><a class="el" href="_adafruit___image_reader_8cpp.html">Adafruit_ImageReader.cpp</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.13
</small></address>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 568 B

View file

@ -0,0 +1,95 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Adafruit ImageReader Library: Member List</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">Adafruit ImageReader Library
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
</div><!-- top -->
<div class="header">
<div class="headertitle">
<div class="title">Adafruit_Image_EPD Member List</div> </div>
</div><!--header-->
<div class="contents">
<p>This is the complete list of members for <a class="el" href="class_adafruit___image___e_p_d.html">Adafruit_Image_EPD</a>, including all inherited members.</p>
<table class="directory">
<tr class="even"><td class="entry"><a class="el" href="class_adafruit___image.html#aa5a1da89887e7a7df28cc55237ec152a">Adafruit_Image</a>(void)</td><td class="entry"><a class="el" href="class_adafruit___image.html">Adafruit_Image</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="class_adafruit___image___e_p_d.html#a66124b1b9c398759e3b043bd0d5f40a4">Adafruit_ImageReader_EPD</a> class</td><td class="entry"><a class="el" href="class_adafruit___image___e_p_d.html">Adafruit_Image_EPD</a></td><td class="entry"><span class="mlabel">friend</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="class_adafruit___image.html#ad8ca08bb1ea16535c4c7dd4e29f3bce0">canvas</a></td><td class="entry"><a class="el" href="class_adafruit___image.html">Adafruit_Image</a></td><td class="entry"><span class="mlabel">protected</span></td></tr>
<tr><td class="entry"><a class="el" href="class_adafruit___image.html#a1e1ddc95dacb90317de556031b25a2ba">canvas1</a></td><td class="entry"><a class="el" href="class_adafruit___image.html">Adafruit_Image</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="class_adafruit___image.html#a50f37a60aa0cd46ef2464bd309279adc">canvas16</a></td><td class="entry"><a class="el" href="class_adafruit___image.html">Adafruit_Image</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="class_adafruit___image.html#a927a61bc53c96761065f51e7aac1e225">canvas8</a></td><td class="entry"><a class="el" href="class_adafruit___image.html">Adafruit_Image</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="class_adafruit___image.html#a775ca41829f41398bea9e719d0297e34">dealloc</a>(void)</td><td class="entry"><a class="el" href="class_adafruit___image.html">Adafruit_Image</a></td><td class="entry"><span class="mlabel">protected</span></td></tr>
<tr><td class="entry"><a class="el" href="class_adafruit___image___e_p_d.html#ae6a3ae73c5ae47d9e26483a1e5cdf723">draw</a>(Adafruit_EPD &amp;epd, int16_t x, int16_t y)</td><td class="entry"><a class="el" href="class_adafruit___image___e_p_d.html">Adafruit_Image_EPD</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="class_adafruit___image.html#a96f77402b729e22bf375ec07116d91cd">Adafruit_Image::draw</a>(Adafruit_SPITFT &amp;tft, int16_t x, int16_t y)</td><td class="entry"><a class="el" href="class_adafruit___image.html">Adafruit_Image</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="class_adafruit___image.html#a82b9a1f0d9c219a68fc541ef80523a0d">format</a></td><td class="entry"><a class="el" href="class_adafruit___image.html">Adafruit_Image</a></td><td class="entry"><span class="mlabel">protected</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="class_adafruit___image.html#afe83af3e18c81c583c7a88a395fdbe85">getCanvas</a>(void) const</td><td class="entry"><a class="el" href="class_adafruit___image.html">Adafruit_Image</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="class_adafruit___image.html#a7148217b19c3f9d13b02bbf09b5bbd9d">getFormat</a>(void) const</td><td class="entry"><a class="el" href="class_adafruit___image.html">Adafruit_Image</a></td><td class="entry"><span class="mlabel">inline</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="class_adafruit___image.html#a4edc497bd644efbdc1caa39abbd672a2">getMask</a>(void) const</td><td class="entry"><a class="el" href="class_adafruit___image.html">Adafruit_Image</a></td><td class="entry"><span class="mlabel">inline</span></td></tr>
<tr><td class="entry"><a class="el" href="class_adafruit___image.html#abf50c5b45823ae7717027532df7e9345">getPalette</a>(void) const</td><td class="entry"><a class="el" href="class_adafruit___image.html">Adafruit_Image</a></td><td class="entry"><span class="mlabel">inline</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="class_adafruit___image.html#a41e38c82ffe69f9b28f694a4427b05fe">height</a>(void) const</td><td class="entry"><a class="el" href="class_adafruit___image.html">Adafruit_Image</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="class_adafruit___image.html#a11231812b0043d596b4f89cba6752e2a">mask</a></td><td class="entry"><a class="el" href="class_adafruit___image.html">Adafruit_Image</a></td><td class="entry"><span class="mlabel">protected</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="class_adafruit___image.html#a393bf73f70871257cf41e5b1ddca5d6e">palette</a></td><td class="entry"><a class="el" href="class_adafruit___image.html">Adafruit_Image</a></td><td class="entry"><span class="mlabel">protected</span></td></tr>
<tr><td class="entry"><a class="el" href="class_adafruit___image.html#a72b36c5a0721b34a82420e325f0b793c">width</a>(void) const</td><td class="entry"><a class="el" href="class_adafruit___image.html">Adafruit_Image</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="class_adafruit___image.html#a649c3d18296356105831073fa1776661">~Adafruit_Image</a>(void)</td><td class="entry"><a class="el" href="class_adafruit___image.html">Adafruit_Image</a></td><td class="entry"></td></tr>
</table></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.13
</small></address>
</body>
</html>

View file

@ -0,0 +1,222 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Adafruit ImageReader Library: Adafruit_Image_EPD Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">Adafruit ImageReader Library
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#friends">Friends</a> &#124;
<a href="class_adafruit___image___e_p_d-members.html">List of all members</a> </div>
<div class="headertitle">
<div class="title">Adafruit_Image_EPD Class Reference</div> </div>
</div><!--header-->
<div class="contents">
<p>Data bundle returned with an image loaded to RAM. Used by ImageReader.loadBMP() and Image.draw(), not ImageReader.drawBMP().
<a href="class_adafruit___image___e_p_d.html#details">More...</a></p>
<p><code>#include &lt;<a class="el" href="_adafruit___image_reader___e_p_d_8h_source.html">Adafruit_ImageReader_EPD.h</a>&gt;</code></p>
<div class="dynheader">
Inheritance diagram for Adafruit_Image_EPD:</div>
<div class="dyncontent">
<div class="center">
<img src="class_adafruit___image___e_p_d.png" usemap="#Adafruit_5FImage_5FEPD_map" alt=""/>
<map id="Adafruit_5FImage_5FEPD_map" name="Adafruit_5FImage_5FEPD_map">
<area href="class_adafruit___image.html" title="Data bundle returned with an image loaded to RAM. Used by ImageReader.loadBMP() and Image..." alt="Adafruit_Image" shape="rect" coords="0,0,129,24"/>
</map>
</div></div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:ae6a3ae73c5ae47d9e26483a1e5cdf723"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_adafruit___image___e_p_d.html#ae6a3ae73c5ae47d9e26483a1e5cdf723">draw</a> (Adafruit_EPD &amp;epd, int16_t x, int16_t y)</td></tr>
<tr class="memdesc:ae6a3ae73c5ae47d9e26483a1e5cdf723"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw image to an Adafruit ePaper-type display. <a href="#ae6a3ae73c5ae47d9e26483a1e5cdf723">More...</a><br /></td></tr>
<tr class="separator:ae6a3ae73c5ae47d9e26483a1e5cdf723"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="inherit_header pub_methods_class_adafruit___image"><td colspan="2" onclick="javascript:toggleInherit('pub_methods_class_adafruit___image')"><img src="closed.png" alt="-"/>&#160;Public Member Functions inherited from <a class="el" href="class_adafruit___image.html">Adafruit_Image</a></td></tr>
<tr class="memitem:aa5a1da89887e7a7df28cc55237ec152a inherit pub_methods_class_adafruit___image"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_adafruit___image.html#aa5a1da89887e7a7df28cc55237ec152a">Adafruit_Image</a> (void)</td></tr>
<tr class="memdesc:aa5a1da89887e7a7df28cc55237ec152a inherit pub_methods_class_adafruit___image"><td class="mdescLeft">&#160;</td><td class="mdescRight">Constructor. <a href="class_adafruit___image.html#aa5a1da89887e7a7df28cc55237ec152a">More...</a><br /></td></tr>
<tr class="separator:aa5a1da89887e7a7df28cc55237ec152a inherit pub_methods_class_adafruit___image"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a649c3d18296356105831073fa1776661 inherit pub_methods_class_adafruit___image"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_adafruit___image.html#a649c3d18296356105831073fa1776661">~Adafruit_Image</a> (void)</td></tr>
<tr class="memdesc:a649c3d18296356105831073fa1776661 inherit pub_methods_class_adafruit___image"><td class="mdescLeft">&#160;</td><td class="mdescRight">Destructor. <a href="class_adafruit___image.html#a649c3d18296356105831073fa1776661">More...</a><br /></td></tr>
<tr class="separator:a649c3d18296356105831073fa1776661 inherit pub_methods_class_adafruit___image"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a72b36c5a0721b34a82420e325f0b793c inherit pub_methods_class_adafruit___image"><td class="memItemLeft" align="right" valign="top">int16_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_adafruit___image.html#a72b36c5a0721b34a82420e325f0b793c">width</a> (void) const</td></tr>
<tr class="memdesc:a72b36c5a0721b34a82420e325f0b793c inherit pub_methods_class_adafruit___image"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get width of <a class="el" href="class_adafruit___image.html" title="Data bundle returned with an image loaded to RAM. Used by ImageReader.loadBMP() and Image...">Adafruit_Image</a> object. <a href="class_adafruit___image.html#a72b36c5a0721b34a82420e325f0b793c">More...</a><br /></td></tr>
<tr class="separator:a72b36c5a0721b34a82420e325f0b793c inherit pub_methods_class_adafruit___image"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a41e38c82ffe69f9b28f694a4427b05fe inherit pub_methods_class_adafruit___image"><td class="memItemLeft" align="right" valign="top">int16_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_adafruit___image.html#a41e38c82ffe69f9b28f694a4427b05fe">height</a> (void) const</td></tr>
<tr class="memdesc:a41e38c82ffe69f9b28f694a4427b05fe inherit pub_methods_class_adafruit___image"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get height of <a class="el" href="class_adafruit___image.html" title="Data bundle returned with an image loaded to RAM. Used by ImageReader.loadBMP() and Image...">Adafruit_Image</a> object. <a href="class_adafruit___image.html#a41e38c82ffe69f9b28f694a4427b05fe">More...</a><br /></td></tr>
<tr class="separator:a41e38c82ffe69f9b28f694a4427b05fe inherit pub_methods_class_adafruit___image"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a96f77402b729e22bf375ec07116d91cd inherit pub_methods_class_adafruit___image"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_adafruit___image.html#a96f77402b729e22bf375ec07116d91cd">draw</a> (Adafruit_SPITFT &amp;tft, int16_t x, int16_t y)</td></tr>
<tr class="memdesc:a96f77402b729e22bf375ec07116d91cd inherit pub_methods_class_adafruit___image"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw image to an Adafruit_SPITFT-type display. <a href="class_adafruit___image.html#a96f77402b729e22bf375ec07116d91cd">More...</a><br /></td></tr>
<tr class="separator:a96f77402b729e22bf375ec07116d91cd inherit pub_methods_class_adafruit___image"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7148217b19c3f9d13b02bbf09b5bbd9d inherit pub_methods_class_adafruit___image"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_adafruit___image_reader_8h.html#a22f6b18e781e3c412e7d243f7de6aa5c">ImageFormat</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_adafruit___image.html#a7148217b19c3f9d13b02bbf09b5bbd9d">getFormat</a> (void) const</td></tr>
<tr class="memdesc:a7148217b19c3f9d13b02bbf09b5bbd9d inherit pub_methods_class_adafruit___image"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return canvas image format. <a href="class_adafruit___image.html#a7148217b19c3f9d13b02bbf09b5bbd9d">More...</a><br /></td></tr>
<tr class="separator:a7148217b19c3f9d13b02bbf09b5bbd9d inherit pub_methods_class_adafruit___image"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:afe83af3e18c81c583c7a88a395fdbe85 inherit pub_methods_class_adafruit___image"><td class="memItemLeft" align="right" valign="top">void *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_adafruit___image.html#afe83af3e18c81c583c7a88a395fdbe85">getCanvas</a> (void) const</td></tr>
<tr class="memdesc:afe83af3e18c81c583c7a88a395fdbe85 inherit pub_methods_class_adafruit___image"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return pointer to image's GFX canvas object. <a href="class_adafruit___image.html#afe83af3e18c81c583c7a88a395fdbe85">More...</a><br /></td></tr>
<tr class="separator:afe83af3e18c81c583c7a88a395fdbe85 inherit pub_methods_class_adafruit___image"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:abf50c5b45823ae7717027532df7e9345 inherit pub_methods_class_adafruit___image"><td class="memItemLeft" align="right" valign="top">uint16_t *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_adafruit___image.html#abf50c5b45823ae7717027532df7e9345">getPalette</a> (void) const</td></tr>
<tr class="memdesc:abf50c5b45823ae7717027532df7e9345 inherit pub_methods_class_adafruit___image"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return pointer to color palette. <a href="class_adafruit___image.html#abf50c5b45823ae7717027532df7e9345">More...</a><br /></td></tr>
<tr class="separator:abf50c5b45823ae7717027532df7e9345 inherit pub_methods_class_adafruit___image"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4edc497bd644efbdc1caa39abbd672a2 inherit pub_methods_class_adafruit___image"><td class="memItemLeft" align="right" valign="top">GFXcanvas1 *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_adafruit___image.html#a4edc497bd644efbdc1caa39abbd672a2">getMask</a> (void) const</td></tr>
<tr class="memdesc:a4edc497bd644efbdc1caa39abbd672a2 inherit pub_methods_class_adafruit___image"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return pointer to 1bpp image mask canvas. <a href="class_adafruit___image.html#a4edc497bd644efbdc1caa39abbd672a2">More...</a><br /></td></tr>
<tr class="separator:a4edc497bd644efbdc1caa39abbd672a2 inherit pub_methods_class_adafruit___image"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="friends"></a>
Friends</h2></td></tr>
<tr class="memitem:a66124b1b9c398759e3b043bd0d5f40a4"><td class="memItemLeft" align="right" valign="top"><a id="a66124b1b9c398759e3b043bd0d5f40a4"></a>
class&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_adafruit___image___e_p_d.html#a66124b1b9c398759e3b043bd0d5f40a4">Adafruit_ImageReader_EPD</a></td></tr>
<tr class="memdesc:a66124b1b9c398759e3b043bd0d5f40a4"><td class="mdescLeft">&#160;</td><td class="mdescRight">Loading occurs here. <br /></td></tr>
<tr class="separator:a66124b1b9c398759e3b043bd0d5f40a4"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="inherited"></a>
Additional Inherited Members</h2></td></tr>
<tr class="inherit_header pro_methods_class_adafruit___image"><td colspan="2" onclick="javascript:toggleInherit('pro_methods_class_adafruit___image')"><img src="closed.png" alt="-"/>&#160;Protected Member Functions inherited from <a class="el" href="class_adafruit___image.html">Adafruit_Image</a></td></tr>
<tr class="memitem:a775ca41829f41398bea9e719d0297e34 inherit pro_methods_class_adafruit___image"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_adafruit___image.html#a775ca41829f41398bea9e719d0297e34">dealloc</a> (void)</td></tr>
<tr class="memdesc:a775ca41829f41398bea9e719d0297e34 inherit pro_methods_class_adafruit___image"><td class="mdescLeft">&#160;</td><td class="mdescRight">Free/deinitialize variables. <a href="class_adafruit___image.html#a775ca41829f41398bea9e719d0297e34">More...</a><br /></td></tr>
<tr class="separator:a775ca41829f41398bea9e719d0297e34 inherit pro_methods_class_adafruit___image"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="inherit_header pro_attribs_class_adafruit___image"><td colspan="2" onclick="javascript:toggleInherit('pro_attribs_class_adafruit___image')"><img src="closed.png" alt="-"/>&#160;Protected Attributes inherited from <a class="el" href="class_adafruit___image.html">Adafruit_Image</a></td></tr>
<tr class="memitem:ad8ca08bb1ea16535c4c7dd4e29f3bce0 inherit pro_attribs_class_adafruit___image"><td class="memItemLeft" ><a id="ad8ca08bb1ea16535c4c7dd4e29f3bce0"></a>
union {</td></tr>
<tr class="memitem:a42a6b09ff3d2317e3611e3856c503923 inherit pro_attribs_class_adafruit___image"><td class="memItemLeft" >
&#160;&#160;&#160;GFXcanvas1 *&#160;&#160;&#160;<a class="el" href="class_adafruit___image.html#a1e1ddc95dacb90317de556031b25a2ba">canvas1</a></td></tr>
<tr class="memdesc:a42a6b09ff3d2317e3611e3856c503923 inherit pro_attribs_class_adafruit___image"><td class="mdescLeft">&#160;</td><td class="mdescRight">Canvas object if 1bpp format. <br /></td></tr>
<tr class="separator:a42a6b09ff3d2317e3611e3856c503923 inherit pro_attribs_class_adafruit___image"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3a26c5e5ee67b134e35a194037fd633e inherit pro_attribs_class_adafruit___image"><td class="memItemLeft" >
&#160;&#160;&#160;GFXcanvas8 *&#160;&#160;&#160;<a class="el" href="class_adafruit___image.html#a927a61bc53c96761065f51e7aac1e225">canvas8</a></td></tr>
<tr class="memdesc:a3a26c5e5ee67b134e35a194037fd633e inherit pro_attribs_class_adafruit___image"><td class="mdescLeft">&#160;</td><td class="mdescRight">Canvas object if 8bpp format. <br /></td></tr>
<tr class="separator:a3a26c5e5ee67b134e35a194037fd633e inherit pro_attribs_class_adafruit___image"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aae0f90c9b38a3b8815f36ee12a181652 inherit pro_attribs_class_adafruit___image"><td class="memItemLeft" >
&#160;&#160;&#160;GFXcanvas16 *&#160;&#160;&#160;<a class="el" href="class_adafruit___image.html#a50f37a60aa0cd46ef2464bd309279adc">canvas16</a></td></tr>
<tr class="memdesc:aae0f90c9b38a3b8815f36ee12a181652 inherit pro_attribs_class_adafruit___image"><td class="mdescLeft">&#160;</td><td class="mdescRight">Canvas object if 16bpp. <br /></td></tr>
<tr class="separator:aae0f90c9b38a3b8815f36ee12a181652 inherit pro_attribs_class_adafruit___image"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad8ca08bb1ea16535c4c7dd4e29f3bce0 inherit pro_attribs_class_adafruit___image"><td class="memItemLeft" valign="top">}&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_adafruit___image.html#ad8ca08bb1ea16535c4c7dd4e29f3bce0">canvas</a></td></tr>
<tr class="memdesc:ad8ca08bb1ea16535c4c7dd4e29f3bce0 inherit pro_attribs_class_adafruit___image"><td class="mdescLeft">&#160;</td><td class="mdescRight">Union of different GFXcanvas types. <br /></td></tr>
<tr class="separator:ad8ca08bb1ea16535c4c7dd4e29f3bce0 inherit pro_attribs_class_adafruit___image"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a11231812b0043d596b4f89cba6752e2a inherit pro_attribs_class_adafruit___image"><td class="memItemLeft" align="right" valign="top"><a id="a11231812b0043d596b4f89cba6752e2a"></a>
GFXcanvas1 *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_adafruit___image.html#a11231812b0043d596b4f89cba6752e2a">mask</a></td></tr>
<tr class="memdesc:a11231812b0043d596b4f89cba6752e2a inherit pro_attribs_class_adafruit___image"><td class="mdescLeft">&#160;</td><td class="mdescRight">1bpp image mask (or NULL) <br /></td></tr>
<tr class="separator:a11231812b0043d596b4f89cba6752e2a inherit pro_attribs_class_adafruit___image"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a393bf73f70871257cf41e5b1ddca5d6e inherit pro_attribs_class_adafruit___image"><td class="memItemLeft" align="right" valign="top"><a id="a393bf73f70871257cf41e5b1ddca5d6e"></a>
uint16_t *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_adafruit___image.html#a393bf73f70871257cf41e5b1ddca5d6e">palette</a></td></tr>
<tr class="memdesc:a393bf73f70871257cf41e5b1ddca5d6e inherit pro_attribs_class_adafruit___image"><td class="mdescLeft">&#160;</td><td class="mdescRight">Color palette for 8bpp image (or NULL) <br /></td></tr>
<tr class="separator:a393bf73f70871257cf41e5b1ddca5d6e inherit pro_attribs_class_adafruit___image"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a82b9a1f0d9c219a68fc541ef80523a0d inherit pro_attribs_class_adafruit___image"><td class="memItemLeft" align="right" valign="top"><a id="a82b9a1f0d9c219a68fc541ef80523a0d"></a>
uint8_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_adafruit___image.html#a82b9a1f0d9c219a68fc541ef80523a0d">format</a></td></tr>
<tr class="memdesc:a82b9a1f0d9c219a68fc541ef80523a0d inherit pro_attribs_class_adafruit___image"><td class="mdescLeft">&#160;</td><td class="mdescRight">Canvas bundle type in use. <br /></td></tr>
<tr class="separator:a82b9a1f0d9c219a68fc541ef80523a0d inherit pro_attribs_class_adafruit___image"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Data bundle returned with an image loaded to RAM. Used by ImageReader.loadBMP() and Image.draw(), not ImageReader.drawBMP(). </p>
</div><h2 class="groupheader">Member Function Documentation</h2>
<a id="ae6a3ae73c5ae47d9e26483a1e5cdf723"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae6a3ae73c5ae47d9e26483a1e5cdf723">&#9670;&nbsp;</a></span>draw()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void Adafruit_Image_EPD::draw </td>
<td>(</td>
<td class="paramtype">Adafruit_EPD &amp;&#160;</td>
<td class="paramname"><em>epd</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int16_t&#160;</td>
<td class="paramname"><em>x</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int16_t&#160;</td>
<td class="paramname"><em>y</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Draw image to an Adafruit ePaper-type display. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">epd</td><td>Screen to draw to (any Adafruit_EPD-derived class). </td></tr>
<tr><td class="paramname">x</td><td>Horizontal 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. </td></tr>
<tr><td class="paramname">y</td><td>Vertical offset in pixels; top edge = 0, positive = down. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>None (void). </dd></dl>
</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li><a class="el" href="_adafruit___image_reader___e_p_d_8h_source.html">Adafruit_ImageReader_EPD.h</a></li>
<li>Adafruit_ImageReader_EPD.cpp</li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.13
</small></address>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 566 B

View file

@ -0,0 +1,87 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Adafruit ImageReader Library: Member List</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">Adafruit ImageReader Library
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
</div><!-- top -->
<div class="header">
<div class="headertitle">
<div class="title">Adafruit_ImageReader Member List</div> </div>
</div><!--header-->
<div class="contents">
<p>This is the complete list of members for <a class="el" href="class_adafruit___image_reader.html">Adafruit_ImageReader</a>, including all inherited members.</p>
<table class="directory">
<tr class="even"><td class="entry"><a class="el" href="class_adafruit___image_reader.html#ad67d5ff40333394dc03701566dfa5f52">Adafruit_ImageReader</a>(FatVolume &amp;fs)</td><td class="entry"><a class="el" href="class_adafruit___image_reader.html">Adafruit_ImageReader</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="class_adafruit___image_reader.html#ac8bf8f2c5f68b7dbdd72166cb1958db1">bmpDimensions</a>(const char *filename, int32_t *w, int32_t *h)</td><td class="entry"><a class="el" href="class_adafruit___image_reader.html">Adafruit_ImageReader</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="class_adafruit___image_reader.html#a6b96c18022ad4b9dff8a0129f9121e54">coreBMP</a>(const char *filename, Adafruit_SPITFT *tft, uint16_t *dest, int16_t x, int16_t y, Adafruit_Image *img, boolean transact)</td><td class="entry"><a class="el" href="class_adafruit___image_reader.html">Adafruit_ImageReader</a></td><td class="entry"><span class="mlabel">protected</span></td></tr>
<tr><td class="entry"><a class="el" href="class_adafruit___image_reader.html#a651534de3871c112c1c816621f137353">drawBMP</a>(const char *filename, Adafruit_SPITFT &amp;tft, int16_t x, int16_t y, boolean transact=true)</td><td class="entry"><a class="el" href="class_adafruit___image_reader.html">Adafruit_ImageReader</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="class_adafruit___image_reader.html#a9d40b5f6cbdf51247208e9407d7cebb4">file</a></td><td class="entry"><a class="el" href="class_adafruit___image_reader.html">Adafruit_ImageReader</a></td><td class="entry"><span class="mlabel">protected</span></td></tr>
<tr><td class="entry"><a class="el" href="class_adafruit___image_reader.html#aaa4763ea50b0cf71d984b638db6bb792">filesys</a></td><td class="entry"><a class="el" href="class_adafruit___image_reader.html">Adafruit_ImageReader</a></td><td class="entry"><span class="mlabel">protected</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="class_adafruit___image_reader.html#a434c3380f87358b2219cfe4e3b40fc6b">loadBMP</a>(const char *filename, Adafruit_Image &amp;img)</td><td class="entry"><a class="el" href="class_adafruit___image_reader.html">Adafruit_ImageReader</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="class_adafruit___image_reader.html#af805ca644e8cf5100bb1638dff014c36">printStatus</a>(ImageReturnCode stat, Stream &amp;stream=Serial)</td><td class="entry"><a class="el" href="class_adafruit___image_reader.html">Adafruit_ImageReader</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="class_adafruit___image_reader.html#aa6dbce0de3e941a87b00acf433213757">readLE16</a>(void)</td><td class="entry"><a class="el" href="class_adafruit___image_reader.html">Adafruit_ImageReader</a></td><td class="entry"><span class="mlabel">protected</span></td></tr>
<tr><td class="entry"><a class="el" href="class_adafruit___image_reader.html#a5c219992b34ef3a626f94da7ce3bd649">readLE32</a>(void)</td><td class="entry"><a class="el" href="class_adafruit___image_reader.html">Adafruit_ImageReader</a></td><td class="entry"><span class="mlabel">protected</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="class_adafruit___image_reader.html#a3da727d1ab406b637110743e40866ac7">~Adafruit_ImageReader</a>(void)</td><td class="entry"><a class="el" href="class_adafruit___image_reader.html">Adafruit_ImageReader</a></td><td class="entry"></td></tr>
</table></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.13
</small></address>
</body>
</html>

Some files were not shown because too many files have changed in this diff Show more