mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-23 19:26:38 +00:00
Add base files
This commit is contained in:
parent
791f1ccbce
commit
1100360eb3
96
.clang-format
Normal file
96
.clang-format
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
---
|
||||||
|
Language: Cpp
|
||||||
|
# BasedOnStyle: LLVM
|
||||||
|
AccessModifierOffset: -2
|
||||||
|
AlignAfterOpenBracket: Align
|
||||||
|
AlignConsecutiveAssignments: true
|
||||||
|
AlignConsecutiveDeclarations: false
|
||||||
|
AlignEscapedNewlinesLeft: false
|
||||||
|
AlignOperands: true
|
||||||
|
AlignTrailingComments: true
|
||||||
|
AllowAllParametersOfDeclarationOnNextLine: true
|
||||||
|
AllowShortBlocksOnASingleLine: false
|
||||||
|
AllowShortCaseLabelsOnASingleLine: false
|
||||||
|
AllowShortFunctionsOnASingleLine: None
|
||||||
|
AllowShortIfStatementsOnASingleLine: true
|
||||||
|
AllowShortLoopsOnASingleLine: true
|
||||||
|
AlwaysBreakAfterDefinitionReturnType: None
|
||||||
|
AlwaysBreakAfterReturnType: None
|
||||||
|
AlwaysBreakBeforeMultilineStrings: false
|
||||||
|
AlwaysBreakTemplateDeclarations: false
|
||||||
|
BinPackArguments: true
|
||||||
|
BinPackParameters: true
|
||||||
|
BreakBeforeBraces: Custom
|
||||||
|
BraceWrapping:
|
||||||
|
AfterClass: false
|
||||||
|
AfterControlStatement: false
|
||||||
|
AfterEnum: false
|
||||||
|
AfterFunction: true
|
||||||
|
AfterNamespace: false
|
||||||
|
AfterObjCDeclaration: false
|
||||||
|
AfterStruct: true
|
||||||
|
AfterUnion: true
|
||||||
|
BeforeCatch: false
|
||||||
|
BeforeElse: false
|
||||||
|
IndentBraces: false
|
||||||
|
SplitEmptyFunction: false
|
||||||
|
BreakBeforeBinaryOperators: None
|
||||||
|
BreakBeforeTernaryOperators: true
|
||||||
|
BreakConstructorInitializersBeforeComma: false
|
||||||
|
BreakAfterJavaFieldAnnotations: false
|
||||||
|
BreakStringLiterals: true
|
||||||
|
ColumnLimit: 120
|
||||||
|
CommentPragmas: '^ IWYU pragma:'
|
||||||
|
ConstructorInitializerAllOnOneLineOrOnePerLine: false
|
||||||
|
ConstructorInitializerIndentWidth: 4
|
||||||
|
ContinuationIndentWidth: 4
|
||||||
|
Cpp11BracedListStyle: true
|
||||||
|
DerivePointerAlignment: false
|
||||||
|
DisableFormat: false
|
||||||
|
ExperimentalAutoDetectBinPacking: false
|
||||||
|
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
|
||||||
|
IncludeCategories:
|
||||||
|
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
|
||||||
|
Priority: 2
|
||||||
|
- Regex: '^(<|"(gtest|isl|json)/)'
|
||||||
|
Priority: 3
|
||||||
|
- Regex: '.*'
|
||||||
|
Priority: 1
|
||||||
|
IncludeIsMainRegex: '$'
|
||||||
|
IndentCaseLabels: true
|
||||||
|
IndentWidth: 4
|
||||||
|
IndentWrappedFunctionNames: false
|
||||||
|
JavaScriptQuotes: Leave
|
||||||
|
JavaScriptWrapImports: true
|
||||||
|
KeepEmptyLinesAtTheStartOfBlocks: true
|
||||||
|
MacroBlockBegin: ''
|
||||||
|
MacroBlockEnd: ''
|
||||||
|
MaxEmptyLinesToKeep: 1
|
||||||
|
NamespaceIndentation: None
|
||||||
|
ObjCBlockIndentWidth: 2
|
||||||
|
ObjCSpaceAfterProperty: false
|
||||||
|
ObjCSpaceBeforeProtocolList: true
|
||||||
|
PenaltyBreakBeforeFirstCallParameter: 19
|
||||||
|
PenaltyBreakComment: 300
|
||||||
|
PenaltyBreakFirstLessLess: 120
|
||||||
|
PenaltyBreakString: 1000
|
||||||
|
PenaltyExcessCharacter: 1000000
|
||||||
|
PenaltyReturnTypeOnItsOwnLine: 60
|
||||||
|
PointerAlignment: Middle
|
||||||
|
ReflowComments: true
|
||||||
|
SortIncludes: false
|
||||||
|
SpaceAfterCStyleCast: false
|
||||||
|
SpaceAfterTemplateKeyword: true
|
||||||
|
SpaceBeforeAssignmentOperators: true
|
||||||
|
SpaceBeforeParens: Never
|
||||||
|
SpaceInEmptyParentheses: false
|
||||||
|
SpacesBeforeTrailingComments: 1
|
||||||
|
SpacesInAngles: false
|
||||||
|
SpacesInContainerLiterals: false
|
||||||
|
SpacesInCStyleCastParentheses: false
|
||||||
|
SpacesInParentheses: false
|
||||||
|
SpacesInSquareBrackets: false
|
||||||
|
Standard: Cpp11
|
||||||
|
TabWidth: 4
|
||||||
|
UseTab: Never
|
||||||
|
...
|
15
.gitignore
vendored
Normal file
15
.gitignore
vendored
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
## OS specific ########
|
||||||
|
.DS_Store
|
||||||
|
|
||||||
|
## Project files ######
|
||||||
|
.git
|
||||||
|
.pio
|
||||||
|
data/*
|
||||||
|
src/user_config_override.h
|
||||||
|
|
||||||
|
## Visual Studio Code specific ######
|
||||||
|
.vscode
|
||||||
|
.vscode/.browse.c_cpp.db*
|
||||||
|
.vscode/c_cpp_properties.json
|
||||||
|
.vscode/launch.json
|
||||||
|
*.bak
|
67
.travis.yml
Normal file
67
.travis.yml
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
# Continuous Integration (CI) is the practice, in software
|
||||||
|
# engineering, of merging all developer working copies with a shared mainline
|
||||||
|
# several times a day < https://docs.platformio.org/page/ci/index.html >
|
||||||
|
#
|
||||||
|
# Documentation:
|
||||||
|
#
|
||||||
|
# * Travis CI Embedded Builds with PlatformIO
|
||||||
|
# < https://docs.travis-ci.com/user/integration/platformio/ >
|
||||||
|
#
|
||||||
|
# * PlatformIO integration with Travis CI
|
||||||
|
# < https://docs.platformio.org/page/ci/travis.html >
|
||||||
|
#
|
||||||
|
# * User Guide for `platformio ci` command
|
||||||
|
# < https://docs.platformio.org/page/userguide/cmd_ci.html >
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# Please choose one of the following templates (proposed below) and uncomment
|
||||||
|
# it (remove "# " before each line) or use own configuration according to the
|
||||||
|
# Travis CI documentation (see above).
|
||||||
|
#
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Template #1: General project. Test it using existing `platformio.ini`.
|
||||||
|
#
|
||||||
|
|
||||||
|
# language: python
|
||||||
|
# python:
|
||||||
|
# - "2.7"
|
||||||
|
#
|
||||||
|
# sudo: false
|
||||||
|
# cache:
|
||||||
|
# directories:
|
||||||
|
# - "~/.platformio"
|
||||||
|
#
|
||||||
|
# install:
|
||||||
|
# - pip install -U platformio
|
||||||
|
# - platformio update
|
||||||
|
#
|
||||||
|
# script:
|
||||||
|
# - platformio run
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Template #2: The project is intended to be used as a library with examples.
|
||||||
|
#
|
||||||
|
|
||||||
|
# language: python
|
||||||
|
# python:
|
||||||
|
# - "2.7"
|
||||||
|
#
|
||||||
|
# sudo: false
|
||||||
|
# cache:
|
||||||
|
# directories:
|
||||||
|
# - "~/.platformio"
|
||||||
|
#
|
||||||
|
# env:
|
||||||
|
# - PLATFORMIO_CI_SRC=path/to/test/file.c
|
||||||
|
# - PLATFORMIO_CI_SRC=examples/file.ino
|
||||||
|
# - PLATFORMIO_CI_SRC=path/to/test/directory
|
||||||
|
#
|
||||||
|
# install:
|
||||||
|
# - pip install -U platformio
|
||||||
|
# - platformio update
|
||||||
|
#
|
||||||
|
# script:
|
||||||
|
# - platformio ci --lib="." --board=ID_1 --board=ID_2 --board=ID_N
|
26
LICENSE
Normal file
26
LICENSE
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
_____ _____ _____ _____
|
||||||
|
| | | _ | __| _ |
|
||||||
|
| | |__ | __|
|
||||||
|
|__|__|__|__|_____|__|
|
||||||
|
Home Automation Switch Plate
|
||||||
|
https://github.com/aderusha/HASwitchPlate
|
||||||
|
|
||||||
|
Copyright (c) 2019 Allen Derusha allen@derusha.org
|
||||||
|
Copyright (c) 2020 Francis Van Roie francis@netwize.be
|
||||||
|
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this hardware,
|
||||||
|
software, and associated documentation files (the "Product"), to deal in the Product without
|
||||||
|
restriction, including without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Product, and to permit persons to whom the
|
||||||
|
Product is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all copies or
|
||||||
|
substantial portions of the Product.
|
||||||
|
|
||||||
|
THE PRODUCT IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
|
||||||
|
NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||||
|
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE PRODUCT OR THE USE OR OTHER DEALINGS IN THE PRODUCT.
|
225
platformio.ini
Normal file
225
platformio.ini
Normal file
@ -0,0 +1,225 @@
|
|||||||
|
; 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
|
||||||
|
; http://docs.platformio.org/page/projectconf.html
|
||||||
|
|
||||||
|
|
||||||
|
;***************************************************
|
||||||
|
; Common settings
|
||||||
|
;***************************************************
|
||||||
|
[platformio]
|
||||||
|
default_envs =
|
||||||
|
esp32dev
|
||||||
|
esp12e
|
||||||
|
d1mini-lolintft24
|
||||||
|
|
||||||
|
include_dir =
|
||||||
|
include
|
||||||
|
;lvgl
|
||||||
|
;lv_lib_zifont
|
||||||
|
;png_decoder
|
||||||
|
|
||||||
|
[lcd]
|
||||||
|
TFT_WIDTH = 240
|
||||||
|
TFT_HEIGHT = 320
|
||||||
|
TFT_ROTATION = 0 ; 0=0, 1=90, 2=180 or 3=270 degree
|
||||||
|
; Rotation params:
|
||||||
|
; 0 - 0 deg
|
||||||
|
; 1 - 90 deg anti-clockwise (from 0 deg)
|
||||||
|
; 2 - 180 deg anti-clockwise
|
||||||
|
; 3 - 270 deg anti-clockwise
|
||||||
|
; 4 - mirror content, and rotate 180 deg anti-clockwise
|
||||||
|
; 5 - mirror content, and rotate 270 deg anti-clockwise
|
||||||
|
; 6 - mirror content, and rotate 0 deg anti-clockwise
|
||||||
|
; 7 - mirror content, and rotate 90 deg anti-clockwise
|
||||||
|
|
||||||
|
[env]
|
||||||
|
framework = arduino
|
||||||
|
monitor_speed = 115200
|
||||||
|
upload_speed = 921600
|
||||||
|
; -- Shared library dependencies in all environments
|
||||||
|
lib_deps =
|
||||||
|
;lvgl@^7.0.0
|
||||||
|
TFT_eSPI@^1.5.0
|
||||||
|
PubSubClient@^2.7.0 ; MQTT client
|
||||||
|
ArduinoJson@>6.13.0
|
||||||
|
Syslog@^2.0.0
|
||||||
|
|
||||||
|
; -- littlevgl config options ----------------------
|
||||||
|
build_flags =
|
||||||
|
-Os ; Code Size Optimization
|
||||||
|
-w ; Suppress warnings
|
||||||
|
-D LV_CONF_INCLUDE_SIMPLE
|
||||||
|
-D SPIFFS_TEMPORAL_FD_CACHE ; speed up opening recent files
|
||||||
|
-D ARDUINOJSON_DECODE_UNICODE=1 ; for utf-8 symbols
|
||||||
|
-D ARDUINOJSON_ENABLE_PROGMEM=1 ; for PROGMEM arguments
|
||||||
|
-I include ; include lv_conf.h and hasp_conf.h
|
||||||
|
; -I drivers/stm32f429_disco
|
||||||
|
|
||||||
|
;***************************************************
|
||||||
|
; ESP32 build
|
||||||
|
;***************************************************
|
||||||
|
[env:esp32dev]
|
||||||
|
platform = espressif32
|
||||||
|
board = esp32dev
|
||||||
|
upload_port = COM3 ; Change to the correct port
|
||||||
|
monitor_port = COM3 ; Change to the correct port
|
||||||
|
|
||||||
|
build_flags =
|
||||||
|
${env.build_flags}
|
||||||
|
; -- TFT_eSPI build options ------------------------
|
||||||
|
-D TFT_ROTATION=${lcd.TFT_ROTATION}
|
||||||
|
-D TFT_WIDTH=${lcd.TFT_WIDTH}
|
||||||
|
-D TFT_HEIGHT=${lcd.TFT_HEIGHT}
|
||||||
|
-D USER_SETUP_LOADED=1
|
||||||
|
-D ILI9341_DRIVER=1
|
||||||
|
-D TFT_MISO=19
|
||||||
|
-D TFT_MOSI=23
|
||||||
|
-D TFT_SCLK=18
|
||||||
|
-D TFT_CS=5
|
||||||
|
-D TFT_DC=2
|
||||||
|
-D TFT_RST=4
|
||||||
|
-D TOUCH_CS=21
|
||||||
|
-D SPI_FREQUENCY=40000000
|
||||||
|
-D SPI_TOUCH_FREQUENCY=2500000
|
||||||
|
-D SPI_READ_FREQUENCY=20000000
|
||||||
|
; -- Debugging options -----------------------------
|
||||||
|
; -D CORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_DEBUG
|
||||||
|
|
||||||
|
; -- Library options -------------------------------
|
||||||
|
lib_deps =
|
||||||
|
${env.lib_deps}
|
||||||
|
|
||||||
|
src_filter = +<*> +<../drivers/stm32f429_disco>
|
||||||
|
|
||||||
|
;***************************************************
|
||||||
|
; D1 Mini with Lolin TFT 2.4"
|
||||||
|
;***************************************************
|
||||||
|
[env:d1mini-lolintft24]
|
||||||
|
platform = espressif8266 ;@2.2.3
|
||||||
|
board = d1_mini
|
||||||
|
upload_port = COM4 ; Change to the correct port
|
||||||
|
monitor_port = COM4 ; Change to the correct port
|
||||||
|
board_build.f_flash = 40000000L
|
||||||
|
board_build.flash_mode = dout
|
||||||
|
build_flags =
|
||||||
|
${env.build_flags}
|
||||||
|
-Wl,-Teagle.flash.4m3m.ld
|
||||||
|
; -- TFT_eSPI build options ------------------------
|
||||||
|
-D TFT_ROTATION=${lcd.TFT_ROTATION}
|
||||||
|
-D TFT_WIDTH=${lcd.TFT_WIDTH}
|
||||||
|
-D TFT_HEIGHT=${lcd.TFT_HEIGHT}
|
||||||
|
-D USER_SETUP_LOADED
|
||||||
|
-D ILI9341_DRIVER
|
||||||
|
-D TFT_MISO=12 ;D6
|
||||||
|
-D TFT_MOSI=13 ;D7
|
||||||
|
-D TFT_SCLK=14 ;D5
|
||||||
|
-D TFT_DC=15 ;D8
|
||||||
|
-D TFT_CS=16 ;D0
|
||||||
|
-D TFT_BCKL=5 ;D1
|
||||||
|
-D TFT_RST=-1 ;RST
|
||||||
|
-D TOUCH_CS=0 ;D3 (can also be D1 or D4)
|
||||||
|
-D SPI_FREQUENCY=40000000
|
||||||
|
-D SPI_TOUCH_FREQUENCY=2500000
|
||||||
|
-D SPI_READ_FREQUENCY=20000000
|
||||||
|
-D SUPPORT_TRANSACTIONS
|
||||||
|
; BGR color swapped
|
||||||
|
|
||||||
|
;***************************************************
|
||||||
|
; ESP-12 build
|
||||||
|
;***************************************************
|
||||||
|
[env:esp12e]
|
||||||
|
platform = espressif8266 ;@2.2.3
|
||||||
|
board = esp12e
|
||||||
|
monitor_port = COM5
|
||||||
|
upload_port = COM5 ; Change to the correct port
|
||||||
|
board_build.f_flash = 40000000L
|
||||||
|
board_build.flash_mode = dout
|
||||||
|
build_flags =
|
||||||
|
${env.build_flags}
|
||||||
|
-Wl,-Teagle.flash.4m3m.ld
|
||||||
|
; -- TFT_eSPI build options ------------------------
|
||||||
|
-D TFT_ROTATION=${lcd.TFT_ROTATION}
|
||||||
|
-D TFT_WIDTH=${lcd.TFT_WIDTH}
|
||||||
|
-D TFT_HEIGHT=${lcd.TFT_HEIGHT}
|
||||||
|
-D USER_SETUP_LOADED=1
|
||||||
|
-D ST7735_DRIVER=1
|
||||||
|
-D ST7735_BLACKTAB=1
|
||||||
|
-D TFT_MISO=-1 ;NC
|
||||||
|
-D TFT_MOSI=13 ;D7
|
||||||
|
-D TFT_SCLK=14 ;D5
|
||||||
|
-D TFT_CS=15 ;D8
|
||||||
|
-D TFT_DC=0 ;D3
|
||||||
|
-D TFT_RST=2 ;D4
|
||||||
|
-D TOUCH_CS=-1 ;NC
|
||||||
|
-D SPI_FREQUENCY=27000000
|
||||||
|
|
||||||
|
; -- Library options -------------------------------
|
||||||
|
lib_deps =
|
||||||
|
${env.lib_deps}
|
||||||
|
Ethernet@<2.0.0
|
||||||
|
|
||||||
|
|
||||||
|
;***************************************************
|
||||||
|
; STM32f103 Baite Maple
|
||||||
|
;***************************************************
|
||||||
|
[env:maple]
|
||||||
|
platform = ststm32
|
||||||
|
board = maple
|
||||||
|
monitor_port = COM6 ; Change to the correct port
|
||||||
|
upload_port = COM6 ; Change to the correct port
|
||||||
|
build_flags =
|
||||||
|
${env.build_flags}
|
||||||
|
; -- TFT_eSPI build options ------------------------
|
||||||
|
-D TFT_ROTATION=${lcd.TFT_ROTATION}
|
||||||
|
-D TFT_WIDTH=${lcd.TFT_WIDTH}
|
||||||
|
-D TFT_HEIGHT=${lcd.TFT_HEIGHT}
|
||||||
|
-D USER_SETUP_LOADED=1
|
||||||
|
-D ST7735_DRIVER=1
|
||||||
|
-D ST7735_BLACKTAB=1
|
||||||
|
-D TFT_MISO=-1 ;NC
|
||||||
|
-D TFT_MOSI=13 ;D7
|
||||||
|
-D TFT_SCLK=14 ;D5
|
||||||
|
-D TFT_CS=15 ;D8
|
||||||
|
-D TFT_DC=0 ;D3
|
||||||
|
-D TFT_RST=2 ;D4
|
||||||
|
-D TOUCH_CS=-1 ;NC
|
||||||
|
-D SPI_FREQUENCY=27000000
|
||||||
|
-I "Arduino.h"
|
||||||
|
|
||||||
|
; -- Library options -------------------------------
|
||||||
|
lib_deps =
|
||||||
|
${env.lib_deps}
|
||||||
|
Ethernet@<2.0.0
|
||||||
|
|
||||||
|
|
||||||
|
;***************************************************
|
||||||
|
; Native build
|
||||||
|
;***************************************************
|
||||||
|
[env:native]
|
||||||
|
platform = native
|
||||||
|
build_flags =
|
||||||
|
-D LV_CONF_INCLUDE_SIMPLE
|
||||||
|
; -I src Required to find lv_conf.h
|
||||||
|
-I src
|
||||||
|
-I drivers/sdl2
|
||||||
|
-lSDL2
|
||||||
|
; SDL drivers options
|
||||||
|
-D LV_LVGL_H_INCLUDE_SIMPLE
|
||||||
|
-D LV_DRV_NO_CONF
|
||||||
|
-D USE_MONITOR
|
||||||
|
-D MONITOR_ZOOM=2
|
||||||
|
-D USE_MOUSE
|
||||||
|
-D USE_MOUSEWHEEL
|
||||||
|
-D USE_KEYBOARD
|
||||||
|
lib_deps =
|
||||||
|
;lvgl=https://github.com/littlevgl/lvgl/archive/master.zip
|
||||||
|
lvgl@^6.1.0
|
||||||
|
;lv_drivers=https://github.com/littlevgl/lv_drivers/archive/master.zip
|
||||||
|
lv_drivers@^6.0.2
|
||||||
|
src_filter = +<*> +<../drivers/sdl2>
|
Loading…
x
Reference in New Issue
Block a user