F439_CPP_SPI_RA8875_TFT_LCD_03 1.0
STM32F439 SPI RA8875 7-inch TFT display demo built on the STM32_GFX and STM32_RA8875 libraries
Loading...
Searching...
No Matches
Adafruit_RA8875 Class Reference

Class that stores state and functions for interacting with the RA8875 display controller. More...

#include <Adafruit_RA8875.h>

Inheritance diagram for Adafruit_RA8875:
Adafruit_GFX Print

Public Types

typedef bool(* StorageReadFn) (void *ctx, uint32_t address, uint8_t *data, uint32_t length)
 Read length bytes at address; return true on success.
 
typedef bool(* StorageWriteFn) (void *ctx, uint32_t address, const uint8_t *data, uint32_t length)
 Write length bytes at address; return true on success.
 

Public Member Functions

 Adafruit_RA8875 (SPI_HandleTypeDef *spi, GPIO_TypeDef *csPort, uint16_t csPin, GPIO_TypeDef *rstPort, uint16_t rstPin, GPIO_TypeDef *waitPort=nullptr, uint16_t waitPin=0)
 
boolean begin (enum RA8875sizes s)
 
void softReset (void)
 
void displayOn (boolean on)
 
void sleep (boolean sleep)
 
void textMode (void)
 
void textSetCursor (uint16_t x, uint16_t y)
 
void textColor (uint16_t foreColor, uint16_t bgColor)
 
void textTransparent (uint16_t foreColor)
 
void textEnlarge (uint8_t scale)
 
void textWrite (const char *buffer, uint16_t len=0)
 
void cursorBlink (uint8_t rate)
 
void graphicsMode (void)
 
void setXY (uint16_t x, uint16_t y)
 
void pushPixels (uint32_t num, uint16_t p)
 
void fillRect (void)
 
void drawPixel (int16_t x, int16_t y, uint16_t color)
 
void drawPixels (uint16_t *p, uint32_t count, int16_t x, int16_t y)
 
void drawFastVLine (int16_t x, int16_t y, int16_t h, uint16_t color)
 
void drawFastHLine (int16_t x, int16_t y, int16_t w, uint16_t color)
 
void fillScreen (uint16_t color)
 
void drawLine (int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t color)
 
void drawRect (int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color)
 
void fillRect (int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color)
 
void drawCircle (int16_t x, int16_t y, int16_t r, uint16_t color)
 
void fillCircle (int16_t x, int16_t y, int16_t r, uint16_t color)
 
void drawTriangle (int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint16_t color)
 
void fillTriangle (int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint16_t color)
 
void drawEllipse (int16_t xCenter, int16_t yCenter, int16_t longAxis, int16_t shortAxis, uint16_t color)
 
void fillEllipse (int16_t xCenter, int16_t yCenter, int16_t longAxis, int16_t shortAxis, uint16_t color)
 
void drawCurve (int16_t xCenter, int16_t yCenter, int16_t longAxis, int16_t shortAxis, uint8_t curvePart, uint16_t color)
 
void fillCurve (int16_t xCenter, int16_t yCenter, int16_t longAxis, int16_t shortAxis, uint8_t curvePart, uint16_t color)
 
void drawRoundRect (int16_t x, int16_t y, int16_t w, int16_t h, int16_t r, uint16_t color)
 
void fillRoundRect (int16_t x, int16_t y, int16_t w, int16_t h, int16_t r, uint16_t color)
 
void setScrollWindow (int16_t x, int16_t y, int16_t w, int16_t h, uint8_t mode)
 
void scrollX (int16_t dist)
 
void scrollY (int16_t dist)
 
void GPIOX (boolean on)
 
void PWM1config (boolean on, uint8_t clock)
 
void PWM2config (boolean on, uint8_t clock)
 
void PWM1out (uint8_t p)
 
void PWM2out (uint8_t p)
 
void touchEnable (boolean on)
 
boolean touched (void)
 
boolean touchRead (uint16_t *x, uint16_t *y)
 
void setCalibrationStorage (StorageReadFn read, StorageWriteFn write, void *ctx, uint32_t sizeBytes)
 
uint32_t eepromReadS32 (int location)
 
void eepromWriteS32 (int location, int32_t value)
 
bool readCalibration (int location, tsMatrix_t *matrixPtr)
 
void writeCalibration (int location, tsMatrix_t *matrixPtr)
 
void writeReg (uint8_t reg, uint8_t val)
 
uint8_t readReg (uint8_t reg)
 
void writeData (uint8_t d)
 
uint8_t readData (void)
 
void writeCommand (uint8_t d)
 
uint8_t readStatus (void)
 
boolean waitPoll (uint8_t r, uint8_t f)
 
uint16_t width (void)
 
uint16_t height (void)
 
void setRotation (int8_t rotation)
 
int8_t getRotation (void)
 
virtual size_t write (uint8_t b)
 
virtual size_t write (const uint8_t *buffer, size_t size)
 
- Public Member Functions inherited from Adafruit_GFX
 Adafruit_GFX (int16_t w, int16_t h)
 Instatiate a GFX context for graphics! Can only be done by a superclass.
 
virtual void startWrite (void)
 Start a display-writing routine, overwrite in subclasses.
 
virtual void writePixel (int16_t x, int16_t y, uint16_t color)
 Write a pixel, overwrite in subclasses if startWrite is defined!
 
virtual void writeFillRect (int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color)
 Write a rectangle completely with one color, overwrite in subclasses if startWrite is defined!
 
virtual void writeFastVLine (int16_t x, int16_t y, int16_t h, uint16_t color)
 Write a perfectly vertical line, overwrite in subclasses if startWrite is defined!
 
virtual void writeFastHLine (int16_t x, int16_t y, int16_t w, uint16_t color)
 Write a perfectly horizontal line, overwrite in subclasses if startWrite is defined!
 
virtual void writeLine (int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t color)
 Write a line. Bresenham's algorithm - thx wikpedia.
 
virtual void endWrite (void)
 End a display-writing routine, overwrite in subclasses if startWrite is defined!
 
virtual void setRotation (uint8_t r)
 Set rotation setting for display.
 
virtual void invertDisplay (bool i)
 Invert the display (ideally using built-in hardware command)
 
void drawCircle (int16_t x0, int16_t y0, int16_t r, uint16_t color)
 Draw a circle outline.
 
void drawCircleHelper (int16_t x0, int16_t y0, int16_t r, uint8_t cornername, uint16_t color)
 Quarter-circle drawer, used to do circles and roundrects.
 
void fillCircle (int16_t x0, int16_t y0, int16_t r, uint16_t color)
 Draw a circle with filled color.
 
void fillCircleHelper (int16_t x0, int16_t y0, int16_t r, uint8_t cornername, int16_t delta, uint16_t color)
 Half-circle drawer with fill, used for circles and roundrects.
 
void drawEllipse (int16_t x0, int16_t y0, int16_t rw, int16_t rh, uint16_t color)
 Draw an ellipse outline.
 
void fillEllipse (int16_t x0, int16_t y0, int16_t rw, int16_t rh, uint16_t color)
 Draw an ellipse with filled colour.
 
void drawTriangle (int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint16_t color)
 Draw a triangle with no fill color.
 
void fillTriangle (int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint16_t color)
 Draw a triangle with color-fill.
 
void drawRoundRect (int16_t x0, int16_t y0, int16_t w, int16_t h, int16_t radius, uint16_t color)
 Draw a rounded rectangle with no fill color.
 
void fillRoundRect (int16_t x0, int16_t y0, int16_t w, int16_t h, int16_t radius, uint16_t color)
 Draw a rounded rectangle with fill color.
 
void drawRotatedRect (int16_t cenX, int16_t cenY, int16_t w, int16_t h, int16_t angleDeg, uint16_t color)
 Draw a rotated rectangle.
 
void fillRotatedRect (int16_t cenX, int16_t cenY, int16_t w, int16_t h, int16_t angleDeg, uint16_t color)
 Draw a filled rotated rectangle.
 
void rotatePoint (int16_t &x0, int16_t &y0, int16_t angleDeg)
 Rotate a point in standard position.
 
void drawBitmap (int16_t x, int16_t y, const uint8_t bitmap[], int16_t w, int16_t h, uint16_t color)
 Draw a PROGMEM-resident 1-bit image at the specified (x,y) position, using the specified foreground color (unset bits are transparent).
 
void drawBitmap (int16_t x, int16_t y, const uint8_t bitmap[], int16_t w, int16_t h, uint16_t color, uint16_t bg)
 Draw a PROGMEM-resident 1-bit image at the specified (x,y) position, using the specified foreground (for set bits) and background (unset bits) colors.
 
void drawBitmap (int16_t x, int16_t y, uint8_t *bitmap, int16_t w, int16_t h, uint16_t color)
 Draw a RAM-resident 1-bit image at the specified (x,y) position, using the specified foreground color (unset bits are transparent).
 
void drawBitmap (int16_t x, int16_t y, uint8_t *bitmap, int16_t w, int16_t h, uint16_t color, uint16_t bg)
 Draw a RAM-resident 1-bit image at the specified (x,y) position, using the specified foreground (for set bits) and background (unset bits) colors.
 
void drawXBitmap (int16_t x, int16_t y, const uint8_t bitmap[], int16_t w, int16_t h, uint16_t color)
 Draw PROGMEM-resident XBitMap Files (*.xbm), exported from GIMP. Usage: Export from GIMP to *.xbm, rename *.xbm to *.c and open in editor. C Array can be directly used with this function. There is no RAM-resident version of this function; if generating bitmaps in RAM, use the format defined by drawBitmap() and call that instead.
 
void drawGrayscaleBitmap (int16_t x, int16_t y, const uint8_t bitmap[], int16_t w, int16_t h)
 Draw a PROGMEM-resident 8-bit image (grayscale) at the specified (x,y) pos. Specifically for 8-bit display devices such as IS31FL3731; no color reduction/expansion is performed.
 
void drawGrayscaleBitmap (int16_t x, int16_t y, uint8_t *bitmap, int16_t w, int16_t h)
 Draw a RAM-resident 8-bit image (grayscale) at the specified (x,y) pos. Specifically for 8-bit display devices such as IS31FL3731; no color reduction/expansion is performed.
 
void drawGrayscaleBitmap (int16_t x, int16_t y, const uint8_t bitmap[], const uint8_t mask[], int16_t w, int16_t h)
 Draw a PROGMEM-resident 8-bit image (grayscale) with a 1-bit mask (set bits = opaque, unset bits = clear) at the specified (x,y) position. BOTH buffers (grayscale and mask) must be PROGMEM-resident. Specifically for 8-bit display devices such as IS31FL3731; no color reduction/expansion is performed.
 
void drawGrayscaleBitmap (int16_t x, int16_t y, uint8_t *bitmap, uint8_t *mask, int16_t w, int16_t h)
 Draw a RAM-resident 8-bit image (grayscale) with a 1-bit mask (set bits = opaque, unset bits = clear) at the specified (x,y) position. BOTH buffers (grayscale and mask) must be RAM-residentt, no mix-and-match Specifically for 8-bit display devices such as IS31FL3731; no color reduction/expansion is performed.
 
void drawRGBBitmap (int16_t x, int16_t y, const uint16_t bitmap[], int16_t w, int16_t h)
 Draw a PROGMEM-resident 16-bit image (RGB 5/6/5) at the specified (x,y) position. For 16-bit display devices; no color reduction performed.
 
void drawRGBBitmap (int16_t x, int16_t y, uint16_t *bitmap, int16_t w, int16_t h)
 Draw a RAM-resident 16-bit image (RGB 5/6/5) at the specified (x,y) position. For 16-bit display devices; no color reduction performed.
 
void drawRGBBitmap (int16_t x, int16_t y, const uint16_t bitmap[], const uint8_t mask[], int16_t w, int16_t h)
 Draw a PROGMEM-resident 16-bit image (RGB 5/6/5) with a 1-bit mask (set bits = opaque, unset bits = clear) at the specified (x,y) position. BOTH buffers (color and mask) must be PROGMEM-resident. For 16-bit display devices; no color reduction performed.
 
void drawRGBBitmap (int16_t x, int16_t y, uint16_t *bitmap, uint8_t *mask, int16_t w, int16_t h)
 Draw a RAM-resident 16-bit image (RGB 5/6/5) with a 1-bit mask (set bits = opaque, unset bits = clear) at the specified (x,y) position. BOTH buffers (color and mask) must be RAM-resident. For 16-bit display devices; no color reduction performed.
 
void drawChar (int16_t x, int16_t y, unsigned char c, uint16_t color, uint16_t bg, uint8_t size)
 Draw a single character.
 
void drawChar (int16_t x, int16_t y, unsigned char c, uint16_t color, uint16_t bg, uint8_t size_x, uint8_t size_y)
 Draw a single character.
 
void getTextBounds (const char *string, int16_t x, int16_t y, int16_t *x1, int16_t *y1, uint16_t *w, uint16_t *h)
 Helper to determine size of a string with current font/size. Pass string and a cursor position, returns UL corner and W,H.
 
void getTextBounds (const __FlashStringHelper *s, int16_t x, int16_t y, int16_t *x1, int16_t *y1, uint16_t *w, uint16_t *h)
 Helper to determine size of a PROGMEM string with current font/size. Pass string and a cursor position, returns UL corner and W,H.
 
void getTextBounds (const String &str, int16_t x, int16_t y, int16_t *x1, int16_t *y1, uint16_t *w, uint16_t *h)
 Helper to determine size of a string with current font/size. Pass string and a cursor position, returns UL corner and W,H.
 
void setTextSize (uint8_t s)
 Set text 'magnification' size. Each increase in s makes 1 pixel that much bigger.
 
void setTextSize (uint8_t sx, uint8_t sy)
 Set text 'magnification' size. Each increase in s makes 1 pixel that much bigger.
 
void setFont (const GFXfont *f=NULL)
 Set the font to display when print()ing, either custom or default.
 
void setCursor (int16_t x, int16_t y)
 Set text cursor location.
 
void setTextColor (uint16_t c)
 Set text font color with transparant background.
 
void setTextColor (uint16_t c, uint16_t bg)
 Set text font color with custom background color.
 
void setTextWrap (bool w)
 Set whether text that is too long for the screen width should automatically wrap around to the next line (else clip right).
 
void cp437 (bool x=true)
 Enable (or disable) Code Page 437-compatible charset. There was an error in glcdfont.c for the longest time – one character (#176, the 'light shade' block) was missing – this threw off the index of every character that followed it. But a TON of code has been written with the erroneous character indices. By default, the library uses the original 'wrong' behavior and old sketches will still work. Pass 'true' to this function to use correct CP437 character values in your code.
 
int16_t width (void) const
 Get width of the display, accounting for current rotation.
 
int16_t height (void) const
 Get height of the display, accounting for current rotation.
 
uint8_t getRotation (void) const
 Get rotation setting for display.
 
int16_t getCursorX (void) const
 Get text cursor X location.
 
int16_t getCursorY (void) const
 Get text cursor Y location.
 
size_t write (const char *str)
 
size_t write (const char *buffer, size_t size)
 
- Public Member Functions inherited from Print
 Print ()
 Constructor: no write error.
 
virtual ~Print ()
 Virtual destructor.
 
int getWriteError ()
 
void clearWriteError ()
 Clear the write-error flag.
 
size_t write (const char *str)
 
size_t write (const char *buffer, size_t size)
 
virtual int availableForWrite ()
 
virtual void flush ()
 Wait for pending output to finish (no-op by default).
 
size_t print (const __FlashStringHelper *ifsh)
 
size_t print (const String &s)
 
size_t print (const char str[])
 
size_t print (char c)
 
size_t print (unsigned char b, int base=DEC)
 
size_t print (int n, int base=DEC)
 
size_t print (unsigned int n, int base=DEC)
 
size_t print (long n, int base=DEC)
 
size_t print (unsigned long n, int base=DEC)
 
size_t print (double n, int digits=2)
 
size_t println (const __FlashStringHelper *ifsh)
 
size_t println (const String &s)
 
size_t println (const char str[])
 
size_t println (char c)
 
size_t println (unsigned char b, int base=DEC)
 
size_t println (int n, int base=DEC)
 
size_t println (unsigned int n, int base=DEC)
 
size_t println (long n, int base=DEC)
 
size_t println (unsigned long n, int base=DEC)
 
size_t println (double n, int digits=2)
 
size_t println (void)
 

Additional Inherited Members

- Protected Member Functions inherited from Adafruit_GFX
void charBounds (unsigned char c, int16_t *x, int16_t *y, int16_t *minx, int16_t *miny, int16_t *maxx, int16_t *maxy)
 Helper to determine size of a character with current font/size. Broke this out as it's used by both the PROGMEM- and RAM-resident getTextBounds() functions.
 
- Protected Member Functions inherited from Print
void setWriteError (int err=1)
 
- Protected Attributes inherited from Adafruit_GFX
int16_t WIDTH
 This is the 'raw' display width - never changes.
 
int16_t HEIGHT
 This is the 'raw' display height - never changes.
 
int16_t _width
 Display width as modified by current rotation.
 
int16_t _height
 Display height as modified by current rotation.
 
int16_t cursor_x
 x location to start print()ing text
 
int16_t cursor_y
 y location to start print()ing text
 
uint16_t textcolor
 16-bit background color for print()
 
uint16_t textbgcolor
 16-bit text color for print()
 
uint8_t textsize_x
 Desired magnification in X-axis of text to print()
 
uint8_t textsize_y
 Desired magnification in Y-axis of text to print()
 
uint8_t rotation
 Display rotation (0 thru 3)
 
bool wrap
 If set, 'wrap' text at right edge of display.
 
bool _cp437
 If set, use correct CP437 charset (default is off)
 
GFXfont * gfxFont
 Pointer to special font.
 

Detailed Description

Class that stores state and functions for interacting with the RA8875 display controller.

Definition at line 103 of file Adafruit_RA8875.h.

Member Typedef Documentation

◆ StorageReadFn

typedef bool(* Adafruit_RA8875::StorageReadFn) (void *ctx, uint32_t address, uint8_t *data, uint32_t length)

Read length bytes at address; return true on success.

Definition at line 191 of file Adafruit_RA8875.h.

◆ StorageWriteFn

typedef bool(* Adafruit_RA8875::StorageWriteFn) (void *ctx, uint32_t address, const uint8_t *data, uint32_t length)

Write length bytes at address; return true on success.

Definition at line 194 of file Adafruit_RA8875.h.

Constructor & Destructor Documentation

◆ Adafruit_RA8875()

Adafruit_RA8875::Adafruit_RA8875 ( SPI_HandleTypeDef * spi,
GPIO_TypeDef * csPort,
uint16_t csPin,
GPIO_TypeDef * rstPort,
uint16_t rstPin,
GPIO_TypeDef * waitPort = nullptr,
uint16_t waitPin = 0 )

Constructor (STM32 HAL): replaces Adafruit's Arduino (uint8_t cs, uint8_t rst) form; see the README for the SPI/GPIO setup. The WAIT port and pin are optional. Pass nullptr (the default) if the pin isn't wired; the driver then skips WAIT polling entirely. The parameters are documented at the constructor definition.

Constructor for a new RA8875 instance

Parameters
spiSPI handle configured by CubeMX (see README)
csPortGPIO port of the chip-select pin
csPinGPIO pin of the chip-select pin
rstPortGPIO port of the RESET pin
rstPinGPIO pin of the RESET pin
waitPortGPIO port of the WAIT pin, or nullptr if not wired
waitPinGPIO pin of the WAIT pin (ignored if waitPort is nullptr)

Definition at line 102 of file Adafruit_RA8875.cpp.

Member Function Documentation

◆ begin()

boolean Adafruit_RA8875::begin ( enum RA8875sizes s)

Initialises the LCD driver and any HW required by the display

Parameters
sThe display size, which can be either: 'RA8875_480x80' (3.8" displays) or 'RA8875_480x128' (3.9" displays) or 'RA8875_480x272' (4.3" displays) or 'RA8875_800x480' (5" and 7" displays)
Returns
True if we reached the end

Definition at line 193 of file Adafruit_RA8875.cpp.

References RA8875_480x128, RA8875_480x272, RA8875_480x80, RA8875_800x480, RA8875_DEBUG_PRINTF, and readReg().

Referenced by initTest().

◆ cursorBlink()

void Adafruit_RA8875::cursorBlink ( uint8_t rate)

Enable Cursor Visibility and Blink Here we set bits 6 and 5 in 40h As well as the set the blink rate in 44h The rate is 0 through max 255 the lower the number the faster it blinks (00h is 1 frame time, FFh is 256 Frames time. Blink Time (sec) = BTCR[44h]x(1/Frame_rate)

Parameters
rateThe frame rate to blink

Definition at line 560 of file Adafruit_RA8875.cpp.

References RA8875_BTCR, RA8875_MWCR0, RA8875_MWCR0_BLINK, RA8875_MWCR0_CURSOR, readData(), writeCommand(), and writeData().

Referenced by testLCD().

◆ displayOn()

void Adafruit_RA8875::displayOn ( boolean on)

Turns the display on or off

Parameters
onWhether to turn the display on or not

Definition at line 1678 of file Adafruit_RA8875.cpp.

References RA8875_PWRR, RA8875_PWRR_DISPOFF, RA8875_PWRR_DISPON, RA8875_PWRR_NORMAL, and writeReg().

Referenced by testLCD().

◆ drawCircle()

void Adafruit_RA8875::drawCircle ( int16_t x,
int16_t y,
int16_t r,
uint16_t color )

Draws a HW accelerated circle on the display

Parameters
xThe 0-based x location of the center of the circle
yThe 0-based y location of the center of the circle
rThe circle's radius
colorThe RGB565 color to use when drawing the pixel

Definition at line 937 of file Adafruit_RA8875.cpp.

Referenced by testLCD().

◆ drawCurve()

void Adafruit_RA8875::drawCurve ( int16_t xCenter,
int16_t yCenter,
int16_t longAxis,
int16_t shortAxis,
uint8_t curvePart,
uint16_t color )

Draws a HW accelerated curve on the display

Parameters
xCenterThe 0-based x location of the ellipse's center
yCenterThe 0-based y location of the ellipse's center
longAxisThe size in pixels of the ellipse's long axis
shortAxisThe size in pixels of the ellipse's short axis
curvePartThe corner to draw, where in clock-wise motion: 0 = 180-270° 1 = 270-0° 2 = 0-90° 3 = 90-180°
colorThe RGB565 color to use when drawing the pixel

Definition at line 1045 of file Adafruit_RA8875.cpp.

Referenced by testLCD().

◆ drawEllipse()

void Adafruit_RA8875::drawEllipse ( int16_t xCenter,
int16_t yCenter,
int16_t longAxis,
int16_t shortAxis,
uint16_t color )

Draws a HW accelerated ellipse on the display

Parameters
xCenterThe 0-based x location of the ellipse's center
yCenterThe 0-based y location of the ellipse's center
longAxisThe size in pixels of the ellipse's long axis
shortAxisThe size in pixels of the ellipse's short axis
colorThe RGB565 color to use when drawing the pixel

Definition at line 1006 of file Adafruit_RA8875.cpp.

Referenced by testLCD().

◆ drawFastHLine()

void Adafruit_RA8875::drawFastHLine ( int16_t x,
int16_t y,
int16_t w,
uint16_t color )
virtual

Draw a horizontal line

Parameters
xThe X position
yThe Y position
wWidth
colorThe color

Reimplemented from Adafruit_GFX.

Definition at line 879 of file Adafruit_RA8875.cpp.

References drawLine().

◆ drawFastVLine()

void Adafruit_RA8875::drawFastVLine ( int16_t x,
int16_t y,
int16_t h,
uint16_t color )
virtual

Draw a vertical line

Parameters
xThe X position
yThe Y position
hHeight
colorThe color

Reimplemented from Adafruit_GFX.

Definition at line 864 of file Adafruit_RA8875.cpp.

References drawLine().

◆ drawLine()

void Adafruit_RA8875::drawLine ( int16_t x0,
int16_t y0,
int16_t x1,
int16_t y1,
uint16_t color )
virtual

Draws a HW accelerated line on the display

Parameters
x0The 0-based starting x location
y0The 0-base starting y location
x1The 0-based ending x location
y1The 0-base ending y location
colorThe RGB565 color to use when drawing the pixel

Reimplemented from Adafruit_GFX.

Definition at line 807 of file Adafruit_RA8875.cpp.

References RA8875_DCR, RA8875_DCR_LINESQUTRI_STATUS, waitPoll(), writeCommand(), and writeData().

Referenced by drawFastHLine(), drawFastVLine(), and testLCD().

◆ drawPixel()

void Adafruit_RA8875::drawPixel ( int16_t x,
int16_t y,
uint16_t color )
virtual

Draws a single pixel at the specified location

Parameters
xThe 0-based x location
yThe 0-base y location
colorThe RGB565 color to use when drawing the pixel

Implements Adafruit_GFX.

Definition at line 738 of file Adafruit_RA8875.cpp.

References RA8875_CURH0, RA8875_CURH1, RA8875_CURV0, RA8875_CURV1, RA8875_DATAWRITE, RA8875_MRWC, writeCommand(), and writeReg().

Referenced by testLCD().

◆ drawPixels()

void Adafruit_RA8875::drawPixels ( uint16_t * p,
uint32_t num,
int16_t x,
int16_t y )

Draws a series of pixels at the specified location without the overhead

Parameters
pAn array of RGB565 color pixels
numThe number of the pixels to draw
xThe 0-based x location
yThe 0-base y location

Definition at line 763 of file Adafruit_RA8875.cpp.

References RA8875_CURH0, RA8875_CURH1, RA8875_CURV0, RA8875_CURV1, RA8875_DATAWRITE, RA8875_MRWC, RA8875_MWCR0, RA8875_MWCR0_DIRMASK, RA8875_MWCR0_LRTD, RA8875_MWCR0_RLTD, readReg(), writeCommand(), and writeReg().

◆ drawRect()

void Adafruit_RA8875::drawRect ( int16_t x,
int16_t y,
int16_t w,
int16_t h,
uint16_t color )
virtual

Draws a HW accelerated rectangle on the display

Parameters
xThe 0-based x location of the top-right corner
yThe 0-based y location of the top-right corner
wThe rectangle width
hThe rectangle height
colorThe RGB565 color to use when drawing the pixel

Reimplemented from Adafruit_GFX.

Definition at line 895 of file Adafruit_RA8875.cpp.

Referenced by testLCD().

◆ drawRoundRect()

void Adafruit_RA8875::drawRoundRect ( int16_t x,
int16_t y,
int16_t w,
int16_t h,
int16_t r,
uint16_t color )

Draws a HW accelerated rounded rectangle on the display

Parameters
xThe 0-based x location of the rectangle's upper left corner
yThe 0-based y location of the rectangle's upper left corner
wThe size in pixels of the rectangle's width
hThe size in pixels of the rectangle's height
rThe radius of the curves in the corners of the rectangle
colorThe RGB565 color to use when drawing the pixel

Definition at line 1085 of file Adafruit_RA8875.cpp.

◆ drawTriangle()

void Adafruit_RA8875::drawTriangle ( int16_t x0,
int16_t y0,
int16_t x1,
int16_t y1,
int16_t x2,
int16_t y2,
uint16_t color )

Draws a HW accelerated triangle on the display

Parameters
x0The 0-based x location of point 0 on the triangle
y0The 0-based y location of point 0 on the triangle
x1The 0-based x location of point 1 on the triangle
y1The 0-based y location of point 1 on the triangle
x2The 0-based x location of point 2 on the triangle
y2The 0-based y location of point 2 on the triangle
colorThe RGB565 color to use when drawing the pixel

Definition at line 970 of file Adafruit_RA8875.cpp.

Referenced by testLCD().

◆ eepromReadS32()

uint32_t Adafruit_RA8875::eepromReadS32 ( int location)

Read a big-endian 32-bit value from the calibration storage

Parameters
locationThe byte address to read
Returns
The value (0 if no storage is set or the read fails)

Definition at line 1848 of file Adafruit_RA8875.cpp.

Referenced by readCalibration().

◆ eepromWriteS32()

void Adafruit_RA8875::eepromWriteS32 ( int location,
int32_t value )

Write a big-endian 32-bit value to the calibration storage

Parameters
locationThe byte address to write to
valueThe value to write

Definition at line 1864 of file Adafruit_RA8875.cpp.

Referenced by writeCalibration().

◆ fillCircle()

void Adafruit_RA8875::fillCircle ( int16_t x,
int16_t y,
int16_t r,
uint16_t color )

Draws a HW accelerated filled circle on the display

Parameters
xThe 0-based x location of the center of the circle
yThe 0-based y location of the center of the circle
rThe circle's radius
colorThe RGB565 color to use when drawing the pixel

Definition at line 952 of file Adafruit_RA8875.cpp.

Referenced by testLCD().

◆ fillCurve()

void Adafruit_RA8875::fillCurve ( int16_t xCenter,
int16_t yCenter,
int16_t longAxis,
int16_t shortAxis,
uint8_t curvePart,
uint16_t color )

Draws a HW accelerated filled curve on the display

Parameters
xCenterThe 0-based x location of the ellipse's center
yCenterThe 0-based y location of the ellipse's center
longAxisThe size in pixels of the ellipse's long axis
shortAxisThe size in pixels of the ellipse's short axis
curvePartThe corner to draw, where in clock-wise motion: 0 = 180-270° 1 = 270-0° 2 = 0-90° 3 = 90-180°
colorThe RGB565 color to use when drawing the pixel

Definition at line 1067 of file Adafruit_RA8875.cpp.

Referenced by testLCD().

◆ fillEllipse()

void Adafruit_RA8875::fillEllipse ( int16_t xCenter,
int16_t yCenter,
int16_t longAxis,
int16_t shortAxis,
uint16_t color )

Draws a HW accelerated filled ellipse on the display

Parameters
xCenterThe 0-based x location of the ellipse's center
yCenterThe 0-based y location of the ellipse's center
longAxisThe size in pixels of the ellipse's long axis
shortAxisThe size in pixels of the ellipse's short axis
colorThe RGB565 color to use when drawing the pixel

Definition at line 1023 of file Adafruit_RA8875.cpp.

Referenced by testLCD().

◆ fillRect() [1/2]

void Adafruit_RA8875::fillRect ( int16_t x,
int16_t y,
int16_t w,
int16_t h,
uint16_t color )
virtual

Draws a HW accelerated filled rectangle on the display

Parameters
xThe 0-based x location of the top-right corner
yThe 0-based y location of the top-right corner
wThe rectangle width
hThe rectangle height
colorThe RGB565 color to use when drawing the pixel

Reimplemented from Adafruit_GFX.

Definition at line 911 of file Adafruit_RA8875.cpp.

◆ fillRect() [2/2]

void Adafruit_RA8875::fillRect ( void )

Fill the screen with the current color

Definition at line 688 of file Adafruit_RA8875.cpp.

References RA8875_DCR, RA8875_DCR_DRAWSQUARE, RA8875_DCR_FILL, RA8875_DCR_LINESQUTRI_START, RA8875_DCR_LINESQUTRI_STOP, writeCommand(), and writeData().

Referenced by testLCD().

◆ fillRoundRect()

void Adafruit_RA8875::fillRoundRect ( int16_t x,
int16_t y,
int16_t w,
int16_t h,
int16_t r,
uint16_t color )

Draws a HW accelerated filled rounded rectangle on the display

Parameters
xThe 0-based x location of the rectangle's upper left corner
yThe 0-based y location of the rectangle's upper left corner
wThe size in pixels of the rectangle's width
hThe size in pixels of the rectangle's height
rThe radius of the curves in the corners of the rectangle
colorThe RGB565 color to use when drawing the pixel

Definition at line 1102 of file Adafruit_RA8875.cpp.

Referenced by testLCD().

◆ fillScreen()

void Adafruit_RA8875::fillScreen ( uint16_t color)
virtual

Fills the screen with the spefied RGB565 color

Parameters
colorThe RGB565 color to use when drawing the pixel

Reimplemented from Adafruit_GFX.

Definition at line 923 of file Adafruit_RA8875.cpp.

Referenced by testLCD().

◆ fillTriangle()

void Adafruit_RA8875::fillTriangle ( int16_t x0,
int16_t y0,
int16_t x1,
int16_t y1,
int16_t x2,
int16_t y2,
uint16_t color )

Draws a HW accelerated filled triangle on the display

Parameters
x0The 0-based x location of point 0 on the triangle
y0The 0-based y location of point 0 on the triangle
x1The 0-based x location of point 1 on the triangle
y1The 0-based y location of point 1 on the triangle
x2The 0-based x location of point 2 on the triangle
y2The 0-based y location of point 2 on the triangle
colorThe RGB565 color to use when drawing the pixel

Definition at line 989 of file Adafruit_RA8875.cpp.

Referenced by testLCD().

◆ getRotation()

int8_t Adafruit_RA8875::getRotation ( void )

Returns the current rotation (0-3)

Returns
The Rotation Setting

Definition at line 397 of file Adafruit_RA8875.cpp.

◆ GPIOX()

void Adafruit_RA8875::GPIOX ( boolean on)

Set the Extra General Purpose IO Register

Parameters
onWhether to turn Extra General Purpose IO on or not

Definition at line 1531 of file Adafruit_RA8875.cpp.

References RA8875_GPIOX, and writeReg().

Referenced by testLCD().

◆ graphicsMode()

void Adafruit_RA8875::graphicsMode ( void )

Sets the display in graphics mode (as opposed to text mode)

Definition at line 617 of file Adafruit_RA8875.cpp.

References RA8875_MWCR0, readData(), writeCommand(), and writeData().

Referenced by testLCD().

◆ height()

uint16_t Adafruit_RA8875::height ( void )

Returns the display height in pixels

Returns
The 1-based display height in pixels

Definition at line 386 of file Adafruit_RA8875.cpp.

◆ pushPixels()

void Adafruit_RA8875::pushPixels ( uint32_t num,
uint16_t p )

HW accelerated function to push a chunk of raw pixel data

Parameters
numThe number of pixels to push
pThe pixel color to use

Definition at line 667 of file Adafruit_RA8875.cpp.

References RA8875_DATAWRITE.

◆ PWM1config()

void Adafruit_RA8875::PWM1config ( boolean on,
uint8_t clock )

Configure the PWM 1 Clock

Parameters
onWhether to enable the clock
clockThe Clock Divider

Definition at line 1568 of file Adafruit_RA8875.cpp.

References RA8875_P1CR, RA8875_P1CR_DISABLE, RA8875_P1CR_ENABLE, and writeReg().

Referenced by testLCD().

◆ PWM1out()

void Adafruit_RA8875::PWM1out ( uint8_t p)

Set the duty cycle of the PWM 1 Clock

Parameters
pThe duty Cycle (0-255)

Definition at line 1545 of file Adafruit_RA8875.cpp.

References RA8875_P1DCR, and writeReg().

Referenced by testLCD().

◆ PWM2config()

void Adafruit_RA8875::PWM2config ( boolean on,
uint8_t clock )

Configure the PWM 2 Clock

Parameters
onWhether to enable the clock
clockThe Clock Divider

Definition at line 1584 of file Adafruit_RA8875.cpp.

References RA8875_P2CR, RA8875_P2CR_DISABLE, RA8875_P2CR_ENABLE, and writeReg().

◆ PWM2out()

void Adafruit_RA8875::PWM2out ( uint8_t p)

Set the duty cycle of the PWM 2 Clock

Parameters
pThe duty Cycle (0-255)

Definition at line 1556 of file Adafruit_RA8875.cpp.

References RA8875_P2DCR, and writeReg().

◆ readCalibration()

bool Adafruit_RA8875::readCalibration ( int location,
tsMatrix_t * matrixPtr )

◆ readData()

uint8_t Adafruit_RA8875::readData ( void )

Read the data from the current register

Returns
The Value

Definition at line 1753 of file Adafruit_RA8875.cpp.

References RA8875_DATAREAD, spi_begin, and spi_end.

Referenced by cursorBlink(), graphicsMode(), readReg(), textColor(), textEnlarge(), textMode(), and textTransparent().

◆ readReg()

uint8_t Adafruit_RA8875::readReg ( uint8_t reg)

Set the register to read from

Parameters
regRegister to read
Returns
The value

Definition at line 1723 of file Adafruit_RA8875.cpp.

References readData(), and writeCommand().

Referenced by begin(), drawPixels(), touched(), touchEnable(), touchRead(), and waitPoll().

◆ readStatus()

uint8_t Adafruit_RA8875::readStatus ( void )

Read the status from the current register

Returns
The value

Definition at line 1794 of file Adafruit_RA8875.cpp.

References RA8875_CMDREAD, spi_begin, and spi_end.

◆ scrollX()

void Adafruit_RA8875::scrollX ( int16_t dist)

Scroll in the X direction

Parameters
distThe distance to scroll

Definition at line 1499 of file Adafruit_RA8875.cpp.

References writeCommand(), and writeData().

◆ scrollY()

void Adafruit_RA8875::scrollY ( int16_t dist)

Scroll in the Y direction

Parameters
distThe distance to scroll

Definition at line 1514 of file Adafruit_RA8875.cpp.

References writeCommand(), and writeData().

◆ setCalibrationStorage()

void Adafruit_RA8875::setCalibrationStorage ( StorageReadFn read,
StorageWriteFn write,
void * ctx,
uint32_t sizeBytes )

Provide the non-volatile memory used to keep the touch calibration. STM32 has no Arduino EEPROM, so any memory can be plugged in (external EEPROM, FRAM, flash...). Addresses passed to readCalibration() / writeCalibration() are byte addresses in that memory.

Parameters
readRead callback (may be nullptr to disable reading)
writeWrite callback (may be nullptr to disable writing)
ctxPassed back to the callbacks (e.g. your FRAM object)
sizeBytesSize of the memory, used for bounds checking

Definition at line 1820 of file Adafruit_RA8875.cpp.

References write().

◆ setRotation()

void Adafruit_RA8875::setRotation ( int8_t rotation)

Sets the current rotation (0-3)

Parameters
rotationThe Rotation Setting

Definition at line 408 of file Adafruit_RA8875.cpp.

References Adafruit_GFX::rotation.

◆ setScrollWindow()

void Adafruit_RA8875::setScrollWindow ( int16_t x,
int16_t y,
int16_t w,
int16_t h,
uint8_t mode )

Set the scroll window

Parameters
xX position of the scroll window
yY position of the scroll window
wWidth of the Scroll Window
hHeight of the Scroll window
modeLayer to Scroll

Definition at line 1460 of file Adafruit_RA8875.cpp.

References writeCommand(), and writeData().

◆ setXY()

void Adafruit_RA8875::setXY ( uint16_t x,
uint16_t y )

Sets the current X/Y position on the display before drawing

Parameters
xThe 0-based x location
yThe 0-base y location

Definition at line 652 of file Adafruit_RA8875.cpp.

References RA8875_CURH0, RA8875_CURH1, RA8875_CURV0, RA8875_CURV1, and writeReg().

◆ sleep()

void Adafruit_RA8875::sleep ( boolean sleep)

Puts the display in sleep mode, or disables sleep mode if enabled

Parameters
sleepWhether to sleep or not

Definition at line 1692 of file Adafruit_RA8875.cpp.

References RA8875_PWRR, RA8875_PWRR_DISPOFF, RA8875_PWRR_SLEEP, sleep(), and writeReg().

Referenced by sleep().

◆ softReset()

void Adafruit_RA8875::softReset ( void )

Performs a SW-based reset of the RA8875

Definition at line 245 of file Adafruit_RA8875.cpp.

References RA8875_PWRR, RA8875_PWRR_NORMAL, RA8875_PWRR_SOFTRESET, writeCommand(), and writeData().

◆ textColor()

void Adafruit_RA8875::textColor ( uint16_t foreColor,
uint16_t bgColor )

Sets the fore and background color when rendering text

Parameters
foreColorThe RGB565 color to use when rendering the text
bgColorThe RGB565 colot to use for the background

Definition at line 471 of file Adafruit_RA8875.cpp.

References readData(), writeCommand(), and writeData().

Referenced by testLCD().

◆ textEnlarge()

void Adafruit_RA8875::textEnlarge ( uint8_t scale)

Sets the text enlarge settings, using one of the following values:

0 = 1x zoom 1 = 2x zoom 2 = 3x zoom 3 = 4x zoom

Parameters
scaleThe zoom factor (0..3 for 1-4x zoom)

Definition at line 530 of file Adafruit_RA8875.cpp.

References readData(), writeCommand(), and writeData().

Referenced by testLCD().

◆ textMode()

void Adafruit_RA8875::textMode ( void )

Sets the display in text mode (as opposed to graphics mode)

Definition at line 426 of file Adafruit_RA8875.cpp.

References RA8875_MWCR0, RA8875_MWCR0_TXTMODE, readData(), writeCommand(), and writeData().

Referenced by testLCD().

◆ textSetCursor()

void Adafruit_RA8875::textSetCursor ( uint16_t x,
uint16_t y )

Sets the display in text mode (as opposed to graphics mode)

Parameters
xThe x position of the cursor (in pixels, 0..1023)
yThe y position of the cursor (in pixels, 0..511)

Definition at line 448 of file Adafruit_RA8875.cpp.

References writeCommand(), and writeData().

Referenced by testLCD().

◆ textTransparent()

void Adafruit_RA8875::textTransparent ( uint16_t foreColor)

Sets the fore color when rendering text with a transparent bg

Parameters
foreColorThe RGB565 color to use when rendering the text

Definition at line 502 of file Adafruit_RA8875.cpp.

References readData(), writeCommand(), and writeData().

Referenced by testLCD().

◆ textWrite()

void Adafruit_RA8875::textWrite ( const char * buffer,
uint16_t len = 0 )

Renders some text on the screen when in text mode

Parameters
bufferThe buffer containing the characters to render
lenThe size of the buffer in bytes

Definition at line 585 of file Adafruit_RA8875.cpp.

References RA8875_MRWC, writeCommand(), and writeData().

Referenced by testLCD(), write(), and write().

◆ touched()

boolean Adafruit_RA8875::touched ( void )

Checks if a touch event has occured

Returns
True is a touch event has occured (reading it via touchRead() will clear the interrupt in memory)

Definition at line 1631 of file Adafruit_RA8875.cpp.

References RA8875_INTC2, RA8875_INTC2_TP, and readReg().

◆ touchEnable()

void Adafruit_RA8875::touchEnable ( boolean on)

◆ touchRead()

boolean Adafruit_RA8875::touchRead ( uint16_t * x,
uint16_t * y )

Reads the last touch event

Parameters
xPointer to the uint16_t field to assign the raw X value
yPointer to the uint16_t field to assign the raw Y value
Returns
True if successful
Note
Calling this function will clear the touch panel interrupt on the RA8875, resetting the flag used by the 'touched' function

Definition at line 1650 of file Adafruit_RA8875.cpp.

References RA8875_INTC2, RA8875_INTC2_TP, RA8875_TPXH, RA8875_TPXYL, RA8875_TPYH, readReg(), and writeReg().

◆ waitPoll()

boolean Adafruit_RA8875::waitPoll ( uint8_t regname,
uint8_t waitflag )

Waits for screen to finish by polling the status!

Parameters
regnameThe register name to check
waitflagThe value to wait for the status register to match
Returns
True if the expected status has been reached

Definition at line 634 of file Adafruit_RA8875.cpp.

References readReg().

Referenced by drawLine().

◆ width()

uint16_t Adafruit_RA8875::width ( void )

Returns the display width in pixels

Returns
The 1-based display width in pixels

Definition at line 375 of file Adafruit_RA8875.cpp.

◆ write() [1/2]

virtual size_t Adafruit_RA8875::write ( const uint8_t * buffer,
size_t size )
inlinevirtual

Alias of textWrite to Play nice with Arduino's Print class

Parameters
bufferThe buffer to write
sizeThe size of the buffer
Returns
The number of bytes written

Reimplemented from Adafruit_GFX.

Definition at line 244 of file Adafruit_RA8875.h.

References textWrite().

◆ write() [2/2]

virtual size_t Adafruit_RA8875::write ( uint8_t b)
inlinevirtual

Alias of textWrite to Play nice with Arduino's Print class

Parameters
bThe string to write
Returns
The number of bytes written

Reimplemented from Adafruit_GFX.

Definition at line 229 of file Adafruit_RA8875.h.

References textWrite().

Referenced by setCalibrationStorage().

◆ writeCalibration()

void Adafruit_RA8875::writeCalibration ( int location,
tsMatrix_t * matrixPtr )

◆ writeCommand()

void Adafruit_RA8875::writeCommand ( uint8_t d)

Write a command to the current register

Parameters
dThe data to write as a command

Definition at line 1774 of file Adafruit_RA8875.cpp.

References RA8875_CMDWRITE, spi_begin, and spi_end.

Referenced by cursorBlink(), drawLine(), drawPixel(), drawPixels(), fillRect(), graphicsMode(), readReg(), scrollX(), scrollY(), setScrollWindow(), softReset(), textColor(), textEnlarge(), textMode(), textSetCursor(), textTransparent(), textWrite(), and writeReg().

◆ writeData()

void Adafruit_RA8875::writeData ( uint8_t d)

Write data to the current register

Parameters
dData to write

Definition at line 1735 of file Adafruit_RA8875.cpp.

References RA8875_DATAWRITE, spi_begin, and spi_end.

Referenced by cursorBlink(), drawLine(), fillRect(), graphicsMode(), scrollX(), scrollY(), setScrollWindow(), softReset(), textColor(), textEnlarge(), textMode(), textSetCursor(), textTransparent(), textWrite(), and writeReg().

◆ writeReg()

void Adafruit_RA8875::writeReg ( uint8_t reg,
uint8_t val )

Write data to the specified register

Parameters
regRegister to write to
valValue to write

Definition at line 1709 of file Adafruit_RA8875.cpp.

References writeCommand(), and writeData().

Referenced by displayOn(), drawPixel(), drawPixels(), GPIOX(), PWM1config(), PWM1out(), PWM2config(), PWM2out(), setXY(), sleep(), touchEnable(), and touchRead().


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