-
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 ab4040f
Showing
13 changed files
with
487 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,39 @@ | ||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: 🔧 Setup repo | ||
uses: actions/checkout@v3 | ||
|
||
- name: 🔧 Cache pip | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.cache/pip | ||
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | ||
restore-keys: | | ||
${{ runner.os }}-pip- | ||
- name: 🔧 Cache PlatformIO | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/.platformio | ||
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }} | ||
|
||
- name: 🔧 Setup Python | ||
uses: actions/setup-python@v2 | ||
|
||
- name: 📦 Install PlatformIO | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install --upgrade platformio | ||
- name: 📦 Install library dependencies | ||
run: pio lib -g install 1 | ||
|
||
- name: 🚀 Run PlatformIO | ||
run: pio run |
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,5 @@ | ||
.pio | ||
.vscode/.browse.c_cpp.db* | ||
.vscode/c_cpp_properties.json | ||
.vscode/launch.json | ||
.vscode/ipch |
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 @@ | ||
{ | ||
// 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" | ||
] | ||
} |
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) 2023 Yushin Ito | ||
|
||
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,80 @@ | ||
<h1>M5Battery</h1> | ||
|
||
<div align="left"> | ||
<img src="https://img.shields.io/badge/version-0.0.1-red.svg"> | ||
<img src="https://img.shields.io/github/actions/workflow/status/yushin-ito/M5Battery/build.yml"> | ||
<img src="https://img.shields.io/github/stars/yushin-ito/M5Battery?color=yellow"> | ||
<img src="https://img.shields.io/github/commit-activity/t/yushin-ito/M5Battery"> | ||
<img src="https://img.shields.io/badge/license-MIT-green"> | ||
</div> | ||
|
||
<br> | ||
|
||
<h2>📝 Overview</h2> | ||
An M5Stack library for scrolling text. | ||
|
||
<br> | ||
<br> | ||
|
||
<h2>🚀 Features</h2> | ||
<ul> | ||
<li>Scroll from left to right on the lcd</li> | ||
<li>Customize color and speed</li> | ||
</ul> | ||
<br> | ||
<div align="center"> | ||
<img src="https://github.com/yushin-ito/M5Battery/assets/75526539/7a1514ee-3172-422f-889b-651a5821e1dd" width="80%"/> | ||
</div> | ||
|
||
<br> | ||
|
||
<h2>📦 Installation</h2> | ||
<a href="https://open.vscode.dev/yushin-ito/M5Battery"> | ||
<img src="https://img.shields.io/static/v1?logo=visualstudiocode&label=&message=Open%20in%20Visual%20Studio%20Code&labelColor=2c2c32&color=007acc&logoColor=007acc"> | ||
</a> | ||
<br> | ||
<br> | ||
<ol> | ||
<li>Initialize your Platform IO project</li> | ||
<p><pre><code>platformio init -d . -b m5stack-core-esp32</code></pre></p> | ||
<li>Install the library and its dependency</li> | ||
<p><pre><code>platformio lib install M5Unified</code></pre></p> | ||
</ol> | ||
|
||
<h2>🔧 Usage</h2> | ||
|
||
> **Warning** | ||
> This library has been tested only with M5Stack and M5StickC-PLUS. | ||
<br> | ||
|
||
```c | ||
#include <M5Unified.h> | ||
#include <M5Battery.h> | ||
|
||
M5Battery ts; | ||
|
||
void setup() { | ||
auto cfg = M5.config(); | ||
M5.begin(cfg); | ||
ts.setCusor(0, M5.Display.height() / 2, 1); | ||
ts.setText("Hello World!"); | ||
} | ||
|
||
void loop() { | ||
ts.showBattery(); | ||
} | ||
``` | ||
|
||
<p>You can also read the <a href="https://github.com/yushin-ito/M5Battery/blob/main/doc/BASIC.md">module doc</a> for a list of supported calls.</p> | ||
|
||
<br> | ||
|
||
<h2>👀 Author</h2> | ||
<a href="https://github.com/yushin-ito">Yushin Ito</a> | ||
|
||
<br> | ||
<br> | ||
|
||
<h2>📜 License</h2> | ||
<a href="https://github.com/yushin-ito/M5Battery/blob/main/LICENSE">MIT License</a> |
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,93 @@ | ||
# Basics | ||
|
||
- [Basics](#basics) | ||
- [Instance Basics](#instance-basics) | ||
- [Create a instance](#create-a-instance) | ||
- [Functions Basic](#functions-basic) | ||
- [ts.Cusor(x, y, scroll_pixel) => void](#tssetcusorx-y-scroll_pixel--void) | ||
- [ts.setTextFont(font) => void](#tssettextfontfont--void) | ||
- [ts.setBgColor(color) => void](#tssetbgcolorcolor--void) | ||
- [ts.setTextColor(color) => void](#tssettextcolorcolor--void) | ||
- [ts.setText(text) => void](#tssettexttext--void) | ||
- [ts.showTextScroll() => void](#tsshowtextscroll--void) | ||
- [ts.getScrollCount() => void](#tsgetscrollcount--uint8_t) | ||
|
||
## Instance Basics | ||
|
||
### Create a instance | ||
|
||
Include the `M5TextScroll.h` and `M5Unified` | ||
|
||
```c | ||
#include <M5Unified.h> | ||
#include <M5TextScroll.h> | ||
``` | ||
|
||
Then Instanciate | ||
|
||
```c | ||
M5TextScroll ts; | ||
``` | ||
|
||
Your instance is now ready. | ||
|
||
## Functions Basic | ||
|
||
Call the fuctions using the created instance. | ||
|
||
### ts.setCusor(x, y, scroll_pixel) => void | ||
|
||
Set position and speed of text scroll box. | ||
Kind: instance method of `M5TextScroll` | ||
|
||
| Param | Type | | ||
| :----------: | :-----: | | ||
| x | int32_t | | ||
| y | int32_t | | ||
| scroll_pixel | uint8_t | | ||
|
||
### ts.setTextFont(font) => void | ||
|
||
Set font of text. | ||
Kind: instance method of `M5TextScroll` | ||
|
||
| Param | Type | | ||
| :---: | :-----------: | | ||
| font | lgfx::IFont\* | | ||
|
||
### ts.setBgColor(color) => void | ||
|
||
Set bg color of text scroll box. | ||
Kind: instance method of `M5TextScroll` | ||
|
||
| Param | Type | | ||
| :---: | :------: | | ||
| color | uint32_t | | ||
|
||
### ts.setTextColor(color) => void | ||
|
||
Set bg color of text. | ||
Kind: instance method of `M5TextScroll` | ||
|
||
| Param | Type | | ||
| :---: | :------: | | ||
| color | uint32_t | | ||
|
||
### ts.setText(text) => void | ||
|
||
Set scrolling text. | ||
Kind: instance method of `M5TextScroll` | ||
|
||
| Param | Type | | ||
| :---: | :----------: | | ||
| text | const chat\* | | ||
|
||
### ts.showTextScroll() => void | ||
|
||
Show text scroll. | ||
Kind: instance method of `M5TextScroll` | ||
|
||
### ts.getScrollCount() => uint8_t | ||
|
||
Get scrolling count. | ||
Kind: instance method of `M5TextScroll` |
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,18 @@ | ||
#include <M5Unified.h> | ||
#include <M5Battery.h> | ||
|
||
M5Battery bat; | ||
|
||
void setup() { | ||
auto cfg = M5.config(); | ||
M5.begin(cfg); | ||
M5.Power.begin(); | ||
bat.setCusor(M5.Display.width() / 2, M5.Display.height() / 2); | ||
bat.setSize(3); | ||
} | ||
|
||
void loop() { | ||
M5.update(); | ||
bat.showBattery(); | ||
bat.updateBattery(); | ||
} |
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,18 @@ | ||
#include <M5Unified.h> | ||
#include <M5Battery.h> | ||
|
||
M5Battery bat; | ||
|
||
void setup() { | ||
auto cfg = M5.config(); | ||
M5.begin(cfg); | ||
M5.Power.begin(); | ||
bat.setCusor(M5.Display.width() / 2, M5.Display.height() / 2); | ||
bat.setSize(3); | ||
} | ||
|
||
void loop() { | ||
M5.update(); | ||
bat.showBattery(); | ||
bat.updateBattery(); | ||
} |
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,22 @@ | ||
{ | ||
"name": "M5Battery", | ||
"version": "0.0.1", | ||
"description": "An M5Stack library for scrolling text", | ||
"keywords": "esp32, m5stack, m5stickc, m5stickc-plus", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/yushin-ito/M5Battery" | ||
}, | ||
"authors": [ | ||
{ | ||
"name": "Yushin Ito", | ||
"email": "yitengyouxin8@gmail.com", | ||
"url": "https://github.com/yushin-ito", | ||
"maintainer": true | ||
} | ||
], | ||
"license": "MIT", | ||
"homepage": "https://github.com/yushin-ito/M5Battery", | ||
"frameworks": "*", | ||
"platforms": "*" | ||
} |
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,27 @@ | ||
; 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 | ||
|
||
[platformio] | ||
default_envs = m5stack-core-esp32 | ||
|
||
[env] | ||
platform = espressif32 | ||
framework = arduino | ||
monitor_speed = 115200 | ||
|
||
[env:m5stack-core-esp32] | ||
board = m5stack-core-esp32 | ||
lib_deps = m5stack/M5Unified | ||
|
||
[env:m5stick-c] | ||
board = m5stick-c | ||
lib_deps = m5stack/M5Unified | ||
|
||
|
Oops, something went wrong.