Skip to content

Commit

Permalink
Merge pull request #23 from tobozo/lgfx_test
Browse files Browse the repository at this point in the history
LovyanGFX Edition
  • Loading branch information
tobozo authored Jun 2, 2020
2 parents 368daf0 + f191be9 commit ec931d1
Show file tree
Hide file tree
Showing 147 changed files with 37,872 additions and 54,939 deletions.
28 changes: 20 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ sudo: required
language: python
python: 3.6


env:
global:
# The Arduino IDE will be installed at APPLICATION_FOLDER/arduino
Expand All @@ -17,17 +18,17 @@ before_install:

# Formatting checks:
# Check for files starting with a blank line
- find . -type d \( -path './.git' -o -path './examples' -o -path './src/Fonts' \) -prune -or -type f -print0 | xargs -0 -L1 bash -c 'head -1 "$0" | grep --binary-files=without-match --regexp="^$"; if [[ "$?" == "0" ]]; then echo "Blank line found at start of $0."; false; fi'
#- find . -type d \( -path './.git' -o -path './examples' -o -path './src/Fonts' \) -prune -or -type f -print0 | xargs -0 -L1 bash -c 'head -1 "$0" | grep --binary-files=without-match --regexp="^$"; if [[ "$?" == "0" ]]; then echo "Blank line found at start of $0."; false; fi'
# don't check for tabs
- find . -type d \( -path './.git' -o -path './examples' -o -path './src/Fonts' \) -prune -or -type f \( ! -iname ".gitmodules" \) -exec grep --with-filename --line-number --binary-files=without-match --regexp=$'\t' '{}' \; -exec echo 'Tab found.' \; -exec false '{}' +
#- find . -type d \( -path './.git' -o -path './examples' -o -path './src/Fonts' \) -prune -or -type f \( ! -iname ".gitmodules" \) -exec grep --with-filename --line-number --binary-files=without-match --regexp=$'\t' '{}' \; -exec echo 'Tab found.' \; -exec false '{}' +
# Check for trailing whitespace
- find . -type d \( -path './.git' -o -path './examples' -o -path './src/Fonts' \) -prune -or -type f -exec grep --with-filename --line-number --binary-files=without-match --regexp='[[:blank:]]$' '{}' \; -exec echo 'Trailing whitespace found.' \; -exec false '{}' +
#- find . -type d \( -path './.git' -o -path './examples' -o -path './src/Fonts' \) -prune -or -type f -exec grep --with-filename --line-number --binary-files=without-match --regexp='[[:blank:]]$' '{}' \; -exec echo 'Trailing whitespace found.' \; -exec false '{}' +
# Check for non-Unix line endings
- find . -type d \( -path './.git' -o -path './examples' -o -path './src/Fonts' \) -prune -or -type f -exec grep --files-with-matches --binary-files=without-match --regexp=$'\r$' '{}' \; -exec echo 'Non-Unix EOL detected.' \; -exec false '{}' +
#- find . -type d \( -path './.git' -o -path './examples' -o -path './src/Fonts' \) -prune -or -type f -exec grep --files-with-matches --binary-files=without-match --regexp=$'\r$' '{}' \; -exec echo 'Non-Unix EOL detected.' \; -exec false '{}' +
# Check for blank lines at end of files
- find . -type d \( -path './.git' -o -path './examples' -o -path './src/Fonts' \) -prune -or -type f -print0 | xargs -0 -L1 bash -c 'tail -1 "$0" | grep --binary-files=without-match --regexp="^$"; if [[ "$?" == "0" ]]; then echo "Blank line found at end of $0."; false; fi'
#- find . -type d \( -path './.git' -o -path './examples' -o -path './src/Fonts' \) -prune -or -type f -print0 | xargs -0 -L1 bash -c 'tail -1 "$0" | grep --binary-files=without-match --regexp="^$"; if [[ "$?" == "0" ]]; then echo "Blank line found at end of $0."; false; fi'
# Check for files that don't end in a newline (https://stackoverflow.com/a/25686825)
- find . -type d \( -path './.git' -o -path './examples' -o -path './src/Fonts' \) -prune -or -type f -print0 | xargs -0 -L1 bash -c 'if test "$(grep --files-with-matches --binary-files=without-match --max-count=1 --regexp='.*' "$0")" && test "$(tail --bytes=1 "$0")"; then echo "No new line at end of $0."; false; fi'
#- find . -type d \( -path './.git' -o -path './examples' -o -path './src/Fonts' \) -prune -or -type f -print0 | xargs -0 -L1 bash -c 'if test "$(grep --files-with-matches --binary-files=without-match --max-count=1 --regexp='.*' "$0")" && test "$(tail --bytes=1 "$0")"; then echo "No new line at end of $0."; false; fi'

- git clone https://github.com/per1234/arduino-ci-script.git "${HOME}/scripts/arduino-ci-script"
- cd "${HOME}/scripts/arduino-ci-script"
Expand All @@ -47,7 +48,7 @@ before_install:
- set_sketchbook_folder "$SKETCHBOOK_FOLDER"

#- install_ide '("1.8.0" "1.8.10" "1.8.11")'
- install_ide '("1.8.0" "1.8.10" "newest")'
- install_ide '("1.8.10" "newest")'

# Install the library from the repository
- install_library
Expand All @@ -58,8 +59,19 @@ script:
# Compile all example sketches included with the library
# build_sketch arguments: sketch name, fqbn, allow failure, IDE version/list/range
- check_library_manager_compliance "$TRAVIS_BUILD_DIR"
# no need to treat compiler warnings as error
- set_ide_preference "compiler.warning_level=auto"
# compile at least one basic example
- build_sketch "${TRAVIS_BUILD_DIR}/examples/Basics/Display/Display.ino" "esp32:esp32:m5stack-core-esp32:FlashFreq=80,UploadSpeed=921600" "false" "oldest" "newest"
# TODO: test different boards (odroid, wrover)
# - build_sketch "${TRAVIS_BUILD_DIR}/examples/Basics/Display/Display.ino" "esp32:esp32:m5stack-core-esp32:FlashFreq=80,UploadSpeed=921600" "false" "oldest" "newest"
- build_sketch "${TRAVIS_BUILD_DIR}/examples/Advanced/Display/Cellular_Automata/Cellular_Automata.ino" "esp32:esp32:m5stack-core-esp32:FlashFreq=80,UploadSpeed=921600" "false" "oldest" "newest"
- build_sketch "${TRAVIS_BUILD_DIR}/examples/Advanced/Display/Sprite/Sprite_scroll_16bit/Sprite_scroll_16bit.ino" "esp32:esp32:m5stack-core-esp32:FlashFreq=80,UploadSpeed=921600" "false" "oldest" "newest"
- build_sketch "${TRAVIS_BUILD_DIR}/examples/Advanced/Display/Sprite/Sprite_scroll_8bit/Sprite_scroll_8bit.ino" "esp32:esp32:m5stack-core-esp32:FlashFreq=80,UploadSpeed=921600" "false" "oldest" "newest"
- build_sketch "${TRAVIS_BUILD_DIR}/examples/Advanced/Display/TFT_ArcFill/TFT_ArcFill.ino" "esp32:esp32:m5stack-core-esp32:FlashFreq=80,UploadSpeed=921600" "false" "oldest" "newest"
- build_sketch "${TRAVIS_BUILD_DIR}/examples/Advanced/Display/TFT_FillArcSpiral/TFT_FillArcSpiral.ino" "esp32:esp32:m5stack-core-esp32:FlashFreq=80,UploadSpeed=921600" "false" "oldest" "newest"
- build_sketch "${TRAVIS_BUILD_DIR}/examples/Advanced/Display/TFT_Mandlebrot/TFT_Mandlebrot.ino" "esp32:esp32:m5stack-core-esp32:FlashFreq=80,UploadSpeed=921600" "false" "oldest" "newest"
- build_sketch "${TRAVIS_BUILD_DIR}/examples/Advanced/Display/TFT_Spiro/TFT_Spiro.ino" "esp32:esp32:m5stack-core-esp32:FlashFreq=80,UploadSpeed=921600" "false" "oldest" "newest"

#- if [ "$TRAVIS_BRANCH" != "master" ]; then echo "This commit was made against the $TRAVIS_BRANCH, skipping examples compilation"; exit 0; fi
#- if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then echo "This is a pull request, skipping examples compilation"; exit 0; fi
# compile all examples (will result in timeout if too many sketches are found)
Expand Down
24 changes: 22 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# ESP32-Chimera-Core Library

[![arduino-library-badge](https://www.ardu-badge.com/badge/ESP32-Chimera-Core.svg?)](https://www.ardu-badge.com/ESP32-Chimera-Core)

![Illustration By Jacopo Ligozzi](https://user-images.githubusercontent.com/1893754/71980273-ed9bb100-321f-11ea-8982-49702af29c9f.png)


Expand All @@ -18,18 +20,36 @@ Support coming soon:
- [M5StickC](https://m5stack.com/collections/m5-core/products/stick-c)
- [M5Atom](https://m5stack.com/collections/m5-core/products/atom-matrix-esp32-development-kit)


It also implements a set of extra features:

- Zero-config automatic device selection based on the Arduino Boards menu selection
- Screenshots!
- I2C Scanner


GFX implementation is a courtesy of @lovyan03 who did a marvelous work of integrating his
[LovyanGFX](https://github.com/lovyan03/LovyanGFX) library into his own [ESP32-Chimera-Core fork](https://github.com/lovyan03/ESP32-Chimera-Core).

[LovyanGFX](https://github.com/lovyan03/LovyanGFX) is an optimized display driver maintained by [@lovyan03](https://github.com/lovyan03/),
it brings an average 30% speed improvement along with more flexibility towards adding custom boards.

This is still beta quality, most examples will fail due to the minor syntax changes, but the tradeoff is really worth it!

See [LovyanGFX Readme](https://github.com/lovyan03/LovyanGFX/blob/master/README.md) for an overview of those minor changes
along with the new features such as shapes, arcs, polygon drawing and filling, and much more ...


# Usage

- Download the latest release and unzip it in the `~/Arduino/libraries` folder.
- Delete the `~/Arduino/M5Stack` folder to prevent any confusion at compilation (you can still restore it later using the Library Manager)

then choose between managed install:

- Get it from the Arduino Library Manager

or manual install:

- Download the [latest release](https://github.com/tobozo/ESP32-Chimera-Core/releases) and unzip it in the `~/Arduino/libraries` folder.
- You're done!

# Developers
Expand Down
21 changes: 21 additions & 0 deletions boards/d32_pro/pins_arduino.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#ifndef Pins_Arduino_h
#define Pins_Arduino_h

#include <stdint.h>
#include <../d32/d32_core.h>

static const uint8_t LED_BUILTIN = 5;
#define BUILTIN_LED LED_BUILTIN // backward compatibility
static const uint8_t _VBAT = 35; // battery voltage


#define TF_CS 4 // TF (Micro SD Card) CS pin
#define TS_CS 12 // Touch Screen CS pin
#define TFT_CS 14 // TFT CS pin
#define TFT_LED 32 // TFT backlight control pin
#define TFT_RST 33 // TFT reset pin
#define TFT_DC 27 // TFT DC pin

#define SS TF_CS

#endif /* Pins_Arduino_h */
61 changes: 61 additions & 0 deletions boards/lolin32/pins_arduino.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#ifndef Pins_Arduino_h
#define Pins_Arduino_h

#include <stdint.h>

#define EXTERNAL_NUM_INTERRUPTS 16
#define NUM_DIGITAL_PINS 40
#define NUM_ANALOG_INPUTS 16

#define analogInputToDigitalPin(p) (((p)<20)?(esp32_adc2gpio[(p)]):-1)
#define digitalPinToInterrupt(p) (((p)<40)?(p):-1)
#define digitalPinHasPWM(p) (p < 34)

static const uint8_t LED_BUILTIN = 5;
#define BUILTIN_LED LED_BUILTIN // backward compatibility



static const uint8_t TX = 1;
static const uint8_t RX = 3;

static const uint8_t SDA = 21;
static const uint8_t SCL = 22;

static const uint8_t SS = 5;
static const uint8_t MOSI = 23;
static const uint8_t MISO = 19;
static const uint8_t SCK = 18;

static const uint8_t A0 = 36;
static const uint8_t A3 = 39;
static const uint8_t A4 = 32;
static const uint8_t A5 = 33;
static const uint8_t A6 = 34;
static const uint8_t A7 = 35;
static const uint8_t A10 = 4;
static const uint8_t A11 = 0;
static const uint8_t A12 = 2;
static const uint8_t A13 = 15;
static const uint8_t A14 = 13;
static const uint8_t A15 = 12;
static const uint8_t A16 = 14;
static const uint8_t A17 = 27;
static const uint8_t A18 = 25;
static const uint8_t A19 = 26;

static const uint8_t T0 = 4;
static const uint8_t T1 = 0;
static const uint8_t T2 = 2;
static const uint8_t T3 = 15;
static const uint8_t T4 = 13;
static const uint8_t T5 = 12;
static const uint8_t T6 = 14;
static const uint8_t T7 = 27;
static const uint8_t T8 = 33;
static const uint8_t T9 = 32;

static const uint8_t DAC1 = 25;
static const uint8_t DAC2 = 26;

#endif /* Pins_Arduino_h */
55 changes: 55 additions & 0 deletions boards/m5stack_core_esp32/pins_arduino.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#ifndef Pins_Arduino_h
#define Pins_Arduino_h

#include <stdint.h>

#define EXTERNAL_NUM_INTERRUPTS 16
#define NUM_DIGITAL_PINS 20
#define NUM_ANALOG_INPUTS 16

#define analogInputToDigitalPin(p) (((p)<20)?(esp32_adc2gpio[(p)]):-1)
#define digitalPinToInterrupt(p) (((p)<40)?(p):-1)
#define digitalPinHasPWM(p) (p < 34)

static const uint8_t TX = 1;
static const uint8_t RX = 3;

static const uint8_t TXD2 = 17;
static const uint8_t RXD2 = 16;

static const uint8_t SDA = 21;
static const uint8_t SCL = 22;

static const uint8_t SS = 5;
static const uint8_t MOSI = 23;
static const uint8_t MISO = 19;
static const uint8_t SCK = 18;

static const uint8_t G23 = 23;
static const uint8_t G19 = 19;
static const uint8_t G18 = 18;
static const uint8_t G3 = 3;
static const uint8_t G16 = 16;
static const uint8_t G21 = 21;
static const uint8_t G2 = 2;
static const uint8_t G12 = 12;
static const uint8_t G15 = 15;
static const uint8_t G35 = 35;
static const uint8_t G36 = 36;
static const uint8_t G25 = 25;
static const uint8_t G26 = 26;
static const uint8_t G1 = 1;
static const uint8_t G17 = 17;
static const uint8_t G22 = 22;
static const uint8_t G5 = 5;
static const uint8_t G13 = 13;
static const uint8_t G0 = 0;
static const uint8_t G34 = 34;

static const uint8_t DAC1 = 25;
static const uint8_t DAC2 = 26;

static const uint8_t ADC1 = 35;
static const uint8_t ADC2 = 36;

#endif /* Pins_Arduino_h */
52 changes: 52 additions & 0 deletions boards/m5stack_fire/pins_arduino.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#ifndef Pins_Arduino_h
#define Pins_Arduino_h

#include <stdint.h>

#define EXTERNAL_NUM_INTERRUPTS 16
#define NUM_DIGITAL_PINS 20
#define NUM_ANALOG_INPUTS 16

#define analogInputToDigitalPin(p) (((p)<20)?(esp32_adc2gpio[(p)]):-1)
#define digitalPinToInterrupt(p) (((p)<40)?(p):-1)
#define digitalPinHasPWM(p) (p < 34)

static const uint8_t TX = 1;
static const uint8_t RX = 3;

static const uint8_t SDA = 21;
static const uint8_t SCL = 22;

static const uint8_t SS = 5;
static const uint8_t MOSI = 23;
static const uint8_t MISO = 19;
static const uint8_t SCK = 18;

static const uint8_t G23 = 23;
static const uint8_t G19 = 19;
static const uint8_t G18 = 18;
static const uint8_t G3 = 3;
static const uint8_t G16 = 16;
static const uint8_t G21 = 21;
static const uint8_t G2 = 2;
static const uint8_t G12 = 12;
static const uint8_t G15 = 15;
static const uint8_t G35 = 35;
static const uint8_t G36 = 36;
static const uint8_t G25 = 25;
static const uint8_t G26 = 26;
static const uint8_t G1 = 1;
static const uint8_t G17 = 17;
static const uint8_t G22 = 22;
static const uint8_t G5 = 5;
static const uint8_t G13 = 13;
static const uint8_t G0 = 0;
static const uint8_t G34 = 34;

static const uint8_t DAC1 = 25;
static const uint8_t DAC2 = 26;

static const uint8_t ADC1 = 35;
static const uint8_t ADC2 = 36;

#endif /* Pins_Arduino_h */
34 changes: 34 additions & 0 deletions boards/odroid_esp32/pins_arduino.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#ifndef Pins_Arduino_h
#define Pins_Arduino_h

#include <stdint.h>

#define EXTERNAL_NUM_INTERRUPTS 16
#define NUM_DIGITAL_PINS 40
#define NUM_ANALOG_INPUTS 16

#define analogInputToDigitalPin(p) (((p)<20)?(esp32_adc2gpio[(p)]):-1)
#define digitalPinToInterrupt(p) (((p)<40)?(p):-1)
#define digitalPinHasPWM(p) (p < 34)

static const uint8_t LED_BUILTIN = 2;
#define BUILTIN_LED LED_BUILTIN // backward compatibility

static const uint8_t TX = 1;
static const uint8_t RX = 3;

static const uint8_t SDA = 15;
static const uint8_t SCL = 4;

static const uint8_t SS = 22;
static const uint8_t MOSI = 23;
static const uint8_t MISO = 19;
static const uint8_t SCK = 18;

static const uint8_t DAC1 = 25;
static const uint8_t DAC2 = 26;

static const uint8_t ADC1 = 35;
static const uint8_t ADC2 = 36;

#endif /* Pins_Arduino_h */
62 changes: 62 additions & 0 deletions boards/ttgo-t1/pins_arduino.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#ifndef Pins_Arduino_h
#define Pins_Arduino_h

#include <stdint.h>

#define EXTERNAL_NUM_INTERRUPTS 16
#define NUM_DIGITAL_PINS 40
#define NUM_ANALOG_INPUTS 16

#define analogInputToDigitalPin(p) (((p)<20)?(esp32_adc2gpio[(p)]):-1)
#define digitalPinToInterrupt(p) (((p)<40)?(p):-1)
#define digitalPinHasPWM(p) (p < 34)

static const uint8_t TX = 1;
static const uint8_t RX = 3;

static const uint8_t LED_BUILTIN = 22;
#define BUILTIN_LED LED_BUILTIN // backward compatibility

static const uint8_t SDA = 21;
// Despite the many diagrams from TTGO showing SCL on pin 22, due to the on-board LED
// also on this pin it is better to shift to 23 instead to avoid issues.
static const uint8_t SCL = 23;

// These are the settings used for the on-board SD card slot
static const uint8_t SS = 13;
static const uint8_t MOSI = 15;
static const uint8_t MISO = 2;
static const uint8_t SCK = 14;

static const uint8_t A0 = 36;
static const uint8_t A3 = 39;
static const uint8_t A4 = 32;
static const uint8_t A5 = 33;
static const uint8_t A6 = 34;
static const uint8_t A7 = 35;
static const uint8_t A10 = 4;
static const uint8_t A11 = 0;
static const uint8_t A12 = 2;
static const uint8_t A13 = 15;
static const uint8_t A14 = 13;
static const uint8_t A15 = 12;
static const uint8_t A16 = 14;
static const uint8_t A17 = 27;
static const uint8_t A18 = 25;
static const uint8_t A19 = 26;

static const uint8_t T0 = 4;
static const uint8_t T1 = 0;
static const uint8_t T2 = 2;
static const uint8_t T3 = 15;
static const uint8_t T4 = 13;
static const uint8_t T5 = 12;
static const uint8_t T6 = 14;
static const uint8_t T7 = 27;
static const uint8_t T8 = 33;
static const uint8_t T9 = 32;

static const uint8_t DAC1 = 25;
static const uint8_t DAC2 = 26;

#endif /* Pins_Arduino_h */
Loading

0 comments on commit ec931d1

Please sign in to comment.