Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Q
qthing
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jens Nolte
qthing
Commits
94f04368
Commit
94f04368
authored
6 years ago
by
Jens Nolte
Browse files
Options
Downloads
Patches
Plain Diff
Implement basic character lcd support
parent
dac7defd
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
main/lcd.cpp
+21
-6
21 additions, 6 deletions
main/lcd.cpp
main/lcd.h
+1
-5
1 addition, 5 deletions
main/lcd.h
main/qthing.h
+2
-0
2 additions, 0 deletions
main/qthing.h
with
24 additions
and
11 deletions
main/lcd.cpp
+
21
−
6
View file @
94f04368
#include
"lcd.h"
#include
"mqtt.h"
#include
<vector>
#include
<sstream>
#include
"Arduino.h"
#include
"LiquidCrystal.h"
const
uint8_t
rs
=
22
,
en
=
23
,
d4
=
5
,
d5
=
18
,
d6
=
19
,
d7
=
21
;
LiquidCrystal
lcd
(
rs
,
en
,
d4
,
d5
,
d6
,
d7
);
LiquidCrystal
lcd
(
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
);
void
enable_lcd
(
const
std
::
string
&
topic
,
uint8_t
rs
,
uint8_t
en
,
uint8_t
d4
,
uint8_t
d5
,
uint8_t
d6
,
uint8_t
d7
)
{
lcd
=
LiquidCrystal
(
rs
,
en
,
d4
,
d5
,
d6
,
d7
);
void
add_lcd
(
const
std
::
string
&
topic
)
{
lcd
.
begin
(
16
,
2
);
lcd
.
clear
();
lcd
.
print
(
"qthing"
);
lcd
.
setCursor
(
0
,
1
);
lcd
.
print
(
"Hello World!"
);
add_message_callback
(
topic
,
[](
std
::
string
message
)
{
lcd
.
clear
();
std
::
istringstream
stream
(
message
);
std
::
string
line
;
std
::
getline
(
stream
,
line
);
lcd
.
setCursor
(
0
,
0
);
lcd
.
print
(
message
.
c_str
());
lcd
.
setCursor
(
0
,
1
);
lcd
.
print
(
message
.
c_str
());
lcd
.
print
(
line
.
c_str
());
if
(
std
::
getline
(
stream
,
line
))
{
lcd
.
setCursor
(
0
,
1
);
lcd
.
print
(
line
.
c_str
());
}
});
}
This diff is collapsed.
Click to expand it.
main/lcd.h
+
1
−
5
View file @
94f04368
#ifndef LCD_H
#define LCD_H
#include
<string>
void
add_lcd
(
const
std
::
string
&
topic
);
#endif
\ No newline at end of file
#endif
This diff is collapsed.
Click to expand it.
main/qthing.h
+
2
−
0
View file @
94f04368
...
...
@@ -55,6 +55,8 @@ void add_button(gpio_num_t gpio, std::function<void()> on_press = NULL, std::fun
void
add_button
(
gpio_num_t
gpio
,
std
::
string
topic
,
std
::
string
message
);
void
add_relay
(
const
std
::
string
&
topic
,
gpio_num_t
gpio_off
,
gpio_num_t
gpio_on
);
void
enable_lcd
(
const
std
::
string
&
topic
,
uint8_t
rs
,
uint8_t
en
,
uint8_t
d4
,
uint8_t
d5
,
uint8_t
d6
,
uint8_t
d7
);
// event handler
void
add_wlan_connection_status_handler
(
connection_status_callback_t
handler
);
void
add_mqtt_connection_status_handler
(
connection_status_callback_t
handler
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment