-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 587cfda
Showing
18 changed files
with
569 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,169 @@ | ||
--- | ||
Language: Cpp | ||
# BasedOnStyle: Google | ||
AccessModifierOffset: -1 | ||
AlignAfterOpenBracket: Align | ||
AlignConsecutiveMacros: false | ||
AlignConsecutiveAssignments: false | ||
AlignConsecutiveDeclarations: false | ||
AlignEscapedNewlines: Left | ||
AlignOperands: true | ||
AlignTrailingComments: true | ||
AllowAllArgumentsOnNextLine: true | ||
AllowAllConstructorInitializersOnNextLine: true | ||
AllowAllParametersOfDeclarationOnNextLine: true | ||
AllowShortBlocksOnASingleLine: Never | ||
AllowShortCaseLabelsOnASingleLine: false | ||
AllowShortFunctionsOnASingleLine: All | ||
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 | ||
ColumnLimit: 100 | ||
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: 2 | ||
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: true | ||
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: 8 | ||
UseCRLF: false | ||
UseTab: Never | ||
... | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
name: clang-format Check | ||
on: [push, pull_request] | ||
jobs: | ||
formatting-check: | ||
name: Formatting Check | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Run clang-format style check for C/C++/Protobuf programs. | ||
uses: jidicula/[email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
name: License Check | ||
on: [push] | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v3 | ||
- name: Install license-header-checker | ||
run: curl -s https://raw.githubusercontent.com/lluissm/license-header-checker/master/install.sh | bash | ||
- name: Run license check | ||
run: ./bin/license-header-checker -a -r -i git,.github,.pio ./util/license_header.txt . h cpp && [[ -z `git status -s` ]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
*~ | ||
.ccls | ||
.clang_complete | ||
.pio | ||
/.ccls-cache/ | ||
/.dir-locals.el | ||
/bin/license-header-checker |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
repos: | ||
- repo: https://github.com/pre-commit/mirrors-clang-format | ||
rev: 'v16.0.0' | ||
hooks: | ||
- id: clang-format | ||
exclude: | | ||
(?x)^( | ||
.*/.pio/.*| | ||
.*\.proto| | ||
.*\.json | ||
)$ |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024 chl33 | ||
|
||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# rt3x-oled | ||
|
||
This is simple OLED support for the [rt3](https://github.com/chl33/rt3) library for ESP projects using the Arduino framework with [Platformio](https://platformio.org/). | ||
|
||
It currently supports 0.91 Inch I2C OLED Display Modules, such as these from | ||
- [Amazon](https://www.amazon.com/gp/product/B08CDN5PSJ) and | ||
- [AliExpress](https://www.aliexpress.us/item/2251832485915041.html). | ||
|
||
![image](https://github.com/chl33/rt3x-oled/assets/64091421/4ee4b222-94ac-442d-b1de-872a550e00f2) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// Copyright (c) 2024 Chris Lee and contibuters. | ||
// Licensed under the MIT license. See LICENSE file in the project root for details. | ||
|
||
#pragma once | ||
|
||
#ifndef NATIVE | ||
#include <SSD1306Wire.h> | ||
#include <Wire.h> | ||
#endif | ||
|
||
#include <og3/module.h> | ||
|
||
namespace og3 { | ||
|
||
class Oled : public Module { | ||
public: | ||
enum FontSize { | ||
kTenPt = 0, | ||
kSixteenPt = 1, | ||
}; | ||
|
||
Oled(const char* name, ModuleSystem* updater, const char* initial_txt, | ||
FontSize font_size = kSixteenPt); | ||
|
||
void setup(); | ||
void clear(); | ||
void display(const char* msg); | ||
void setFontSize(FontSize font_size) { m_font_size = font_size; } | ||
|
||
private: | ||
#ifndef NATIVE | ||
SSD1306Wire m_display; | ||
#endif | ||
const char* m_initial_txt; | ||
FontSize m_font_size; | ||
int m_start = 0; | ||
bool m_ok = false; | ||
}; | ||
|
||
} // namespace og3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// Copyright (c) 2024 Chris Lee and contibuters. | ||
// Licensed under the MIT license. See LICENSE file in the project root for details. | ||
|
||
#pragma once | ||
|
||
#include <og3/tasks.h> | ||
|
||
#include <functional> | ||
#include <vector> | ||
|
||
#include "og3/oled.h" | ||
|
||
namespace og3 { | ||
|
||
// Control OLED to show one of a list of messages. | ||
// A module can register a funciton for controlling the display. | ||
// This module will call those in a cyclic order. | ||
class OledDisplayRing : public Oled { | ||
public: | ||
static const char* kName; | ||
|
||
OledDisplayRing(ModuleSystem* updater, const char* initial_txt, unsigned switch_time_msec, | ||
FontSize font_size = kSixteenPt); | ||
|
||
// Add the callback which will be called when it is its turn. | ||
using CallbackFn = std::function<void()>; | ||
void addDisplayFn(const CallbackFn& fn); | ||
|
||
static OledDisplayRing* get(const NameToModule& n2m) { | ||
return GetModule<OledDisplayRing>(n2m, kName); | ||
} | ||
|
||
private: | ||
void timerCallback(); | ||
|
||
std::vector<CallbackFn> m_callbacks; | ||
const unsigned m_switch_time_msec; | ||
unsigned m_callback_index = 0; | ||
PeriodicTaskScheduler m_scheduler; | ||
}; | ||
|
||
} // namespace og3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Copyright (c) 2024 Chris Lee and contibuters. | ||
// Licensed under the MIT license. See LICENSE file in the project root for details. | ||
|
||
#pragma once | ||
|
||
#include <og3/compiler_definitions.h> | ||
#include <og3/dependencies.h> | ||
#include <og3/wifi_manager.h> | ||
|
||
#include <functional> | ||
|
||
#include "og3/oled_display_ring.h" | ||
|
||
namespace og3 { | ||
|
||
class OledWifiInfo : public Module { | ||
public: | ||
static const char kName[]; | ||
|
||
explicit OledWifiInfo(Tasks* tasks) RT3_NONNULL(); | ||
|
||
private: | ||
DependenciesArray<2> m_dependencies{{WifiManager::kName, OledDisplayRing::kName}}; | ||
WifiManager* m_wifi = nullptr; | ||
OledDisplayRing* m_oled = nullptr; | ||
}; | ||
|
||
} // namespace og3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"name": "og3x-oled", | ||
"version": "0.0.1", | ||
"description": "A library for esp projects", | ||
"keywords": "esp32, esp8266, oled", | ||
"authors": [ | ||
{ | ||
"name": "Chris Lee", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"dependencies": { | ||
"chl33/rt3": "0.0.1", | ||
"thingpulse/ESP8266 and ESP32 OLED driver for SSD1306 displays": "~4.2.0" | ||
}, | ||
"license": "MIT", | ||
"frameworks": "*", | ||
"platforms": "espressif8266, espressif32, native" | ||
} |
Oops, something went wrong.