Initial import
This commit is contained in:
commit
72030db14a
9 changed files with 530 additions and 0 deletions
8
.gitignore
vendored
Normal file
8
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
.pio
|
||||
.pio/build
|
||||
.compile_commands.json
|
||||
.vscode/.browse.c_cpp.db*
|
||||
.vscode/c_cpp_properties.json
|
||||
.vscode/launch.json
|
||||
.vscode/ipch
|
||||
.cache
|
||||
10
.vscode/extensions.json
vendored
Normal file
10
.vscode/extensions.json
vendored
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
// See http://go.microsoft.com/fwlink/?LinkId=827846
|
||||
// for the documentation about the extensions.json format
|
||||
"recommendations": [
|
||||
"platformio.platformio-ide"
|
||||
],
|
||||
"unwantedRecommendations": [
|
||||
"ms-vscode.cpptools-extension-pack"
|
||||
]
|
||||
}
|
||||
284
compile_commands.json
Normal file
284
compile_commands.json
Normal file
File diff suppressed because one or more lines are too long
37
include/README
Normal file
37
include/README
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
|
||||
This directory is intended for project header files.
|
||||
|
||||
A header file is a file containing C declarations and macro definitions
|
||||
to be shared between several project source files. You request the use of a
|
||||
header file in your project source file (C, C++, etc) located in `src` folder
|
||||
by including it, with the C preprocessing directive `#include'.
|
||||
|
||||
```src/main.c
|
||||
|
||||
#include "header.h"
|
||||
|
||||
int main (void)
|
||||
{
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
Including a header file produces the same results as copying the header file
|
||||
into each source file that needs it. Such copying would be time-consuming
|
||||
and error-prone. With a header file, the related declarations appear
|
||||
in only one place. If they need to be changed, they can be changed in one
|
||||
place, and programs that include the header file will automatically use the
|
||||
new version when next recompiled. The header file eliminates the labor of
|
||||
finding and changing all the copies as well as the risk that a failure to
|
||||
find one copy will result in inconsistencies within a program.
|
||||
|
||||
In C, the convention is to give header files names that end with `.h'.
|
||||
|
||||
Read more about using header files in official GCC documentation:
|
||||
|
||||
* Include Syntax
|
||||
* Include Operation
|
||||
* Once-Only Headers
|
||||
* Computed Includes
|
||||
|
||||
https://gcc.gnu.org/onlinedocs/cpp/Header-Files.html
|
||||
46
lib/README
Normal file
46
lib/README
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
|
||||
This directory is intended for project specific (private) libraries.
|
||||
PlatformIO will compile them to static libraries and link into the executable file.
|
||||
|
||||
The source code of each library should be placed in a separate directory
|
||||
("lib/your_library_name/[Code]").
|
||||
|
||||
For example, see the structure of the following example libraries `Foo` and `Bar`:
|
||||
|
||||
|--lib
|
||||
| |
|
||||
| |--Bar
|
||||
| | |--docs
|
||||
| | |--examples
|
||||
| | |--src
|
||||
| | |- Bar.c
|
||||
| | |- Bar.h
|
||||
| | |- library.json (optional. for custom build options, etc) https://docs.platformio.org/page/librarymanager/config.html
|
||||
| |
|
||||
| |--Foo
|
||||
| | |- Foo.c
|
||||
| | |- Foo.h
|
||||
| |
|
||||
| |- README --> THIS FILE
|
||||
|
|
||||
|- platformio.ini
|
||||
|--src
|
||||
|- main.c
|
||||
|
||||
Example contents of `src/main.c` using Foo and Bar:
|
||||
```
|
||||
#include <Foo.h>
|
||||
#include <Bar.h>
|
||||
|
||||
int main (void)
|
||||
{
|
||||
...
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
The PlatformIO Library Dependency Finder will find automatically dependent
|
||||
libraries by scanning project source files.
|
||||
|
||||
More information about PlatformIO Library Dependency Finder
|
||||
- https://docs.platformio.org/page/librarymanager/ldf.html
|
||||
16
lib/TFT_eSPI/UserSetup.h
Normal file
16
lib/TFT_eSPI/UserSetup.h
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
#define ST7796_DRIVER
|
||||
|
||||
#define TFT_WIDTH 800
|
||||
#define TFT_HEIGHT 480
|
||||
|
||||
#define TFT_MISO -1
|
||||
#define TFT_MOSI 11
|
||||
#define TFT_SCLK 12
|
||||
#define TFT_CS 10
|
||||
#define TFT_DC 13
|
||||
#define TFT_RST 9
|
||||
#define TFT_BL 45
|
||||
#define TOUCH_CS 38
|
||||
|
||||
#define SPI_FREQUENCY 20000000
|
||||
#define SPI_TOUCH_FREQUENCY 2500000
|
||||
33
platformio.ini
Normal file
33
platformio.ini
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
; PlatformIO Project Configuration File
|
||||
;
|
||||
; Build options: build flags, source filter
|
||||
; Upload options: custom upload port, speed and extra flags
|
||||
; Library options: dependencies, extra library storages
|
||||
; Advanced options: extra scripting
|
||||
;
|
||||
; Please visit documentation for the other options and examples
|
||||
; https://docs.platformio.org/page/projectconf.html
|
||||
|
||||
[env:elecrow_7inch_hmi]
|
||||
platform = espressif32@6.8.1
|
||||
board = esp32-s3-devkitc-1
|
||||
framework = arduino
|
||||
lib_deps = lovyan03/LovyanGFX@^1.1.8
|
||||
|
||||
monitor_speed = 115200
|
||||
|
||||
# Critical settings for the N4R8 module
|
||||
board_upload.flash_size = 4MB
|
||||
board_build.arduino.memory_type = qio_opi
|
||||
board_build.f_flash = 80000000L
|
||||
board_build.flash_mode = qio
|
||||
|
||||
# Memory and partition adjustments
|
||||
board_build.partitions = default_8MB.csv
|
||||
|
||||
# Required build flags for S3 display stability
|
||||
build_flags =
|
||||
-DARDUINO_USB_MODE=1
|
||||
-DARDUINO_USB_CDC_ON_BOOT=1
|
||||
-DBOARD_HAS_PSRAM
|
||||
-mfix-esp32-psram-cache-issue
|
||||
85
src/main.cpp
Normal file
85
src/main.cpp
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
#define LGFX_USE_V1
|
||||
#include <Arduino.h>
|
||||
#include <LovyanGFX.hpp>
|
||||
#include <lgfx/v1/platforms/esp32s3/Bus_RGB.hpp>
|
||||
#include <lgfx/v1/platforms/esp32s3/Panel_RGB.hpp>
|
||||
|
||||
class LGFX : public lgfx::LGFX_Device {
|
||||
public:
|
||||
lgfx::Bus_RGB _bus_instance;
|
||||
lgfx::Panel_RGB _panel_instance;
|
||||
|
||||
LGFX(void) {
|
||||
{
|
||||
auto cfg = _bus_instance.config();
|
||||
cfg.panel = &_panel_instance;
|
||||
|
||||
cfg.pin_d0 = GPIO_NUM_15;
|
||||
cfg.pin_d1 = GPIO_NUM_7;
|
||||
cfg.pin_d2 = GPIO_NUM_6;
|
||||
cfg.pin_d3 = GPIO_NUM_5;
|
||||
cfg.pin_d4 = GPIO_NUM_4;
|
||||
cfg.pin_d5 = GPIO_NUM_9;
|
||||
cfg.pin_d6 = GPIO_NUM_46;
|
||||
cfg.pin_d7 = GPIO_NUM_3;
|
||||
cfg.pin_d8 = GPIO_NUM_8;
|
||||
cfg.pin_d9 = GPIO_NUM_16;
|
||||
cfg.pin_d10 = GPIO_NUM_1;
|
||||
cfg.pin_d11 = GPIO_NUM_14;
|
||||
cfg.pin_d12 = GPIO_NUM_21;
|
||||
cfg.pin_d13 = GPIO_NUM_47;
|
||||
cfg.pin_d14 = GPIO_NUM_48;
|
||||
cfg.pin_d15 = GPIO_NUM_45;
|
||||
|
||||
cfg.pin_henable = GPIO_NUM_41;
|
||||
cfg.pin_vsync = GPIO_NUM_40;
|
||||
cfg.pin_hsync = GPIO_NUM_39;
|
||||
cfg.pin_pclk = GPIO_NUM_0;
|
||||
cfg.freq_write = 15000000;
|
||||
|
||||
cfg.hsync_pulse_width = 32;
|
||||
cfg.hsync_back_porch = 48;
|
||||
cfg.hsync_front_porch = 40;
|
||||
cfg.vsync_pulse_width = 2;
|
||||
cfg.vsync_back_porch = 31;
|
||||
cfg.vsync_front_porch = 13;
|
||||
cfg.hsync_polarity = 0;
|
||||
cfg.vsync_polarity = 0;
|
||||
cfg.pclk_active_neg = 0;
|
||||
cfg.de_idle_high = 0;
|
||||
cfg.pclk_idle_high = 0;
|
||||
|
||||
_bus_instance.config(cfg);
|
||||
_panel_instance.setBus(&_bus_instance);
|
||||
|
||||
{
|
||||
auto cfg = _panel_instance.config();
|
||||
cfg.memory_width = 800;
|
||||
cfg.memory_height = 480;
|
||||
cfg.panel_width = 800;
|
||||
cfg.panel_height = 480;
|
||||
cfg.offset_x = 0;
|
||||
cfg.offset_y = 0;
|
||||
_panel_instance.config(cfg);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
static LGFX tft;
|
||||
|
||||
void setup() {
|
||||
delay(2000);
|
||||
tft.init();
|
||||
tft.setRotation(1);
|
||||
tft.fillScreen(0x000000);
|
||||
tft.setTextColor(0x00FF00, 0x000000);
|
||||
tft.setTextSize(2);
|
||||
tft.drawString("Hello Elecrow!", 20, 20);
|
||||
tft.setTextColor(0xFFFFFF, 0x000000);
|
||||
tft.drawString("Success!", 20, 60);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
delay(1000);
|
||||
}
|
||||
11
test/README
Normal file
11
test/README
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
|
||||
This directory is intended for PlatformIO Test Runner and project tests.
|
||||
|
||||
Unit Testing is a software testing method by which individual units of
|
||||
source code, sets of one or more MCU program modules together with associated
|
||||
control data, usage procedures, and operating procedures, are tested to
|
||||
determine whether they are fit for use. Unit testing finds problems early
|
||||
in the development cycle.
|
||||
|
||||
More information about PlatformIO Unit Testing:
|
||||
- https://docs.platformio.org/en/latest/advanced/unit-testing/index.html
|
||||
Loading…
Add table
Reference in a new issue