Adafruit RA8875 Arduino Library
|
Class that stores state and functions for interacting with the RA8875 display controller. More...
#include <Adafruit_RA8875.h>
Public Member Functions | |
Adafruit_RA8875 (uint8_t cs, uint8_t rst) | |
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) |
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) |
Class that stores state and functions for interacting with the RA8875 display controller.
Adafruit_RA8875::Adafruit_RA8875 | ( | uint8_t | CS, |
uint8_t | RST | ||
) |
Constructor for a new RA8875 instance
CS | Location of the SPI chip select pin |
RST | Location of the reset pin |
boolean Adafruit_RA8875::begin | ( | enum RA8875sizes | s | ) |
Initialises the LCD driver and any HW required by the display
s | The 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) |
void Adafruit_RA8875::softReset | ( | void | ) |
Performs a SW-based reset of the RA8875
void Adafruit_RA8875::displayOn | ( | boolean | on | ) |
Turns the display on or off
on | Whether to turn the display on or not |
void Adafruit_RA8875::sleep | ( | boolean | sleep | ) |
Puts the display in sleep mode, or disables sleep mode if enabled
sleep | Whether to sleep or not |
void Adafruit_RA8875::textMode | ( | void | ) |
Sets the display in text mode (as opposed to graphics mode)
void Adafruit_RA8875::textSetCursor | ( | uint16_t | x, |
uint16_t | y | ||
) |
Sets the display in text mode (as opposed to graphics mode)
x | The x position of the cursor (in pixels, 0..1023) |
y | The y position of the cursor (in pixels, 0..511) |
void Adafruit_RA8875::textColor | ( | uint16_t | foreColor, |
uint16_t | bgColor | ||
) |
Sets the fore and background color when rendering text
foreColor | The RGB565 color to use when rendering the text |
bgColor | The RGB565 colot to use for the background |
void Adafruit_RA8875::textTransparent | ( | uint16_t | foreColor | ) |
Sets the fore color when rendering text with a transparent bg
foreColor | The RGB565 color to use when rendering the text |
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
scale | The zoom factor (0..3 for 1-4x zoom) |
void Adafruit_RA8875::textWrite | ( | const char * | buffer, |
uint16_t | len = 0 |
||
) |
Renders some text on the screen when in text mode
buffer | The buffer containing the characters to render |
len | The size of the buffer in bytes |
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)
rate | The frame rate to blink |
void Adafruit_RA8875::graphicsMode | ( | void | ) |
Sets the display in graphics mode (as opposed to text mode)
void Adafruit_RA8875::setXY | ( | uint16_t | x, |
uint16_t | y | ||
) |
Sets the current X/Y position on the display before drawing
x | The 0-based x location |
y | The 0-base y location |
void Adafruit_RA8875::pushPixels | ( | uint32_t | num, |
uint16_t | p | ||
) |
HW accelerated function to push a chunk of raw pixel data
num | The number of pixels to push |
p | The pixel color to use |
void Adafruit_RA8875::fillRect | ( | void | ) |
Fill the screen with the current color
void Adafruit_RA8875::drawPixel | ( | int16_t | x, |
int16_t | y, | ||
uint16_t | color | ||
) |
Draws a single pixel at the specified location
x | The 0-based x location |
y | The 0-base y location |
color | The RGB565 color to use when drawing the pixel |
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
p | An array of RGB565 color pixels |
num | The number of the pixels to draw |
x | The 0-based x location |
y | The 0-base y location |
void Adafruit_RA8875::drawFastVLine | ( | int16_t | x, |
int16_t | y, | ||
int16_t | h, | ||
uint16_t | color | ||
) |
Draw a vertical line
x | The X position |
y | The Y position |
h | Height |
color | The color |
void Adafruit_RA8875::drawFastHLine | ( | int16_t | x, |
int16_t | y, | ||
int16_t | w, | ||
uint16_t | color | ||
) |
Draw a horizontal line
x | The X position |
y | The Y position |
w | Width |
color | The color |
void Adafruit_RA8875::fillScreen | ( | uint16_t | color | ) |
Fills the screen with the spefied RGB565 color
color | The RGB565 color to use when drawing the pixel |
void Adafruit_RA8875::drawLine | ( | int16_t | x0, |
int16_t | y0, | ||
int16_t | x1, | ||
int16_t | y1, | ||
uint16_t | color | ||
) |
Draws a HW accelerated line on the display
x0 | The 0-based starting x location |
y0 | The 0-base starting y location |
x1 | The 0-based ending x location |
y1 | The 0-base ending y location |
color | The RGB565 color to use when drawing the pixel |
void Adafruit_RA8875::drawRect | ( | int16_t | x, |
int16_t | y, | ||
int16_t | w, | ||
int16_t | h, | ||
uint16_t | color | ||
) |
Draws a HW accelerated rectangle on the display
x | The 0-based x location of the top-right corner |
y | The 0-based y location of the top-right corner |
w | The rectangle width |
h | The rectangle height |
color | The RGB565 color to use when drawing the pixel |
void Adafruit_RA8875::fillRect | ( | int16_t | x, |
int16_t | y, | ||
int16_t | w, | ||
int16_t | h, | ||
uint16_t | color | ||
) |
Draws a HW accelerated filled rectangle on the display
x | The 0-based x location of the top-right corner |
y | The 0-based y location of the top-right corner |
w | The rectangle width |
h | The rectangle height |
color | The RGB565 color to use when drawing the pixel |
void Adafruit_RA8875::drawCircle | ( | int16_t | x, |
int16_t | y, | ||
int16_t | r, | ||
uint16_t | color | ||
) |
Draws a HW accelerated circle on the display
x | The 0-based x location of the center of the circle |
y | The 0-based y location of the center of the circle |
r | The circle's radius |
color | The RGB565 color to use when drawing the pixel |
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
x | The 0-based x location of the center of the circle |
y | The 0-based y location of the center of the circle |
r | The circle's radius |
color | The RGB565 color to use when drawing the pixel |
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
x0 | The 0-based x location of point 0 on the triangle |
y0 | The 0-based y location of point 0 on the triangle |
x1 | The 0-based x location of point 1 on the triangle |
y1 | The 0-based y location of point 1 on the triangle |
x2 | The 0-based x location of point 2 on the triangle |
y2 | The 0-based y location of point 2 on the triangle |
color | The RGB565 color to use when drawing the pixel |
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
x0 | The 0-based x location of point 0 on the triangle |
y0 | The 0-based y location of point 0 on the triangle |
x1 | The 0-based x location of point 1 on the triangle |
y1 | The 0-based y location of point 1 on the triangle |
x2 | The 0-based x location of point 2 on the triangle |
y2 | The 0-based y location of point 2 on the triangle |
color | The RGB565 color to use when drawing the pixel |
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
xCenter | The 0-based x location of the ellipse's center |
yCenter | The 0-based y location of the ellipse's center |
longAxis | The size in pixels of the ellipse's long axis |
shortAxis | The size in pixels of the ellipse's short axis |
color | The RGB565 color to use when drawing the pixel |
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
xCenter | The 0-based x location of the ellipse's center |
yCenter | The 0-based y location of the ellipse's center |
longAxis | The size in pixels of the ellipse's long axis |
shortAxis | The size in pixels of the ellipse's short axis |
color | The RGB565 color to use when drawing the pixel |
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
xCenter | The 0-based x location of the ellipse's center |
yCenter | The 0-based y location of the ellipse's center |
longAxis | The size in pixels of the ellipse's long axis |
shortAxis | The size in pixels of the ellipse's short axis |
curvePart | The corner to draw, where in clock-wise motion: 0 = 180-270° 1 = 270-0° 2 = 0-90° 3 = 90-180° |
color | The RGB565 color to use when drawing the pixel |
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
xCenter | The 0-based x location of the ellipse's center |
yCenter | The 0-based y location of the ellipse's center |
longAxis | The size in pixels of the ellipse's long axis |
shortAxis | The size in pixels of the ellipse's short axis |
curvePart | The corner to draw, where in clock-wise motion: 0 = 180-270° 1 = 270-0° 2 = 0-90° 3 = 90-180° |
color | The RGB565 color to use when drawing the pixel |
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
x | The 0-based x location of the rectangle's upper left corner |
y | The 0-based y location of the rectangle's upper left corner |
w | The size in pixels of the rectangle's width |
h | The size in pixels of the rectangle's height |
r | The radius of the curves in the corners of the rectangle |
color | The RGB565 color to use when drawing the pixel |
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
x | The 0-based x location of the rectangle's upper left corner |
y | The 0-based y location of the rectangle's upper left corner |
w | The size in pixels of the rectangle's width |
h | The size in pixels of the rectangle's height |
r | The radius of the curves in the corners of the rectangle |
color | The RGB565 color to use when drawing the pixel |
void Adafruit_RA8875::setScrollWindow | ( | int16_t | x, |
int16_t | y, | ||
int16_t | w, | ||
int16_t | h, | ||
uint8_t | mode | ||
) |
Set the scroll window
x | X position of the scroll window |
y | Y position of the scroll window |
w | Width of the Scroll Window |
h | Height of the Scroll window |
mode | Layer to Scroll |
void Adafruit_RA8875::scrollX | ( | int16_t | dist | ) |
Scroll in the X direction
dist | The distance to scroll |
void Adafruit_RA8875::scrollY | ( | int16_t | dist | ) |
Scroll in the Y direction
dist | The distance to scroll |
void Adafruit_RA8875::GPIOX | ( | boolean | on | ) |
Set the Extra General Purpose IO Register
on | Whether to turn Extra General Purpose IO on or not |
void Adafruit_RA8875::PWM1config | ( | boolean | on, |
uint8_t | clock | ||
) |
Configure the PWM 1 Clock
on | Whether to enable the clock |
clock | The Clock Divider |
void Adafruit_RA8875::PWM2config | ( | boolean | on, |
uint8_t | clock | ||
) |
Configure the PWM 2 Clock
on | Whether to enable the clock |
clock | The Clock Divider |
void Adafruit_RA8875::PWM1out | ( | uint8_t | p | ) |
Set the duty cycle of the PWM 1 Clock
p | The duty Cycle (0-255) |
void Adafruit_RA8875::PWM2out | ( | uint8_t | p | ) |
Set the duty cycle of the PWM 2 Clock
p | The duty Cycle (0-255) |
void Adafruit_RA8875::touchEnable | ( | boolean | on | ) |
Enables or disables the on-chip touch screen controller
on | Whether to turn touch sensing on or not |
boolean Adafruit_RA8875::touched | ( | void | ) |
Checks if a touch event has occured
boolean Adafruit_RA8875::touchRead | ( | uint16_t * | x, |
uint16_t * | y | ||
) |
Reads the last touch event
x | Pointer to the uint16_t field to assign the raw X value |
y | Pointer to the uint16_t field to assign the raw Y value |
uint32_t Adafruit_RA8875::eepromReadS32 | ( | int | location | ) |
Read from the EEPROM location
location | The location of the EEPROM to read |
void Adafruit_RA8875::eepromWriteS32 | ( | int | location, |
int32_t | value | ||
) |
Write to the EEPROM location
location | The location of the EEPROM to write to |
value | The value to write |
bool Adafruit_RA8875::readCalibration | ( | int | location, |
tsMatrix_t * | matrixPtr | ||
) |
Read Calibration Data from the EEPROM location
location | The location of the EEPROM to read from |
matrixPtr | The pointer to the Matrix Variable |
void Adafruit_RA8875::writeCalibration | ( | int | location, |
tsMatrix_t * | matrixPtr | ||
) |
Write Calibration Data to the EEPROM location
location | The location of the EEPROM to write to |
matrixPtr | The pointer to the Matrix Variable |
void Adafruit_RA8875::writeReg | ( | uint8_t | reg, |
uint8_t | val | ||
) |
Write data to the specified register
reg | Register to write to |
val | Value to write |
uint8_t Adafruit_RA8875::readReg | ( | uint8_t | reg | ) |
Set the register to read from
reg | Register to read |
void Adafruit_RA8875::writeData | ( | uint8_t | d | ) |
Write data to the current register
d | Data to write |
uint8_t Adafruit_RA8875::readData | ( | void | ) |
Read the data from the current register
void Adafruit_RA8875::writeCommand | ( | uint8_t | d | ) |
Write a command to the current register
d | The data to write as a command |
uint8_t Adafruit_RA8875::readStatus | ( | void | ) |
Read the status from the current register
boolean Adafruit_RA8875::waitPoll | ( | uint8_t | regname, |
uint8_t | waitflag | ||
) |
Waits for screen to finish by polling the status!
regname | The register name to check |
waitflag | The value to wait for the status register to match |
uint16_t Adafruit_RA8875::width | ( | void | ) |
Returns the display width in pixels
uint16_t Adafruit_RA8875::height | ( | void | ) |
Returns the display height in pixels
void Adafruit_RA8875::setRotation | ( | int8_t | rotation | ) |
Sets the current rotation (0-3)
rotation | The Rotation Setting |
int8_t Adafruit_RA8875::getRotation | ( | void | ) |
Returns the current rotation (0-3)
|
inlinevirtual |
Alias of textWrite to Play nice with Arduino's Print class
b | The string to write |
|
inlinevirtual |
Alias of textWrite to Play nice with Arduino's Print class
buffer | The buffer to write |
size | The size of the buffer |