Skip to content

Commit e72b751

Browse files
author
wamisnet
committed
その他のライブラリを更新
1 parent f4f93f6 commit e72b751

File tree

16 files changed

+349
-11
lines changed

16 files changed

+349
-11
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,16 @@ NefryBTは適宜バージョンアップをしてArduinoIDEのボードマネー
3636

3737
## リンク
3838

39-
[Facebookグループ](https://www.facebook.com/nefrystudio/)
40-
[質問等についてはこちら](https://teratail.com/tags/Nefry)
41-
[NefryBTドキュメント](https://dotstud.io/docs/nefrybt/)
42-
[NefryBT説明書](https://drive.google.com/file/d/0B_mvDQF8yaQRLVprUHl4WTFLWVE/view)
39+
- [Facebookグループ](https://www.facebook.com/nefrystudio/)
40+
- [質問等についてはこちら](https://teratail.com/tags/Nefry)
41+
- [NefryBTドキュメント](https://dotstud.io/docs/nefrybt/)
42+
- [NefryBT説明書](https://drive.google.com/file/d/0B_mvDQF8yaQRLVprUHl4WTFLWVE/view)
4343

4444
## エラーデコーダー
4545

4646
[EspExceptionDecoder](https://github.com/me-no-dev/EspExceptionDecoder) エラーデコーダはこちらからダウンロードできます。
4747

48-
## ESP32Dev Board PINMAP
48+
## NefryBT Board PINMAP
4949

5050
![Pin Functions](https://nefry.studio/img/nefrybt_pinmap.png)
5151

cores/esp32/nefry/inc/WiFi/examples/WiFiMulti/WiFiMulti.ino

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
#include <WiFi.h>
77
#include <WiFiMulti.h>
8+
#include <Nefry.h>
89

910
WiFiMulti wifiMulti;
1011

@@ -18,7 +19,7 @@ void setup()
1819
wifiMulti.addAP("ssid_from_AP_3", "your_password_for_AP_3");
1920

2021
Serial.println("Connecting Wifi...");
21-
if(wifiMulti.run() == WL_CONNECTED) {
22+
if(wifiMulti.run(Nefry.getBootMode()) == WL_CONNECTED) {
2223
Serial.println("");
2324
Serial.println("WiFi connected");
2425
Serial.println("IP address: ");
@@ -28,8 +29,8 @@ void setup()
2829

2930
void loop()
3031
{
31-
if(wifiMulti.run() != WL_CONNECTED) {
32+
if(wifiMulti.run(Nefry.getBootMode()) != WL_CONNECTED) {
3233
Serial.println("WiFi not connected!");
3334
delay(1000);
3435
}
35-
}
36+
}

libraries/Nefry/Nefry.h

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ class Nefry_lib
1515
setStoreStr(String str, const int pointer),
1616
getWriteMode(),
1717
readSW(),
18-
getPollingSW();
18+
getPollingSW(),
19+
getWifiEnabled(),
20+
getDisplayStatusEnabled();
1921

2022
String
2123
getModuleID(),
@@ -59,6 +61,12 @@ class Nefry_lib
5961
enableSW(),
6062
disableSW(),
6163

64+
enableWifi(),
65+
disableWifi(),
66+
67+
enableDisplayStatus(),
68+
disableDisplayStatus(),
69+
6270
/* Pollingでスイッチの状態をチェック */
6371
pollingSW(),
6472

@@ -126,8 +134,10 @@ class Nefry_lib
126134
bool
127135
_swEnableFlg = false,/* SWの有効無効化 */
128136
_swflg = false, /* SWの状態を保持 */
129-
_swPushingflg = false;
130-
137+
_swPushingflg = false,
138+
_wifiEnableFlg = true,/* Wi-Fiの有効無効化 */
139+
_displayStatusFlg = true;/* ディスプレイの状態表示の有効無効化 */
140+
131141
int
132142
_bootMode = -1, /* Boot状態を管理 -1:初期化中 0:起動中 1:通常起動 2:書き込みモード */
133143
hextonum(char c),

libraries/Nefry_Display/NefryDisplay.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ class Nefry_Display
1515
// ディスプレイで使用しているメモリを解放する
1616
void end();
1717

18+
// Sets the color of all pixel operations
19+
void setColor(OLEDDISPLAY_COLOR color);
20+
1821
//指定された場所に最大幅の文字列を描画します。
1922
//指定されたStringが指定された幅よりも広い場合
2023
//テキストはスペースまたはダッシュで次の行に折り返されます
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
#include <Nefry.h>
2+
#include <NefryDisplay.h>
3+
#include <NefrySetting.h>
4+
void setting(){
5+
Nefry.disableDisplayStatus();
6+
}
7+
NefrySetting nefrySetting(setting);
8+
9+
void drawDotlogo() {
10+
NefryDisplay.drawRect(14, 10, 32, 32);
11+
NefryDisplay.drawRect(15, 11, 30, 30);
12+
NefryDisplay.drawRect(34, 0, 32, 32);
13+
NefryDisplay.drawRect(35, 1, 30, 30);
14+
NefryDisplay.setFont(Arimo_12);
15+
NefryDisplay.drawString(0, 48, "dotstudio, inc.");
16+
}
17+
18+
#define iotlogo_width 51
19+
#define iotlogo_height 64
20+
static char iotlogo_bits[] = {
21+
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x07, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
22+
0xFF, 0x07, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x07, 0xFF, 0xFF, 0xFF,
23+
0xFF, 0xFF, 0xFF, 0x07, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x80, 0x07, 0x0F,
24+
0x00, 0x00, 0x00, 0x00, 0x80, 0x07, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x80,
25+
0x07, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x80, 0x07, 0x0F, 0x00, 0x00, 0x00,
26+
0x00, 0x80, 0x07, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x80, 0x07, 0x0F, 0xF8,
27+
0xFF, 0xFF, 0xFF, 0x80, 0x07, 0x0F, 0xFE, 0xFF, 0xFF, 0xFF, 0x83, 0x07,
28+
0x0F, 0xF8, 0xFF, 0xFF, 0xFF, 0x80, 0x07, 0x0F, 0x00, 0x00, 0x00, 0x00,
29+
0x80, 0x07, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x80, 0x07, 0x0F, 0x00, 0x00,
30+
0x00, 0x00, 0x80, 0x07, 0x0F, 0xF8, 0xFF, 0xFF, 0xFF, 0x80, 0x07, 0x0F,
31+
0xFE, 0xFF, 0xFF, 0xFF, 0x83, 0x07, 0x0F, 0xF8, 0xFF, 0xFF, 0xFF, 0x80,
32+
0x07, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x80, 0x07, 0x0F, 0x00, 0x00, 0x00,
33+
0x00, 0x80, 0x07, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x80, 0x07, 0x0F, 0xE0,
34+
0xFF, 0x01, 0x00, 0x80, 0x07, 0x0F, 0xFE, 0xFF, 0x1F, 0x00, 0x80, 0x07,
35+
0x0F, 0xFE, 0xFF, 0x1F, 0x00, 0x80, 0x07, 0x0F, 0xE0, 0xFF, 0x01, 0x00,
36+
0x80, 0x07, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x80, 0x07, 0x0F, 0x00, 0x00,
37+
0x00, 0x00, 0x80, 0x07, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x80, 0x07, 0x0F,
38+
0x00, 0x00, 0x00, 0x00, 0x80, 0x07, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x80,
39+
0x07, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x80, 0x07, 0xFF, 0x0F, 0xE0, 0xFF,
40+
0xFF, 0xFF, 0x07, 0xFF, 0x0F, 0xF0, 0xFF, 0xFF, 0xFF, 0x07, 0xFF, 0x0F,
41+
0xFC, 0xFF, 0xFF, 0xFF, 0x07, 0xFF, 0x0F, 0xFE, 0xFF, 0xFF, 0xFF, 0x07,
42+
0x00, 0x0F, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00, 0xCE, 0x1F, 0x00, 0x00,
43+
0x00, 0x00, 0x00, 0xFF, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x03,
44+
0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
45+
0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x00,
46+
0x00, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00,
47+
0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
48+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
49+
0x70, 0x00, 0xFF, 0x8F, 0xF3, 0xFF, 0x00, 0x70, 0x00, 0xFF, 0x8F, 0xF3,
50+
0xFF, 0x00, 0x70, 0x00, 0xFF, 0x8F, 0xF3, 0xFF, 0x00, 0x70, 0x00, 0xF0,
51+
0x80, 0x03, 0x0F, 0x00, 0x70, 0x00, 0xF0, 0x80, 0x03, 0x0F, 0x00, 0x70,
52+
0x70, 0xF0, 0x80, 0x03, 0x0F, 0x00, 0x70, 0xFC, 0xF1, 0x80, 0x03, 0x0F,
53+
0x00, 0x70, 0xFE, 0xF3, 0x80, 0x03, 0x0F, 0x00, 0x70, 0x8E, 0xF7, 0x80,
54+
0x03, 0x0F, 0x00, 0x70, 0x07, 0xF7, 0x80, 0x03, 0x0F, 0x00, 0x70, 0x07,
55+
0xF7, 0x80, 0x03, 0x0F, 0x00, 0x70, 0x07, 0xF7, 0x80, 0x03, 0x0F, 0x00,
56+
0x70, 0x8E, 0xF7, 0x80, 0x03, 0x0F, 0x00, 0x70, 0xFE, 0xF3, 0x80, 0x7F,
57+
0x0F, 0x00, 0x70, 0xFC, 0xF1, 0x80, 0x7F, 0x0F, 0x00, 0x70, 0xF0, 0xF0,
58+
0x80, 0x7F, 0x0F, 0x00,
59+
};
60+
61+
void drawIotlogo() {
62+
NefryDisplay.drawXbm(0, 0, iotlogo_width, iotlogo_height, iotlogo_bits);
63+
}
64+
65+
void drawTextJDI() {
66+
NefryDisplay.setFont(Arimo_12);
67+
NefryDisplay.drawString(0, 0, "Just Do IT!");
68+
NefryDisplay.display();
69+
delay(1000);
70+
71+
NefryDisplay.setFont(ArialMT_Plain_10);
72+
NefryDisplay.drawString(0, 10, "Just Do IT!");
73+
NefryDisplay.display();
74+
delay(1000);
75+
76+
NefryDisplay.setFont(ArialMT_Plain_16);
77+
NefryDisplay.drawString(0, 20, "Just Do IT!");
78+
NefryDisplay.display();
79+
delay(1000);
80+
81+
NefryDisplay.setFont(ArialMT_Plain_24);
82+
NefryDisplay.drawString(0, 32, "Just");
83+
NefryDisplay.display();
84+
delay(800);
85+
NefryDisplay.drawString(51, 32, "Do");
86+
NefryDisplay.display();
87+
delay(800);
88+
NefryDisplay.drawString(88, 32, "IT!");
89+
NefryDisplay.display();
90+
}
91+
92+
void setup() {
93+
}
94+
95+
void loop() {
96+
NefryDisplay.clear();
97+
drawIotlogo();
98+
NefryDisplay.display();
99+
delay(10000);
100+
101+
NefryDisplay.clear();
102+
drawDotlogo();
103+
NefryDisplay.display();
104+
delay(10000);
105+
106+
NefryDisplay.clear();
107+
drawTextJDI();
108+
delay(10000);
109+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#include<NefryFireBase.h>
2+
//NefryのConsoleから0から4までの値を送信するとそれぞれの機能が動作します
3+
NefryFireBase firebase;
4+
void setup() {
5+
firebase.begin("APPID.firebaseio.com");//FireBaseに接続するための設定をします。
6+
//firebase.begin("APPID.firebaseio.com", "AuthToken");//FireBaseに接続するための設定をします。認証情報追加
7+
}
8+
int i = 0;
9+
void loop() {
10+
DataElement elem = DataElement();
11+
elem.setValue("sensor", i++);
12+
elem.setValue("NefryTest", 500 + i++);
13+
String s = Nefry.read();
14+
if (s.equals("0")) {
15+
firebase.send("Nefry", &elem);//FireBaseに新規キーを追加し、そこにデータを追加します
16+
} else if (s.equals("1")) {
17+
firebase.write("Nefry", &elem);//FireBaseのデータを書き込みます
18+
} else if (s.equals("2")) {
19+
firebase.update("Nefry", &elem);//FireBaseのデータを更新します
20+
} else if (s.equals("3")) {
21+
firebase.remove("Nefry");//FireBaseのデータを削除します
22+
//firebase.remove("Nefry/sensor");//FireBaseのデータを削除します
23+
} else if (s.equals("4")) {
24+
Serial.println( firebase.read("Nefry"));//FireBaseからデータを受信します
25+
//Serial.println( firebase.read("Nefry/NefryTest"));//FireBaseからデータを受信します
26+
}
27+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/**
2+
Nefry lib
3+
4+
Copyright (c) 2016 wami
5+
6+
This software is released under the MIT License.
7+
http://opensource.org/licenses/mit-license.php
8+
*/
9+
10+
#include "NefrySetting.h"
11+
12+
FUNC_POINTER fsetup=nullptr;
13+
NefrySetting::NefrySetting(){}
14+
15+
NefrySetting::NefrySetting(FUNC_POINTER _Func_setup){
16+
fsetup = _Func_setup;
17+
}
18+
19+
void NefrySetting::setupSetting()
20+
{
21+
if (fsetup != nullptr) {
22+
fsetup();
23+
}
24+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#ifndef NefrySetting_h
2+
#define NefrySetting_h
3+
#include "NefrySettingBase.h"
4+
typedef void(*FUNC_POINTER)(void);
5+
class NefrySetting
6+
{
7+
public:
8+
NefrySetting();
9+
NefrySetting(FUNC_POINTER _Func_setting);
10+
void setupSetting();
11+
private:
12+
13+
};
14+
#endif
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#ifndef Nefry_SettingBase_h
2+
#define Nefry_SettingBase_h
3+
typedef void(*FUNC_POINTER)(void); //ŠÖ”ƒ|ƒCƒ“ƒ^‚Ìtypedef
4+
extern FUNC_POINTER fsetup, floop;
5+
6+
//extern Nefry_Write NefryWriteMode;
7+
#endif
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#include <Nefry.h>
2+
#include <NefryDisplay.h>
3+
#include <NefrySetting.h>
4+
void setting(){
5+
Nefry.disableDisplayStatus();
6+
}
7+
NefrySetting nefrySetting(setting);
8+
9+
void setup() {
10+
NefryDisplay.clear();
11+
NefryDisplay.display();
12+
// put your setup code here, to run once:
13+
}
14+
15+
void loop() {
16+
// put your main code here, to run repeatedly:
17+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#include<NefrySetting.h>
2+
void setting(){
3+
Serial.begin(115200);
4+
Serial.println();
5+
Serial.println("***************");
6+
Serial.println("TestSetting");
7+
Serial.println("***************");
8+
}
9+
NefrySetting nefrySetting(setting);
10+
void setup() {
11+
// put your setup code here, to run once:
12+
13+
}
14+
15+
void loop() {
16+
// put your main code here, to run repeatedly:
17+
18+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#include <Nefry.h>
2+
#include <NefrySetting.h>
3+
void setting(){
4+
Nefry.disableWifi();
5+
}
6+
NefrySetting nefrySetting(setting);
7+
8+
void setup() {
9+
// put your setup code here, to run once:
10+
}
11+
12+
void loop() {
13+
// put your main code here, to run repeatedly:
14+
15+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#include <Nefry.h>
2+
#include <NefrySetting.h>
3+
void setting(){
4+
Nefry.enableWifi();
5+
}
6+
NefrySetting nefrySetting(setting);
7+
8+
void setup() {
9+
// put your setup code here, to run once:
10+
}
11+
12+
void loop() {
13+
// put your main code here, to run repeatedly:
14+
15+
}

libraries/Nefry_Setting/keywords.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#######################################
2+
# Syntax Coloring Map For nefry
3+
#######################################
4+
# Class
5+
#######################################
6+
7+
NefrySetting KEYWORD1
8+
#######################################
9+
# Methods and Functions
10+
#######################################
11+
12+
#######################################
13+
# Constants
14+
#######################################
15+
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
name=Nefry Setting
2+
version=1.0.0
3+
author=Nefry community
4+
maintainer=
5+
sentence=nefry.
6+
paragraph=nefry.
7+
category=Communication
8+
url=
9+
architectures=esp32
10+
includes=NefrySetting.h

0 commit comments

Comments
 (0)