Skip to content

Commit 3cd419a

Browse files
committed
Merge branch 'develop'
2 parents 3c65fa1 + 694852f commit 3cd419a

File tree

9 files changed

+184
-168
lines changed

9 files changed

+184
-168
lines changed

README.en.md

Lines changed: 0 additions & 96 deletions
This file was deleted.

README.ja.md

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# gob_unifiedButton
2+
3+
![gob_unifiedButton](https://github.com/GOB52/gob_unifiedButton/assets/26270227/590cde0d-f4b6-4fe6-8cae-e25d27b32f8b)
4+
5+
[English](README.md)
6+
7+
## 概要
8+
物理ボタン、タッチボタンを持たない CoreS3 上にタッチボタンを追加し、 M5.BtnX 経由で状態を取得できるようにしたライブラリです。
9+
将来的に [M5Unified](https://github.com/m5stack/M5Unified) に同様の機能がつくまでの暫定としてお使いください。
10+
CoreS3 以外では処理をしないので、Basic, Gray, Core2 と共通のソースで作っている方にも有用です。
11+
12+
## 必要なもの
13+
* [M5Unified](https://github.com/m5stack/M5Unified)
14+
* [M5GFX](https://github.com/m5stack/M5GFX)
15+
16+
**M5Unified 前提ですので、 M5Core3.h を使用した物には適用できません。**
17+
18+
## 導入
19+
環境によって適切な方法でインストールしてください
20+
* git clone や Zip ダウンロードからの展開
21+
* platformio.ini
22+
```ini
23+
lib_deps = gob/gob_unifiedButton
24+
```
25+
* ArduinoIDE ライブラリマネージャからのインストール
26+
27+
## 使い方
28+
```cpp
29+
#include <M5Unified.h>
30+
#include <gob_unifiedButton.hpp>
31+
32+
goblib::UnifiedButton unifiedButton;
33+
34+
void setup()
35+
{
36+
M5.begin();
37+
unifiedButton.begin(&M5.Display);
38+
}
39+
40+
void loop()
41+
{
42+
M5.update();
43+
unifiedButton.update(); // M5.update() の後に呼ぶ事 (0.1.0 から後呼びに変更されました)
44+
45+
// M5.BtnX 経由で同様に状態取得
46+
if(M5.BtnA.wasHold())
47+
{
48+
// ...
49+
}
50+
else if(M5.BtnA.wasClicked())
51+
{
52+
// ...
53+
}
54+
55+
// ボタンを描画する
56+
unifiedButton.draw();
57+
}
58+
```
59+
60+
## ボタンのテキストフォント変更
61+
M5GFX で使用できるフォントを設定できます。
62+
```cpp
63+
unifiedButton.setFont(&fonts::Font4);
64+
```
65+
66+
## 外観変更
67+
begin で指定、または changeAppearance で変更できます。
68+
69+
|引数 goblib::UnifiedButton::appearance\_t|外観|
70+
|---|---|
71+
|bottom| 画面下側にボタンを表示 (default)|
72+
|top|画面上側にボタンを表示|
73+
|custom|独自にボタンをカスタマイズ(下記参照)|
74+
|transparent\_bottom|bottom と同様の位置に透明ボタンを配置|
75+
|transparent\_top|top と同様の位置に透明ボタンを配置|
76+
|transparent_all|画面全体に透明ボタンを配置(縦3分割)|
77+
78+
## ボタンのカスタマイズ
79+
goblib::UnifiedButton::appearance\_t::custom を指定した後であれば、
80+
getButoonA / getButtonB / getButtonC で LGFX_Button\* を取得できます。
81+
```cpp
82+
void setup()
83+
{
84+
M5.begin();
85+
unifiedButton.begin(&M5.Display, goblib::UnifiedButton::appearance_t::custom);
86+
87+
auto btnA = unifiedButton.getButtonA();
88+
auto btnB = unifiedButton.getButtonB();
89+
auto btnC = unifiedButton.getButtonC();
90+
91+
// 独自形状、色、テキストのボタンを再作成
92+
btnA->initButton(unifiedButton.gfx(), 40, 120, 80, 240 ,TFT_GREEN, TFT_BLUE, TFT_WHITE, "[A]");
93+
...
94+
}
95+
```
96+
97+
## ドキュメント
98+
[Doxygen](https://www.doxygen.nl/) 用の[設定ファイル](doc/Doxyfile)[シェルスクリプト](doc/doxy.sh)で作成できます。

README.md

Lines changed: 47 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,48 @@
11
# gob_unifiedButton
22

3-
[English](README.en.md)
3+
[日本語](https://github.com/GOB52/gob_unifiedButton/blob/master/README.ja.md)
44

5-
## 概要
6-
物理ボタン、タッチボタンを持たない CoreS3 上にタッチボタンを追加し、 M5.BtnX 経由で状態を取得できるようにしたライブラリです。
7-
将来的に [M5Unified](https://github.com/m5stack/M5Unified) に同様の機能がつくまでの暫定としてお使いください。
8-
CoreS3 以外では処理をしないので、Basic, Gray, Core2 と共通のソースで作っている方にも有用です。
5+
![gob_unifiedButton](https://github.com/GOB52/gob_unifiedButton/assets/26270227/590cde0d-f4b6-4fe6-8cae-e25d27b32f8b)
96

10-
## 必要なもの
7+
## Overview
8+
This library adds touch buttons on CoreS3, which does not have physical buttons or touch buttons, and enables the user to acquire the status via M5.BtnX.
9+
Please use this as an interim feature until a similar feature is added to [M5Unified](https://github.com/m5stack/M5Unified) in the future.
10+
It is also useful for those who are making a common source for Basic, Gray, and Core2, as it does not process anything other than CoreS3.
11+
12+
## Required libraries
1113
* [M5Unified](https://github.com/m5stack/M5Unified)
1214
* [M5GFX](https://github.com/m5stack/M5GFX)
1315

14-
**M5Unified 前提ですので、 M5Core3.h を使用した物には適用できません。**
16+
**M5Unified is assumed, so it cannot be applied to those using M5Core3.h.**
1517

16-
## 導入
17-
環境によって適切な方法でインストールしてください
18-
* git clone や Zip ダウンロードからの展開
18+
## How to install
19+
Install in an appropriate way depending on your environment.
20+
* git clone or download zip, and extract into place
1921
* platformio.ini
2022
```ini
21-
lib_deps = https://github.com/GOB52/gob_unifiedButton
23+
lib_deps = gob/gob_unifiedButton
2224
```
23-
* ArduinoIDE ライブラリマネージャからのインストール
24-
25-
## 使い方
25+
* Use library manager on ArduinoIDE
2626

27+
## How to use
2728
```cpp
2829
#include <M5Unified.h>
2930
#include <gob_unifiedButton.hpp>
3031

31-
goblib::UnifiedButton unfiedButton;
32+
goblib::UnifiedButton unifiedButton;
3233

3334
void setup()
3435
{
3536
M5.begin();
36-
unfiedButton.begin(&M5.Display);
37+
unifiedButton.begin(&M5.Display);
3738
}
3839

3940
void loop()
4041
{
4142
M5.update();
42-
unfiedButton.update(); // M5.update() の後に呼ぶ事 (0.1.0 から後呼びに変更されました)
43+
unifiedButton.update(); // Must be call after M5.update. (Changed to call after M5.update() since 0.1.0)
4344

44-
// M5.BtnX 経由で同様に状態取得
45+
// M5.BtnX can be used to obtain status
4546
if(M5.BtnA.wasHold())
4647
{
4748
// ...
@@ -51,44 +52,48 @@ void loop()
5152
// ...
5253
}
5354

54-
// ボタンを描画する
55-
unfiedButton.draw();
55+
// Drawing Buttons
56+
unifiedButton.draw();
5657
}
5758
```
59+
## Button text font changes
60+
You can configure which fonts can be used with M5GFX.
61+
```cpp
62+
unifiedButton.setFont(&fonts::Font4);
63+
```
5864

59-
## 外観変更
60-
61-
begin で指定、または changeAppearance で変更できます。
65+
## Appearance changes
66+
You can specify it with begin or change it with changeAppearance.
6267

63-
|引数 goblib::UnifiedButton::appearance\_t|外観|
68+
|Argument goblib::UnifiedButton::appearance\_t|Description|
6469
|---|---|
65-
|bottom| 画面下側にボタンを表示 (default)|
66-
|top|画面上側にボタンを表示|
67-
|custom|独自にボタンをカスタマイズ(下記参照)|
68-
|transparent\_bottom|bottom と同様の位置に透明ボタンを配置|
69-
|transparent\_top|top と同様の位置に透明ボタンを配置|
70-
|transparent_all|画面全体に透明ボタンを配置(縦3分割)|
70+
|bottom| Display buttons at the bottom of the screen (default)|
71+
|top|Display buttons at the top of the screen|
72+
|custom|Customize your own buttons|
73+
|transparent\_bottom|Transparent buttons on the bottom of the screen|
74+
|transparent\_top|Transparent buttons on the top of the screen|
75+
|transparent_all|Transparent buttons are placed on the entire screen (three vertical sections)|
7176

72-
## ボタンのカスタマイズ
77+
## Customize Buttons
78+
If after specifying goblib::UnifiedButton::appearance\_t::custom,
79+
getButtonA / getButtonB / getButtonC to get LGFX_Button\*.
7380

74-
goblib::UnifiedButton::appearance\_t::custom を指定した後であれば、
75-
getButoonA / getButtonB / getButtonC で LGFX_Button\* を取得できます。
7681
```cpp
77-
7882
void setup()
7983
{
8084
M5.begin();
81-
unfiedButton.begin(&M5.Display, goblib::UnifiedButton::appearance_t::custom);
85+
unifiedButton.begin(&M5.Display, goblib::UnifiedButton::appearance_t::custom);
8286

83-
auto btnA = unfiedButton.getButtonA();
84-
auto btnB = unfiedButton.getButtonB();
85-
auto btnC = unfiedButton.getButtonC();
87+
auto btnA = unifiedButton.getButtonA();
88+
auto btnB = unifiedButton.getButtonB();
89+
auto btnC = unifiedButton.getButtonC();
8690

87-
// 独自形状、色、テキストのボタンを再作成
88-
btnA->initButton(unfiedButton.gfx(), 40, 120, 80, 240 ,TFT_GREEN, TFT_BLUE, TFT_WHITE, "[A]");
91+
// Re-create buttons with unique shape, color, and text
92+
btnA->initButton(unifiedButton.gfx(), 40, 120, 80, 240 ,TFT_GREEN, TFT_BLUE, TFT_WHITE, "[A]");
8993
...
9094
}
9195
```
9296

93-
## ドキュメント
94-
[Doxygen](https://www.doxygen.nl/) 用の[設定ファイル](doc/Doxyfile)[シェルスクリプト](doc/doxy.sh)で作成できます。
97+
## Document
98+
Can be created from a [configuration file](doc/Doxyfile) and [shell script](doc/doxy.sh) for [Doxygen](https://www.doxygen.nl/).
99+

examples/simple/simple_main.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ void setup()
1414
unifiedButton.begin(&M5.Display);
1515
M5.Display.clear(TFT_DARKGREEN);
1616
M5_LOGI("gob_unifiedButton %s / %x", GOBLIB_UNIFIED_BUTTON_VERSION_STRING, GOBLIB_UNIFIED_BUTTON_VERSION_VALUE);
17+
18+
// You can change text font of button.
19+
unifiedButton.setFont(&fonts::Font4);
1720
}
1821

1922
void loop()
@@ -62,6 +65,6 @@ void loop()
6265
}
6366
}
6467
}
65-
68+
6669
unifiedButton.draw();
6770
}

library.json

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,12 @@
1111
"type": "git",
1212
"url": "https://github.com/GOB52/gob_unifiedButton.git"
1313
},
14-
"version": "0.1.0",
15-
"build": {
16-
"libArchive": false
17-
},
14+
"version": "0.1.1",
1815
"headers": "gob_unifiedButton.hpp",
1916
"license": "MIT",
2017
"platforms": "espressif32",
2118
"frameworks": "arduino",
2219
"dependencies": {
2320
"m5stack/M5Unified": "^0.1.10"
24-
},
25-
"export": {
26-
"include" : [ ".gitignore", "README.en.md", "platformio.ini", "src", "examples", "doc/Doxyfile", "doc/doxy.sh" ]
2721
}
28-
}
22+
}

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=gob_unifiedButton
2-
version=0.1.0
2+
version=0.1.1
33
author=GOB
44
maintainer=GOB
55
sentence=Add touch buttons for CoreS3 and commonality with conventional buttons (M5.BtnX)

0 commit comments

Comments
 (0)