mirror of
https://github.com/m5stack/M5StickCPlus2.git
synced 2026-05-20 11:06:15 -07:00
init
This commit is contained in:
+168
@@ -0,0 +1,168 @@
|
||||
---
|
||||
Language: Cpp
|
||||
BasedOnStyle: Google
|
||||
AccessModifierOffset: -1
|
||||
AlignAfterOpenBracket: Align
|
||||
AlignConsecutiveMacros: true
|
||||
AlignConsecutiveAssignments: true
|
||||
AlignConsecutiveDeclarations: false
|
||||
AlignEscapedNewlines: Left
|
||||
AlignOperands: true
|
||||
AlignTrailingComments: true
|
||||
AllowAllArgumentsOnNextLine: true
|
||||
AllowAllConstructorInitializersOnNextLine: true
|
||||
AllowAllParametersOfDeclarationOnNextLine: true
|
||||
AllowShortBlocksOnASingleLine: Never
|
||||
AllowShortCaseLabelsOnASingleLine: false
|
||||
AllowShortFunctionsOnASingleLine: false
|
||||
AllowShortLambdasOnASingleLine: All
|
||||
AllowShortIfStatementsOnASingleLine: WithoutElse
|
||||
AllowShortLoopsOnASingleLine: true
|
||||
AlwaysBreakAfterDefinitionReturnType: None
|
||||
AlwaysBreakAfterReturnType: None
|
||||
AlwaysBreakBeforeMultilineStrings: true
|
||||
AlwaysBreakTemplateDeclarations: Yes
|
||||
BinPackArguments: true
|
||||
BinPackParameters: true
|
||||
BraceWrapping:
|
||||
AfterCaseLabel: false
|
||||
AfterClass: false
|
||||
AfterControlStatement: false
|
||||
AfterEnum: false
|
||||
AfterFunction: false
|
||||
AfterNamespace: false
|
||||
AfterObjCDeclaration: false
|
||||
AfterStruct: false
|
||||
AfterUnion: false
|
||||
AfterExternBlock: false
|
||||
BeforeCatch: false
|
||||
BeforeElse: false
|
||||
IndentBraces: false
|
||||
SplitEmptyFunction: true
|
||||
SplitEmptyRecord: true
|
||||
SplitEmptyNamespace: true
|
||||
BreakBeforeBinaryOperators: None
|
||||
BreakBeforeBraces: Attach
|
||||
BreakBeforeInheritanceComma: false
|
||||
BreakInheritanceList: BeforeColon
|
||||
BreakBeforeTernaryOperators: true
|
||||
BreakConstructorInitializersBeforeComma: false
|
||||
BreakConstructorInitializers: BeforeColon
|
||||
BreakAfterJavaFieldAnnotations: false
|
||||
BreakStringLiterals: true
|
||||
ColumnLimit: 80
|
||||
CommentPragmas: '^ IWYU pragma:'
|
||||
CompactNamespaces: false
|
||||
ConstructorInitializerAllOnOneLineOrOnePerLine: true
|
||||
ConstructorInitializerIndentWidth: 4
|
||||
ContinuationIndentWidth: 4
|
||||
Cpp11BracedListStyle: true
|
||||
DeriveLineEnding: true
|
||||
DerivePointerAlignment: true
|
||||
DisableFormat: false
|
||||
ExperimentalAutoDetectBinPacking: false
|
||||
FixNamespaceComments: true
|
||||
ForEachMacros:
|
||||
- foreach
|
||||
- Q_FOREACH
|
||||
- BOOST_FOREACH
|
||||
IncludeBlocks: Regroup
|
||||
IncludeCategories:
|
||||
- Regex: '^<ext/.*\.h>'
|
||||
Priority: 2
|
||||
SortPriority: 0
|
||||
- Regex: '^<.*\.h>'
|
||||
Priority: 1
|
||||
SortPriority: 0
|
||||
- Regex: '^<.*'
|
||||
Priority: 2
|
||||
SortPriority: 0
|
||||
- Regex: '.*'
|
||||
Priority: 3
|
||||
SortPriority: 0
|
||||
IncludeIsMainRegex: '([-_](test|unittest))?$'
|
||||
IncludeIsMainSourceRegex: ''
|
||||
IndentCaseLabels: true
|
||||
IndentGotoLabels: true
|
||||
IndentPPDirectives: None
|
||||
IndentWidth: 4
|
||||
IndentWrappedFunctionNames: false
|
||||
JavaScriptQuotes: Leave
|
||||
JavaScriptWrapImports: true
|
||||
KeepEmptyLinesAtTheStartOfBlocks: false
|
||||
MacroBlockBegin: ''
|
||||
MacroBlockEnd: ''
|
||||
MaxEmptyLinesToKeep: 1
|
||||
NamespaceIndentation: None
|
||||
ObjCBinPackProtocolList: Never
|
||||
ObjCBlockIndentWidth: 2
|
||||
ObjCSpaceAfterProperty: false
|
||||
ObjCSpaceBeforeProtocolList: true
|
||||
PenaltyBreakAssignment: 2
|
||||
PenaltyBreakBeforeFirstCallParameter: 1
|
||||
PenaltyBreakComment: 300
|
||||
PenaltyBreakFirstLessLess: 120
|
||||
PenaltyBreakString: 1000
|
||||
PenaltyBreakTemplateDeclaration: 10
|
||||
PenaltyExcessCharacter: 1000000
|
||||
PenaltyReturnTypeOnItsOwnLine: 200
|
||||
PointerAlignment: Left
|
||||
RawStringFormats:
|
||||
- Language: Cpp
|
||||
Delimiters:
|
||||
- cc
|
||||
- CC
|
||||
- cpp
|
||||
- Cpp
|
||||
- CPP
|
||||
- 'c++'
|
||||
- 'C++'
|
||||
CanonicalDelimiter: ''
|
||||
BasedOnStyle: google
|
||||
- Language: TextProto
|
||||
Delimiters:
|
||||
- pb
|
||||
- PB
|
||||
- proto
|
||||
- PROTO
|
||||
EnclosingFunctions:
|
||||
- EqualsProto
|
||||
- EquivToProto
|
||||
- PARSE_PARTIAL_TEXT_PROTO
|
||||
- PARSE_TEST_PROTO
|
||||
- PARSE_TEXT_PROTO
|
||||
- ParseTextOrDie
|
||||
- ParseTextProtoOrDie
|
||||
CanonicalDelimiter: ''
|
||||
BasedOnStyle: google
|
||||
ReflowComments: true
|
||||
SortIncludes: false
|
||||
SortUsingDeclarations: true
|
||||
SpaceAfterCStyleCast: false
|
||||
SpaceAfterLogicalNot: false
|
||||
SpaceAfterTemplateKeyword: true
|
||||
SpaceBeforeAssignmentOperators: true
|
||||
SpaceBeforeCpp11BracedList: false
|
||||
SpaceBeforeCtorInitializerColon: true
|
||||
SpaceBeforeInheritanceColon: true
|
||||
SpaceBeforeParens: ControlStatements
|
||||
SpaceBeforeRangeBasedForLoopColon: true
|
||||
SpaceInEmptyBlock: false
|
||||
SpaceInEmptyParentheses: false
|
||||
SpacesBeforeTrailingComments: 2
|
||||
SpacesInAngles: false
|
||||
SpacesInConditionalStatement: false
|
||||
SpacesInContainerLiterals: true
|
||||
SpacesInCStyleCastParentheses: false
|
||||
SpacesInParentheses: false
|
||||
SpacesInSquareBrackets: false
|
||||
SpaceBeforeSquareBrackets: false
|
||||
Standard: Auto
|
||||
StatementMacros:
|
||||
- Q_UNUSED
|
||||
- QT_REQUIRE_VERSION
|
||||
TabWidth: 4
|
||||
UseCRLF: false
|
||||
UseTab: Never
|
||||
...
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
# Source:
|
||||
# https://github.com/Tinyu-Zhao/M5-Depends/blob/main/.github/ISSUE_TEMPLATE/bug-report.yml
|
||||
# See:
|
||||
# https://docs.github.com/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-issue-forms
|
||||
|
||||
name: Bug report
|
||||
description: Report a problem with the code in this repository.
|
||||
labels:
|
||||
- "type: bug"
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: "Thank you for opening an issue on an M5Stack Arduino library repository.\n\
|
||||
To improve the speed of resolution please review the following guidelines and common troubleshooting steps below before creating the issue:\n\
|
||||
Do not use GitHub issues for troubleshooting projects and issues. Instead use the forums at https://community.m5stack.com to ask questions and troubleshoot why something isn't working as expected. In many cases the problem is a common issue that you will more quickly receive help from the forum community. GitHub issues are meant for known defects in the code. If you don't know if there is a defect in the code then start with troubleshooting on the forum first."
|
||||
- type: textarea
|
||||
id: description
|
||||
attributes:
|
||||
label: Describe the bug
|
||||
description: A clear and concise description of what the bug is.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: reproduce
|
||||
attributes:
|
||||
label: To reproduce
|
||||
description: Provide the specific set of steps we can follow to reproduce the problem.
|
||||
placeholder: |
|
||||
1. In this environment...
|
||||
2. With this config...
|
||||
3. Run '...'
|
||||
4. See error...
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: expected
|
||||
attributes:
|
||||
label: Expected behavior
|
||||
description: What would you expect to happen after following those instructions?
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: screenshots
|
||||
attributes:
|
||||
label: Screenshots
|
||||
description: If applicable, add screenshots to help explain your problem.
|
||||
validations:
|
||||
required: false
|
||||
- type: textarea
|
||||
id: information
|
||||
attributes:
|
||||
label: Environment
|
||||
description: |
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
examples:
|
||||
- **OS**: Ubuntu 20.04
|
||||
- **IDE & IDE Version**: Arduino 1.8.19 Or Platform IO v2.5.0
|
||||
- **Repository Version**: 0.4.0
|
||||
value: |
|
||||
- OS:
|
||||
- IDE &IDE Version:
|
||||
- Repository Version:
|
||||
validations:
|
||||
required: false
|
||||
- type: textarea
|
||||
id: additional
|
||||
attributes:
|
||||
label: Additional context
|
||||
description: Add any additional information here.
|
||||
validations:
|
||||
required: false
|
||||
- type: checkboxes
|
||||
id: checklist
|
||||
attributes:
|
||||
label: Issue checklist
|
||||
description: Please double-check that you have done each of the following things before submitting the issue.
|
||||
options:
|
||||
- label: I searched for previous reports in [the issue tracker](https://github.com/m5stack/M5StickC-Plus/issues?q=)
|
||||
required: true
|
||||
- label: My report contains all necessary details
|
||||
required: true
|
||||
@@ -0,0 +1,115 @@
|
||||
name: 'Test compile for Arduino'
|
||||
description: 'Compile sketches or Arduino library examples for one board type using arduino-cli and check for errors'
|
||||
author: 'Armin Joachimsmeyer'
|
||||
inputs:
|
||||
cli-version:
|
||||
description: 'Version of arduino-cli to use when building. Current (8/2022) one is 0.26.0.'
|
||||
default: 'latest'
|
||||
required: false
|
||||
|
||||
sketch-names:
|
||||
description: 'Comma sepatated list of patterns or filenames (without path) of the sketch(es) to test compile. Useful if the sketch is a *.cpp or *.c file or only one sketch in the repository should be compiled.'
|
||||
default: '*.ino'
|
||||
required: false
|
||||
|
||||
sketch-names-find-start:
|
||||
description: 'The start directory to look for the sketch-names to test compile. Can be a path like "digistump-avr/libraries/*/examples/C*/" .'
|
||||
default: '.'
|
||||
required: false
|
||||
|
||||
arduino-board-fqbn:
|
||||
#In the Arduino IDE, the fqbn is printed in the first line of the verbose output for compilation as parameter -fqbn=... for the "arduino-builder -dump-prefs" command
|
||||
description: 'Fully Qualified Board Name of the Arduino board. You may add a suffix behind the fqbn with "|" to specify one board for e.g. different compile options like arduino:avr:uno|trace.'
|
||||
default: 'arduino:avr:uno'
|
||||
required: false
|
||||
|
||||
arduino-platform:
|
||||
description: 'Comma separated list of platform specifiers, if you require a fixed version like "arduino:avr@1.8.2" or do not want the specifier derived from the 2 first elements of the arduino-board-fqbn or need more than one core. The suffix "@latest" is always removed.'
|
||||
default: ''
|
||||
required: false
|
||||
|
||||
platform-default-url:
|
||||
description: 'The platform URL for the required board description if arduino-board-fqbn does not start with "arduino:" and not explicitly specified by platform-url.'
|
||||
default: ''
|
||||
required: false
|
||||
|
||||
platform-url:
|
||||
description: 'The platform URL for the required board description if arduino-board-fqbn does not start with "arduino:".'
|
||||
default: ''
|
||||
required: false
|
||||
|
||||
required-libraries:
|
||||
description: 'Comma separated list of arduino library names required for compiling the sketches / examples for this board.'
|
||||
default: ''
|
||||
required: false
|
||||
|
||||
sketches-exclude:
|
||||
description: 'Comma or space separated list of complete names of all sketches / examples to be excluded in the build for this board.'
|
||||
default: ''
|
||||
required: false
|
||||
|
||||
build-properties:
|
||||
description: |
|
||||
Build parameter like -DDEBUG for each example specified or for all examples, if example name is "All". In json format.
|
||||
For example: build-properties: '{ "WhistleSwitch": "-DDEBUG -DFREQUENCY_RANGE_LOW", "SimpleFrequencyDetector": "-DINFO" }'
|
||||
default: ''
|
||||
required: false
|
||||
|
||||
extra-arduino-cli-args:
|
||||
description: |
|
||||
This string is passed verbatim without double quotes to the arduino-cli compile commandline as last argument before the filename.
|
||||
See https://arduino.github.io/arduino-cli/commands/arduino-cli_compile/ for compile parameters.
|
||||
default: ''
|
||||
required: false
|
||||
|
||||
extra-arduino-lib-install-args:
|
||||
description: |
|
||||
This string is passed verbatim without double quotes to the arduino-cli lib install commandline as last argument before the library names.
|
||||
It can be used e.g. to suppress dependency resolving for libraries by using --no-deps as argument string.
|
||||
default: ''
|
||||
required: false
|
||||
|
||||
set-build-path:
|
||||
description: 'Flag to set the build directory (arduino-cli paramer --build-path) to /build subdirectory of compiled sketches.'
|
||||
default: 'false'
|
||||
required: false
|
||||
|
||||
debug-compile:
|
||||
description: 'If set to "true" the action logs verbose compile output even during successful builds'
|
||||
default: ''
|
||||
required: false
|
||||
|
||||
debug-install:
|
||||
description: 'If set to "true" the action logs verbose arduino-cli output during installation'
|
||||
default: ''
|
||||
required: false
|
||||
|
||||
runs:
|
||||
using: 'composite'
|
||||
steps:
|
||||
- name: Compile all sketches / examples using the bash script arduino-test-compile.sh
|
||||
env:
|
||||
# Passing parameters to the script by setting the appropriate ENV_* variables.
|
||||
# Direct passing as arguments is not possible because of blanks in the arguments.
|
||||
ENV_CLI_VERSION: ${{ inputs.cli-version }}
|
||||
ENV_SKETCH_NAMES: ${{ inputs.sketch-names }}
|
||||
ENV_SKETCH_NAMES_FIND_START: ${{ inputs.sketch-names-find-start }}
|
||||
ENV_ARDUINO_BOARD_FQBN: ${{ inputs.arduino-board-fqbn }}
|
||||
ENV_ARDUINO_PLATFORM: ${{ inputs.arduino-platform }}
|
||||
ENV_PLATFORM_DEFAULT_URL: ${{ inputs.platform-default-url }}
|
||||
ENV_PLATFORM_URL: ${{ inputs.platform-url }}
|
||||
ENV_REQUIRED_LIBRARIES: ${{ inputs.required-libraries }}
|
||||
ENV_SKETCHES_EXCLUDE: ${{ inputs.sketches-exclude }}
|
||||
ENV_BUILD_PROPERTIES: ${{ inputs.build-properties }}
|
||||
ENV_EXTRA_ARDUINO_CLI_ARGS: ${{ inputs.extra-arduino-cli-args }}
|
||||
ENV_EXTRA_ARDUINO_LIB_INSTALL_ARGS: ${{ inputs.extra-arduino-lib-install-args }}
|
||||
ENV_SET_BUILD_PATH: ${{ inputs.set-build-path }}
|
||||
ENV_DEBUG_COMPILE: ${{ inputs.debug-compile }}
|
||||
ENV_DEBUG_INSTALL: ${{ inputs.debug-install }}
|
||||
|
||||
run: ${{ github.action_path }}/arduino-test-compile.sh
|
||||
shell: bash
|
||||
|
||||
branding:
|
||||
icon: 'eye'
|
||||
color: 'red'
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,15 @@
|
||||
name: Arduino Lint
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
jobs:
|
||||
lint:
|
||||
name: Lint Check
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: arduino/arduino-lint-action@v1
|
||||
with:
|
||||
library-manager: update
|
||||
compliance: strict
|
||||
project-type: all
|
||||
@@ -0,0 +1,80 @@
|
||||
# arduino-test-compile-ActionTest.yml
|
||||
# Github workflow script for testing the arduino-test-compile action development.
|
||||
#
|
||||
# Copyright (C) 2020 Armin Joachimsmeyer
|
||||
# https://github.com/ArminJo/Github-Actions
|
||||
# License: MIT
|
||||
#
|
||||
|
||||
# This is the name of the workflow, visible on GitHub UI.
|
||||
name: Arduino Compile
|
||||
on:
|
||||
push: # see: https://help.github.com/en/actions/reference/events-that-trigger-workflows#pull-request-event-pull_request
|
||||
paths:
|
||||
- '**.ino'
|
||||
- '**.cpp'
|
||||
- '**.h'
|
||||
- 'arduino-test-compile.sh'
|
||||
- '*.yml'
|
||||
workflow_dispatch:
|
||||
jobs:
|
||||
build:
|
||||
name: ${{ matrix.arduino-boards-fqbn }} - test compiling examples
|
||||
|
||||
runs-on: ubuntu-latest # ubuntu-latest # I picked Ubuntu to use shell scripts.
|
||||
|
||||
env:
|
||||
# Comma separated list without double quotes around the list.
|
||||
CLI_VERSION: latest
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
# The matrix will produce one job for each configuration parameter of type `arduino-boards-fqbn`
|
||||
# In the Arduino IDE, the fqbn is printed in the first line of the verbose output for compilation as parameter -fqbn=... for the "arduino-builder -dump-prefs" command
|
||||
#
|
||||
# Examples: arduino:avr:uno, arduino:avr:leonardo, arduino:avr:nano, arduino:avr:mega
|
||||
# arduino:sam:arduino_due_x, arduino:samd:arduino_zero_native"
|
||||
# ATTinyCore:avr:attinyx5:chip=85,clock=1internal, digistump:avr:digispark-tiny, digistump:avr:digispark-pro
|
||||
# STMicroelectronics:stm32:GenF1:pnum=BLUEPILL_F103C8
|
||||
# esp8266:esp8266:huzzah:eesz=4M3M,xtal=80, esp32:esp32:featheresp32:FlashFreq=80
|
||||
# You may add a suffix behind the fqbn with "|" to specify one board for e.g. different compile options like arduino:avr:uno|trace
|
||||
#############################################################################################################
|
||||
arduino-boards-fqbn:
|
||||
- m5stack:esp32:m5stack_stickc_plus2
|
||||
|
||||
# Specify parameters for each board.
|
||||
#############################################################################################################
|
||||
include:
|
||||
- arduino-boards-fqbn: m5stack:esp32:m5stack_stickc_plus2
|
||||
platform-url: https://m5stack.oss-cn-shenzhen.aliyuncs.com/resource/arduino/package_m5stack_index.json
|
||||
sketches-exclude: WhistleSwitch,50Hz,SimpleFrequencyDetector
|
||||
|
||||
# Do not cancel all jobs / architectures if one job fails
|
||||
fail-fast: false
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Checkout custom library
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
repository: ArminJo/ATtinySerialOut
|
||||
ref: master
|
||||
path: CustomLibrary # must match the pattern *Custom*
|
||||
|
||||
# Test of the arduino-test-compile action
|
||||
- name: Compile all examples using the arduino-test-compile action
|
||||
# uses: ArminJo/arduino-test-compile@master
|
||||
uses: ./.github/actions
|
||||
with:
|
||||
arduino-board-fqbn: ${{ matrix.arduino-boards-fqbn }}
|
||||
arduino-platform: ${{ matrix.arduino-platform }}
|
||||
platform-url: ${{ matrix.platform-url }}
|
||||
required-libraries: ${{ env.REQUIRED_LIBRARIES }}
|
||||
sketches-exclude: ${{ matrix.sketches-exclude }}
|
||||
build-properties: ${{ toJson(matrix.build-properties) }}
|
||||
sketch-names: "*.ino"
|
||||
sketch-names-find-start: "examples/*"
|
||||
debug-compile: true
|
||||
debug-install: true
|
||||
@@ -0,0 +1,23 @@
|
||||
name: clang-format Check
|
||||
on: [push, pull_request]
|
||||
jobs:
|
||||
formatting-check:
|
||||
name: Formatting Check
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
path:
|
||||
- check: './' # path to include
|
||||
exclude: '(Fonts|RFID|HEART|MahonyAHRS)' # path to exclude
|
||||
# - check: 'src'
|
||||
# exclude: '(Fonts)' # Exclude file paths containing "Fonts"
|
||||
# - check: 'examples'
|
||||
# exclude: ''
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Run clang-format style check for C/C++/Protobuf programs.
|
||||
uses: jidicula/clang-format-action@v4.8.0
|
||||
with:
|
||||
clang-format-version: '13'
|
||||
check-path: ${{ matrix.path['check'] }}
|
||||
exclude-regex: ${{ matrix.path['exclude'] }}
|
||||
@@ -0,0 +1,5 @@
|
||||
.pio
|
||||
.vscode/.browse.c_cpp.db*
|
||||
.vscode/c_cpp_properties.json
|
||||
.vscode/launch.json
|
||||
.vscode/ipch
|
||||
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2023 M5Stack
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software 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 Software.
|
||||
|
||||
THE SOFTWARE 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 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -0,0 +1,11 @@
|
||||
|
||||
# M5StickCPlus2
|
||||
|
||||
## Basic library for M5Stack M5StickCPlus2 Board
|
||||
|
||||
|
||||
License
|
||||
----------------
|
||||
M5GFX : [MIT](https://github.com/m5stack/M5GFX/blob/master/LICENSE)
|
||||
M5Unified : [MIT](https://github.com/m5stack/M5Unified/blob/master/LICENSE)
|
||||
Arduino-IRremote : [MIT](https://github.com/Arduino-IRremote/Arduino-IRremote/blob/master/LICENSE)
|
||||
@@ -0,0 +1,61 @@
|
||||
/**
|
||||
* @file button.ino
|
||||
* @author SeanKwok (shaoxiang@m5stack.com)
|
||||
* @brief M5StickCPlus2 Button Test
|
||||
* @version 0.1
|
||||
* @date 2023-12-09
|
||||
*
|
||||
*
|
||||
* @Hardwares: M5StickCPlus2
|
||||
* @Platform Version: Arduino M5Stack Board Manager v2.0.9
|
||||
* @Dependent Library:
|
||||
* M5GFX: https://github.com/m5stack/M5GFX
|
||||
* M5Unified: https://github.com/m5stack/M5Unified
|
||||
* M5StickCPlus2: https://github.com/m5stack/M5StickCPlus2
|
||||
*/
|
||||
|
||||
#include "M5StickCPlus2.h"
|
||||
|
||||
void setup() {
|
||||
auto cfg = M5.config();
|
||||
StickCP2.begin(cfg);
|
||||
StickCP2.Display.setRotation(1);
|
||||
StickCP2.Display.setTextColor(GREEN);
|
||||
StickCP2.Display.setTextDatum(middle_center);
|
||||
StickCP2.Display.setTextFont(&fonts::Orbitron_Light_24);
|
||||
StickCP2.Display.setTextSize(1);
|
||||
StickCP2.Display.drawString("Button Test", StickCP2.Display.width() / 2,
|
||||
StickCP2.Display.height() / 2);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
StickCP2.update();
|
||||
if (StickCP2.BtnA.wasPressed()) {
|
||||
StickCP2.Speaker.tone(8000, 20);
|
||||
StickCP2.Display.clear();
|
||||
StickCP2.Display.drawString("A Btn Pressed",
|
||||
StickCP2.Display.width() / 2,
|
||||
StickCP2.Display.height() / 2);
|
||||
}
|
||||
if (StickCP2.BtnA.wasReleased()) {
|
||||
StickCP2.Speaker.tone(8000, 20);
|
||||
StickCP2.Display.clear();
|
||||
StickCP2.Display.drawString("A Btn Released",
|
||||
StickCP2.Display.width() / 2,
|
||||
StickCP2.Display.height() / 2);
|
||||
}
|
||||
if (StickCP2.BtnB.wasPressed()) {
|
||||
StickCP2.Speaker.tone(8000, 20);
|
||||
StickCP2.Display.clear();
|
||||
StickCP2.Display.drawString("B Btn Pressed",
|
||||
StickCP2.Display.width() / 2,
|
||||
StickCP2.Display.height() / 2);
|
||||
}
|
||||
if (StickCP2.BtnB.wasReleased()) {
|
||||
StickCP2.Speaker.tone(8000, 20);
|
||||
StickCP2.Display.clear();
|
||||
StickCP2.Display.drawString("B Btn Released",
|
||||
StickCP2.Display.width() / 2,
|
||||
StickCP2.Display.height() / 2);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
/**
|
||||
* @file buzzer.ino
|
||||
* @author SeanKwok (shaoxiang@m5stack.com)
|
||||
* @brief M5StickCPlus2 Buzzer Test
|
||||
* @version 0.1
|
||||
* @date 2023-12-09
|
||||
*
|
||||
*
|
||||
* @Hardwares: M5StickCPlus2
|
||||
* @Platform Version: Arduino M5Stack Board Manager v2.0.9
|
||||
* @Dependent Library:
|
||||
* M5GFX: https://github.com/m5stack/M5GFX
|
||||
* M5Unified: https://github.com/m5stack/M5Unified
|
||||
* M5StickCPlus2: https://github.com/m5stack/M5StickCPlus2
|
||||
*/
|
||||
|
||||
#include "M5StickCPlus2.h"
|
||||
|
||||
void setup() {
|
||||
auto cfg = M5.config();
|
||||
StickCP2.begin(cfg);
|
||||
StickCP2.Display.setRotation(1);
|
||||
StickCP2.Display.setTextColor(GREEN);
|
||||
StickCP2.Display.setTextDatum(middle_center);
|
||||
StickCP2.Display.setTextFont(&fonts::Orbitron_Light_24);
|
||||
StickCP2.Display.setTextSize(1);
|
||||
StickCP2.Display.drawString("Buzzer Test", StickCP2.Display.width() / 2,
|
||||
StickCP2.Display.height() / 2);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
StickCP2.Speaker.tone(10000, 100);
|
||||
delay(1000);
|
||||
StickCP2.Speaker.tone(4000, 20);
|
||||
delay(1000);
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
/**
|
||||
* @file display.ino
|
||||
* @author SeanKwok (shaoxiang@m5stack.com)
|
||||
* @brief M5StickCPlus2 Display Test
|
||||
* @version 0.1
|
||||
* @date 2023-12-09
|
||||
*
|
||||
*
|
||||
* @Hardwares: M5StickCPlus2
|
||||
* @Platform Version: Arduino M5Stack Board Manager v2.0.9
|
||||
* @Dependent Library:
|
||||
* M5GFX: https://github.com/m5stack/M5GFX
|
||||
* M5Unified: https://github.com/m5stack/M5Unified
|
||||
* M5StickCPlus2: https://github.com/m5stack/M5StickCPlus2
|
||||
*/
|
||||
|
||||
#include "M5StickCPlus2.h"
|
||||
|
||||
void draw_function(LovyanGFX* gfx) {
|
||||
int x = rand() % gfx->width();
|
||||
int y = rand() % gfx->height();
|
||||
int r = (gfx->width() >> 4) + 2;
|
||||
uint16_t c = rand();
|
||||
gfx->fillRect(x - r, y - r, r * 2, r * 2, c);
|
||||
}
|
||||
|
||||
void setup() {
|
||||
auto cfg = M5.config();
|
||||
StickCP2.begin(cfg);
|
||||
int textsize = StickCP2.Display.height() / 60;
|
||||
if (textsize == 0) {
|
||||
textsize = 1;
|
||||
}
|
||||
StickCP2.Display.setTextSize(textsize);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
int x = rand() % StickCP2.Display.width();
|
||||
int y = rand() % StickCP2.Display.height();
|
||||
int r = (StickCP2.Display.width() >> 4) + 2;
|
||||
uint16_t c = rand();
|
||||
StickCP2.Display.fillCircle(x, y, r, c);
|
||||
draw_function(&StickCP2.Display);
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
/**
|
||||
* @file ir_nec.ino
|
||||
* @author SeanKwok (shaoxiang@m5stack.com)
|
||||
* @brief M5StickCPlus2 IR NEC test
|
||||
* @version 0.1
|
||||
* @date 2023-12-09
|
||||
*
|
||||
*
|
||||
* @Hardwares: M5StickCPlus2
|
||||
* @Platform Version: Arduino M5Stack Board Manager v2.0.9
|
||||
* @Dependent Library:
|
||||
* M5GFX: https://github.com/m5stack/M5GFX
|
||||
* M5Unified: https://github.com/m5stack/M5Unified
|
||||
* M5StickCPlus2: https://github.com/m5stack/M5StickCPlus2
|
||||
* IRremote: https://github.com/Arduino-IRremote/Arduino-IRremote
|
||||
*/
|
||||
|
||||
#define DISABLE_CODE_FOR_RECEIVER // Disables restarting receiver after each
|
||||
// send. Saves 450 bytes program memory and
|
||||
// 269 bytes RAM if receiving functions are
|
||||
// not used.
|
||||
#define SEND_PWM_BY_TIMER
|
||||
#define IR_TX_PIN 19
|
||||
|
||||
#include "M5StickCPlus2.h"
|
||||
#include <IRremote.hpp> // include the library
|
||||
|
||||
uint8_t sCommand = 0x34;
|
||||
uint8_t sRepeats = 0;
|
||||
|
||||
void setup() {
|
||||
auto cfg = M5.config();
|
||||
StickCP2.begin(cfg);
|
||||
StickCP2.Display.setRotation(1);
|
||||
StickCP2.Display.setTextColor(GREEN);
|
||||
StickCP2.Display.setTextDatum(middle_center);
|
||||
StickCP2.Display.setTextFont(&fonts::Orbitron_Light_24);
|
||||
StickCP2.Display.setTextSize(1);
|
||||
|
||||
IrSender.begin(DISABLE_LED_FEEDBACK); // Start with IR_SEND_PIN as send pin
|
||||
IrSender.setSendPin(IR_TX_PIN);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
Serial.println();
|
||||
Serial.print(F("Send now: address=0x1111, command=0x"));
|
||||
Serial.print(sCommand, HEX);
|
||||
Serial.print(F(", repeats="));
|
||||
Serial.print(sRepeats);
|
||||
Serial.println();
|
||||
|
||||
StickCP2.Display.clear();
|
||||
StickCP2.Display.drawString("IR NEC SEND", StickCP2.Display.width() / 2,
|
||||
StickCP2.Display.height() / 2 - 40);
|
||||
|
||||
StickCP2.Display.drawString("ADDR:0x1111", StickCP2.Display.width() / 2,
|
||||
StickCP2.Display.height() / 2);
|
||||
|
||||
StickCP2.Display.drawString("CMD:0x" + String(sCommand, HEX),
|
||||
StickCP2.Display.width() / 2,
|
||||
StickCP2.Display.height() / 2 + 40);
|
||||
|
||||
Serial.println(F("Send standard NEC with 16 bit address"));
|
||||
|
||||
StickCP2.Display.fillCircle(32, 105, 8, GREEN);
|
||||
IrSender.sendNEC(0x1111, sCommand, sRepeats);
|
||||
// IrSender.sendOnkyo(0x1111, 0x2223, sRepeats);
|
||||
/*
|
||||
* Increment send values
|
||||
*/
|
||||
sCommand += 1;
|
||||
delay(500);
|
||||
StickCP2.Display.fillCircle(32, 105, 8, YELLOW);
|
||||
delay(500);
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
/**
|
||||
* @file led.ino
|
||||
* @author SeanKwok (shaoxiang@m5stack.com)
|
||||
* @brief M5StickCPlus2 Power LED Test
|
||||
* @version 0.1
|
||||
* @date 2023-12-09
|
||||
*
|
||||
*
|
||||
* @Hardwares: M5StickCPlus2
|
||||
* @Platform Version: Arduino M5Stack Board Manager v2.0.8
|
||||
* @Dependent Library:
|
||||
* M5GFX: https://github.com/m5stack/M5GFX
|
||||
* M5Unified: https://github.com/m5stack/M5Unified
|
||||
* M5StickCPlus2: https://github.com/m5stack/M5StickCPlus2
|
||||
*/
|
||||
|
||||
#include "M5StickCPlus2.h"
|
||||
|
||||
void setup() {
|
||||
auto cfg = M5.config();
|
||||
StickCP2.begin(cfg);
|
||||
StickCP2.Display.setRotation(1);
|
||||
StickCP2.Display.setTextColor(GREEN);
|
||||
StickCP2.Display.setTextDatum(middle_center);
|
||||
StickCP2.Display.setTextFont(&fonts::Orbitron_Light_24);
|
||||
StickCP2.Display.setTextSize(1);
|
||||
StickCP2.Display.drawString("Power LED", StickCP2.Display.width() / 2,
|
||||
StickCP2.Display.height() / 2);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
// inside power red led control
|
||||
StickCP2.Power.setLed(1);
|
||||
delay(1000);
|
||||
StickCP2.Power.setLed(0);
|
||||
delay(1000);
|
||||
}
|
||||
@@ -0,0 +1,146 @@
|
||||
/**
|
||||
* @file rtc.ino
|
||||
* @author SeanKwok (shaoxiang@m5stack.com)
|
||||
* @brief
|
||||
* @version 0.1
|
||||
* @date 2023-12-12
|
||||
*
|
||||
*
|
||||
* @Hardwares: M5StickCPlus2
|
||||
* @Platform Version: Arduino M5Stack Board Manager v2.0.9
|
||||
* @Dependent Library:
|
||||
* M5GFX: https://github.com/m5stack/M5GFX
|
||||
* M5Unified: https://github.com/m5stack/M5Unified
|
||||
* M5StickCPlus2: https://github.com/m5stack/M5StickCPlus2
|
||||
*/
|
||||
|
||||
#if defined(ARDUINO)
|
||||
|
||||
#define WIFI_SSID "YOUR WIFI SSID NAME"
|
||||
#define WIFI_PASSWORD "YOUR WIFI PASSWORD"
|
||||
#define NTP_TIMEZONE "UTC-8"
|
||||
#define NTP_SERVER1 "0.pool.ntp.org"
|
||||
#define NTP_SERVER2 "1.pool.ntp.org"
|
||||
#define NTP_SERVER3 "2.pool.ntp.org"
|
||||
|
||||
#include <WiFi.h>
|
||||
|
||||
// Different versions of the framework have different SNTP header file names and
|
||||
// availability.
|
||||
#if __has_include(<esp_sntp.h>)
|
||||
#include <esp_sntp.h>
|
||||
#define SNTP_ENABLED 1
|
||||
#elif __has_include(<sntp.h>)
|
||||
#include <sntp.h>
|
||||
#define SNTP_ENABLED 1
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef SNTP_ENABLED
|
||||
#define SNTP_ENABLED 0
|
||||
#endif
|
||||
|
||||
#include <M5StickCPlus2.h>
|
||||
|
||||
void setup(void) {
|
||||
StickCP2.begin();
|
||||
|
||||
StickCP2.Display.setRotation(1);
|
||||
StickCP2.Display.setTextColor(GREEN);
|
||||
|
||||
if (!StickCP2.Rtc.isEnabled()) {
|
||||
Serial.println("RTC not found.");
|
||||
StickCP2.Display.println("RTC not found.");
|
||||
for (;;) {
|
||||
vTaskDelay(500);
|
||||
}
|
||||
}
|
||||
|
||||
Serial.println("RTC found.");
|
||||
|
||||
// It is recommended to set UTC for the RTC and ESP32 internal clocks.
|
||||
/* /// setup RTC ( direct setting )
|
||||
// YYYY MM DD hh mm ss
|
||||
StickCP2.Rtc.setDateTime( { { 2021, 12, 31 }, { 12, 34, 56 } } );
|
||||
|
||||
//*/
|
||||
|
||||
/// setup RTC ( NTP auto setting )
|
||||
|
||||
StickCP2.Display.print("WiFi:");
|
||||
WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
|
||||
while (WiFi.status() != WL_CONNECTED) {
|
||||
Serial.print('.');
|
||||
delay(500);
|
||||
}
|
||||
Serial.println("\r\n WiFi Connected.");
|
||||
StickCP2.Display.print("Connected.");
|
||||
|
||||
configTzTime(NTP_TIMEZONE, NTP_SERVER1, NTP_SERVER2, NTP_SERVER3);
|
||||
|
||||
#if SNTP_ENABLED
|
||||
while (sntp_get_sync_status() != SNTP_SYNC_STATUS_COMPLETED) {
|
||||
Serial.print('.');
|
||||
delay(1000);
|
||||
}
|
||||
#else
|
||||
delay(1600);
|
||||
struct tm timeInfo;
|
||||
while (!getLocalTime(&timeInfo, 1000)) {
|
||||
Serial.print('.');
|
||||
};
|
||||
#endif
|
||||
|
||||
Serial.println("\r\n NTP Connected.");
|
||||
|
||||
time_t t = time(nullptr) + 1; // Advance one second.
|
||||
while (t > time(nullptr))
|
||||
; /// Synchronization in seconds
|
||||
StickCP2.Rtc.setDateTime(gmtime(&t));
|
||||
}
|
||||
|
||||
void loop(void) {
|
||||
static constexpr const char* const wd[7] = {"Sun", "Mon", "Tue", "Wed",
|
||||
"Thr", "Fri", "Sat"};
|
||||
|
||||
delay(500);
|
||||
|
||||
auto dt = StickCP2.Rtc.getDateTime();
|
||||
Serial.printf("RTC UTC :%04d/%02d/%02d (%s) %02d:%02d:%02d\r\n",
|
||||
dt.date.year, dt.date.month, dt.date.date,
|
||||
wd[dt.date.weekDay], dt.time.hours, dt.time.minutes,
|
||||
dt.time.seconds);
|
||||
StickCP2.Display.setCursor(0, 0);
|
||||
StickCP2.Display.printf("RTC UTC :%04d/%02d/%02d (%s) %02d:%02d:%02d",
|
||||
dt.date.year, dt.date.month, dt.date.date,
|
||||
wd[dt.date.weekDay], dt.time.hours, dt.time.minutes,
|
||||
dt.time.seconds);
|
||||
|
||||
/// ESP32 internal timer
|
||||
auto t = time(nullptr);
|
||||
{
|
||||
auto tm = gmtime(&t); // for UTC.
|
||||
Serial.printf("ESP32 UTC :%04d/%02d/%02d (%s) %02d:%02d:%02d\r\n",
|
||||
tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday,
|
||||
wd[tm->tm_wday], tm->tm_hour, tm->tm_min, tm->tm_sec);
|
||||
StickCP2.Display.setCursor(0, 20);
|
||||
StickCP2.Display.printf(
|
||||
"ESP32 UTC :%04d/%02d/%02d (%s) %02d:%02d:%02d",
|
||||
tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, wd[tm->tm_wday],
|
||||
tm->tm_hour, tm->tm_min, tm->tm_sec);
|
||||
}
|
||||
|
||||
{
|
||||
auto tm = localtime(&t); // for local timezone.
|
||||
Serial.printf("ESP32 %s:%04d/%02d/%02d (%s) %02d:%02d:%02d\r\n",
|
||||
NTP_TIMEZONE, tm->tm_year + 1900, tm->tm_mon + 1,
|
||||
tm->tm_mday, wd[tm->tm_wday], tm->tm_hour, tm->tm_min,
|
||||
tm->tm_sec);
|
||||
StickCP2.Display.setCursor(0, 40);
|
||||
StickCP2.Display.printf("ESP32 %s:%04d/%02d/%02d (%s) %02d:%02d:%02d",
|
||||
NTP_TIMEZONE, tm->tm_year + 1900,
|
||||
tm->tm_mon + 1, tm->tm_mday, wd[tm->tm_wday],
|
||||
tm->tm_hour, tm->tm_min, tm->tm_sec);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
/**
|
||||
* @file M5StickCPlus2.ino
|
||||
* @author SeanKwok (shaoxiang@m5stack.com)
|
||||
* @brief M5StickCPlus2 Timer Wakeup Test
|
||||
* @version 0.1
|
||||
* @date 2023-12-12
|
||||
*
|
||||
*
|
||||
* @Hardwares: M5StickCPlus2
|
||||
* @Platform Version: Arduino M5Stack Board Manager v2.0.9
|
||||
* @Dependent Library:
|
||||
* M5GFX: https://github.com/m5stack/M5GFX
|
||||
* M5Unified: https://github.com/m5stack/M5Unified
|
||||
* M5StickCPlus2: https://github.com/m5stack/M5StickCPlus2
|
||||
*/
|
||||
|
||||
#include <M5StickCPlus2.h>
|
||||
|
||||
void setup(void) {
|
||||
auto cfg = M5.config();
|
||||
StickCP2.begin(cfg);
|
||||
|
||||
StickCP2.Display.setRotation(1);
|
||||
StickCP2.Display.setTextColor(GREEN);
|
||||
StickCP2.Display.setTextDatum(middle_center);
|
||||
StickCP2.Display.setTextFont(&fonts::Orbitron_Light_24);
|
||||
StickCP2.Display.setTextSize(1);
|
||||
|
||||
Serial.println("Press Btn to sleep");
|
||||
Serial.println("After 5s Wakeup");
|
||||
|
||||
StickCP2.Display.drawString("BtnA Sleep 5s", StickCP2.Display.width() / 2,
|
||||
StickCP2.Display.height() / 2);
|
||||
}
|
||||
|
||||
void loop(void) {
|
||||
StickCP2.update();
|
||||
|
||||
if (StickCP2.BtnA.wasPressed()) {
|
||||
StickCP2.Power.timerSleep(5);
|
||||
// StickCP2.Power.timerSleep(const rtc_time_t& time);
|
||||
// StickCP2.Power.timerSleep(const rtc_date_t& date, const rtc_time_t&
|
||||
// time);
|
||||
// StickCP2.Power.powerOff(); shutdown
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"name": "M5StickCPlus2",
|
||||
"description": "M5Stack M5StickC-Plus2 Board",
|
||||
"keywords": "M5StickC-Plus2",
|
||||
"authors": {
|
||||
"name": "M5Stack",
|
||||
"url": "http://www.m5stack.com"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/m5stack/M5StickCPlus2.git"
|
||||
},
|
||||
"version": "1.0.0",
|
||||
"frameworks": "arduino",
|
||||
"platforms": "espressif32",
|
||||
"headers": "M5StickCPlus2.h"
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
name=M5StickCPlus2
|
||||
version=1.0.0
|
||||
author=M5Stack
|
||||
maintainer=M5Stack
|
||||
sentence=Library for M5Stack M5StickCPlus2 Board
|
||||
paragraph=M5Stack, M5StickCPlus2, See more on http://M5Stack.com
|
||||
category=Device Control
|
||||
url=https://github.com/m5stack/M5StickCPlus2.git
|
||||
architectures=esp32
|
||||
includes=M5StickCPlus2.h
|
||||
depends=M5Unified,M5GFX,M5Family,IRremote
|
||||
@@ -0,0 +1,16 @@
|
||||
#include "M5StickCPlus2.h"
|
||||
|
||||
using namespace m5;
|
||||
|
||||
M5StickCPlus2 StickCP2;
|
||||
|
||||
void M5StickCPlus2::begin() {
|
||||
M5.begin();
|
||||
}
|
||||
|
||||
void M5StickCPlus2::begin(m5::M5Unified::config_t cfg) {
|
||||
M5.begin(cfg);
|
||||
}
|
||||
void M5StickCPlus2::update(void) {
|
||||
M5.update();
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user