Skip to content

Moved to actions, documented with doxygen #47

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .github/workflows/githubci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Arduino Library CI

on: [pull_request, push, repository_dispatch]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/setup-python@v1
with:
python-version: '3.x'
- uses: actions/checkout@v2
- uses: actions/checkout@v2
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 main_platforms

- 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 TFTLCD Library"
run: bash ci/doxy_gen_and_deploy.sh
50 changes: 42 additions & 8 deletions Adafruit_TFTLCD.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,32 @@
/*!
* @file Adafruit_TFTLCD.cpp
*
* @mainpage Adafruit TFTLCD Library
*
* @section intro_sec Introduction
*
* This is a library for our Adafruit 16-channel PWM & Servo driver, shield or
* FeatherWing
*
* Pick one up today in the adafruit shop!
* * https://www.adafruit.com/product/335
* * https://www.adafruit.com/product/376
*
* These displays use 8-bit parallel to communicate, 12 or 13 pins are required
* to interface (RST is optional). Adafruit invests time and resources providing
* this open source code, please support Adafruit and open-source hardware by
* purchasing products from Adafruit!
*
* @section author Author
*
* Written by Limor Fried/Ladyada for Adafruit Industries.
*
* @section license License
*
* BSD license, check license.txt for more information. All text above must be
* included in any redistribution
*/

// IMPORTANT: LIBRARY MUST BE SPECIFICALLY CONFIGURED FOR EITHER TFT SHIELD
// OR BREAKOUT BOARD USAGE. SEE RELEVANT COMMENTS IN Adafruit_TFTLCD.h

Expand All @@ -21,15 +50,15 @@
//#define TFTWIDTH 320
//#define TFTHEIGHT 480

#define TFTWIDTH 240
#define TFTHEIGHT 320
#define TFTWIDTH 240 //!< TFT width in pixels
#define TFTHEIGHT 320 //!< TFT height in pixels

// LCD controller chip identifiers
#define ID_932X 0
#define ID_7575 1
#define ID_9341 2
#define ID_HX8357D 3
#define ID_UNKNOWN 0xFF
#define ID_932X 0 //!< 932x LCD driver ID
#define ID_7575 1 //!< 7575 LCD driver ID
#define ID_9341 2 //!< 9341 LCD driver ID
#define ID_HX8357D 3 //!< HX8357D LCD driver ID
#define ID_UNKNOWN 0xFF //!< Unknown LCD driver ID

#include "registers.h"

Expand Down Expand Up @@ -118,7 +147,7 @@ void Adafruit_TFTLCD::init(void) {
}

// Initialization command tables for different LCD controllers
#define TFTLCD_DELAY 0xFF
#define TFTLCD_DELAY 0xFF //!< Allows the delay to be set
static const uint8_t HX8347G_regValues[] PROGMEM = {
0x2E, 0x89, 0x29, 0x8F, 0x2B, 0x02, 0xE2, 0x00, 0xE4, 0x01, 0xE5, 0x10,
0xE6, 0x01, 0xE7, 0x10, 0xE8, 0x70, 0xF2, 0x00, 0xEA, 0x00, 0xEB, 0x20,
Expand All @@ -137,6 +166,7 @@ static const uint8_t HX8347G_regValues[] PROGMEM = {
0x02, 0x00, 0x03, 0x00, 0x04, 0x00, 0x05, 0xEF, 0x06, 0x00, 0x07, 0x00,
0x08, 0x01, 0x09, 0x3F};

/// @cond SKIP
static const uint8_t HX8357D_regValues[] PROGMEM = {
HX8357_SWRESET,
0,
Expand Down Expand Up @@ -315,6 +345,7 @@ static const uint16_t ILI932x_regValues[] PROGMEM = {
ILI932X_DISP_CTRL1,
0x0133, // Main screen turn on
};
/// @endcond SKIP

void Adafruit_TFTLCD::begin(uint16_t id) {
uint8_t i = 0;
Expand Down Expand Up @@ -930,6 +961,9 @@ void Adafruit_TFTLCD::setRotation(uint8_t x) {
}

#ifdef read8isFunctionalized
/*!
* @brief Reads 8 bits
*/
#define read8(x) x = read8fn()
#endif

Expand Down
116 changes: 115 additions & 1 deletion Adafruit_TFTLCD.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/*!
* @brief Adafruit_TFTLCD.h
*/
// IMPORTANT: SEE COMMENTS @ LINE 15 REGARDING SHIELD VS BREAKOUT BOARD USAGE.

// Graphics library by ladyada/adafruit with init code from Rossum
Expand All @@ -22,25 +25,136 @@
class Adafruit_TFTLCD : public Adafruit_GFX {

public:
/*!
* @brief TFTLCD constructor
* @param cs Chip select pin
* @param cd Command/data pin
* @param wr Write pin
* @param rd Read pin
* @param rst Reset pin
*/
Adafruit_TFTLCD(uint8_t cs, uint8_t cd, uint8_t wr, uint8_t rd, uint8_t rst);
Adafruit_TFTLCD(void);

/*!
* @brief Begins connection
* @param id LCD controller id
*/
void begin(uint16_t id = 0x9325);
/*!
* @brief Sets a specified pixel the specified color
* @param x X location of the pixel
* @param y Y location of the pixel
* @param color Color to set the pixel
*/
void drawPixel(int16_t x, int16_t y, uint16_t color);
/*!
* @brief Draw fast horizontal line
* @param x0 Starting X position
* @param y0 Starting Y position
* @param w Length of the line
* @param color Color of the line
*/
void drawFastHLine(int16_t x0, int16_t y0, int16_t w, uint16_t color);
/*!
* @brief Draw fast vertical line
* @param x0 Starting X position
* @param y0 Starting Y position
* @param h Height of the line
* @param color Color of the line
*/
void drawFastVLine(int16_t x0, int16_t y0, int16_t h, uint16_t color);
/*!
* @brief Makes a filled rectangle
* @param x Initial x value of the rectangle
* @param y Initial y value of the rectangle
* @param w Width of the rectangle
* @param h Height of the rectangle
* @param c Color of the rectangle
*/
void fillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t c);
/*!
* @brief Fills screen with the specified color
* @param color Color to set the screen
*/
void fillScreen(uint16_t color);
/*!
* @brief Resets the display
*/
void reset(void);
/*!
* @brief Appears to be deprecated. Sets a register
* @param ptr Pointer to the register to set
* @param n How many bytes to set
*/
void setRegisters8(uint8_t *ptr, uint8_t n);
/*!
* @brief Appears to be deprecated. Sets a register
* @param ptr Pointer to the register to set
* @param n How many bytes to set
*/
void setRegisters16(uint16_t *ptr, uint8_t n);
/*!
* @brief Rotates the display
* @param x How much to rotate the display
*/
void setRotation(uint8_t x);
// These methods are public in order for BMP examples to work:
/*!
* @brief Sets the LCD address window (and address counter, on 932X).
* Relevant to rect/screen fills and H/V lines. Input coordinates are
* assumed pre-sorted (e.g. x2 >= x1)
* @param x1 X1 of the lcd window
* @param y1 Y1 of the lcd window
* @param x2 X2 of the lcd window
* @param y2 Y2 of the lcd window
*/
void setAddrWindow(int x1, int y1, int x2, int y2);
/*!
* @brief Issues 'raw' an array of 16-bit color values to the LCD; used
* externally by BMP examples. Assumes that setWindowAddr() has
* previously been set to define the bounds. Max 255 pixels at
* a time (BMP examples read in small chunks due to limited RAM).
* @param data Pointer to array with data
* @param len How much of the data to issue
* @param first If first is true, CGRAM write command is only issued on the
* first call
*/
void pushColors(uint16_t *data, uint8_t len, boolean first);

/*!
* @brief Pass 8-bit (each) R,G,B, get back 16-bit packed color
* @param r Red value
* @param g Green value
* @param b Blue value
* @return Returns the 16-bit packed color
*/
uint16_t color565(uint8_t r, uint8_t g, uint8_t b),
readPixel(int16_t x, int16_t y), readID(void);
/*!
* @brief Reads the state of a single pixel.
* Because this function is used infrequently, it configures the ports for
* the read operation, reads the data, then restores the ports to the
* write configuration. Write operations happen a LOT, so it's
* advantageous to leave the ports in that state as a default.
* @param x X value of the pixel to read
* @param y Y value of the pixel to read
* @return Returns the state of the pixel
*/
readPixel(int16_t x, int16_t y),
/*!
*@brief Reads the ID of the device
* Because this function is used infrequently, it configures the ports for
* the read operation, reads the data, then restores the ports to the
*write configuration. Write operations happen a LOT, so it's
*advantageous to leave the ports in that state as a default.
* @return Returns the ID of the device
*/
readID(void);
/*!
* @brief Reads the specified register
* @param r Address of the register to read
* @return Returns the data from the register
*/
uint32_t readReg(uint8_t r);

private:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Adafruit library for 8-bit TFT LCDs such as ILI9325, ILI9328, etc
# Adafruit library for 8-bit TFT LCDs such as ILI9325, ILI9328, etc [![Build Status](https://github.com/adafruit/TFTLCD-Library/workflows/Arduino%20Library%20CI/badge.svg)](https://github.com/adafruit/TFTLCD-Library/actions)[![Documentation](https://github.com/adafruit/ci-arduino/blob/master/assets/doxygen_badge.svg)](http://adafruit.github.io/TFTLCD-Library/html/index.html)

This is a library for our Adafruit 16-channel PWM & Servo driver, shield or FeatherWing

Expand Down
Loading