UdonLibrary
1.0.0
機械システム研究部 C++ ライブラリ
読み取り中…
検索中…
一致する文字列を見つけられません
Lcd.hpp
[詳解]
1
//
2
// 通信用メッセージ
3
//
4
// Copyright (c) 2022 udonrobo
5
//
6
7
#pragma once
8
9
#include <stdarg.h>
10
#include <stdint.h>
11
#include <
Udon/Traits/EnumerableMacro.hpp
>
12
13
namespace
Udon
14
{
15
16
namespace
Message
17
{
18
22
template
<
size_t
Column,
size_t
Row>
23
struct
Lcd
24
{
26
char
text
[Row][Column];
27
31
void
printf
(
size_t
index,
const
char
* format, ...)
32
{
33
va_list args;
34
va_start(args, format);
35
vsnprintf(
text
[index], Column, format, args);
36
va_end(args);
37
}
38
39
#ifdef ARDUINO
41
void
show()
const
42
{
43
Serial.print(
F
(
"lcd: "
));
44
for
(
auto
&& row :
text
)
45
{
46
Serial.println(row);
47
}
48
}
49
#endif
50
51
UDON_ENUMERABLE
(
text
);
52
};
53
55
using
Lcd1602
=
Lcd<16, 2>
;
56
58
using
Lcd2004
=
Lcd<20, 4>
;
59
60
}
// namespace Message
61
62
}
// namespace Udon
EnumerableMacro.hpp
F
#define F(x)
Definition
Show.hpp:17
Udon::Message
Definition
AirCylinder.hpp:16
Udon::Message::Lcd1602
Lcd< 16, 2 > Lcd1602
LCD 16x2
Definition
Lcd.hpp:55
Udon::Message::Lcd2004
Lcd< 20, 4 > Lcd2004
LCD 20x4
Definition
Lcd.hpp:58
Udon
Definition
Bit.hpp:12
Udon::Message::Lcd
LCD
Definition
Lcd.hpp:24
Udon::Message::Lcd::UDON_ENUMERABLE
UDON_ENUMERABLE(text)
Udon::Message::Lcd::printf
void printf(size_t index, const char *format,...)
LCDに文字列を設定
Definition
Lcd.hpp:31
Udon::Message::Lcd< 16, 2 >::text
char text[Row][Column]
Definition
Lcd.hpp:26