Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
esp8266-oled-ssd1306
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
c3pb
esp8266-oled-ssd1306
Commits
b2f87465
Commit
b2f87465
authored
9 years ago
by
Fabrice Weinberg
Browse files
Options
Downloads
Patches
Plain Diff
Use a typedef to simplify function signatures
parent
cdc6f17d
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
SSD1306Ui.cpp
+10
-10
10 additions, 10 deletions
SSD1306Ui.cpp
SSD1306Ui.h
+7
-4
7 additions, 4 deletions
SSD1306Ui.h
with
17 additions
and
14 deletions
SSD1306Ui.cpp
+
10
−
10
View file @
b2f87465
...
@@ -63,13 +63,13 @@ void SSD1306Ui::setInactiveSymbole(const char* symbole) {
...
@@ -63,13 +63,13 @@ void SSD1306Ui::setInactiveSymbole(const char* symbole) {
void
SSD1306Ui
::
setFrameAnimation
(
AnimationDirection
dir
)
{
void
SSD1306Ui
::
setFrameAnimation
(
AnimationDirection
dir
)
{
this
->
frameAnimationDirection
=
dir
;
this
->
frameAnimationDirection
=
dir
;
}
}
void
SSD1306Ui
::
setFrames
(
bool
(
*
frameFunctions
[])(
SSD1306
*
display
,
SSD1306UiState
*
state
,
int
x
,
int
y
)
,
int
frameCount
)
{
void
SSD1306Ui
::
setFrames
(
FrameCallback
*
frameFunctions
,
int
frameCount
)
{
this
->
frameCount
=
frameCount
;
this
->
frameCount
=
frameCount
;
this
->
frameFunctions
=
frameFunctions
;
this
->
frameFunctions
=
frameFunctions
;
}
}
// -/----- Overlays ------\-
// -/----- Overlays ------\-
void
SSD1306Ui
::
setOverlays
(
bool
(
*
overlayFunctions
[])(
SSD1306
*
display
,
SSD1306UiState
*
state
)
,
int
overlayCount
){
void
SSD1306Ui
::
setOverlays
(
OverlayCallback
*
overlayFunctions
,
int
overlayCount
){
this
->
overlayCount
=
overlayCount
;
this
->
overlayCount
=
overlayCount
;
this
->
overlayFunctions
=
overlayFunctions
;
this
->
overlayFunctions
=
overlayFunctions
;
}
}
...
@@ -176,12 +176,12 @@ void SSD1306Ui::drawFrame(){
...
@@ -176,12 +176,12 @@ void SSD1306Ui::drawFrame(){
int
dir
=
frameTransitionDirection
>=
0
?
1
:
-
1
;
int
dir
=
frameTransitionDirection
>=
0
?
1
:
-
1
;
x
*=
dir
;
y
*=
dir
;
x1
*=
dir
;
y1
*=
dir
;
x
*=
dir
;
y
*=
dir
;
x1
*=
dir
;
y1
*=
dir
;
this
->
dirty
|=
(
*
this
->
frameFunctions
[
this
->
state
.
currentFrame
])(
this
->
display
,
&
this
->
state
,
x
,
y
);
this
->
dirty
|=
(
this
->
frameFunctions
[
this
->
state
.
currentFrame
])(
this
->
display
,
&
this
->
state
,
x
,
y
);
this
->
dirty
|=
(
*
this
->
frameFunctions
[
this
->
getNextFrameNumber
()])(
this
->
display
,
&
this
->
state
,
x1
,
y1
);
this
->
dirty
|=
(
this
->
frameFunctions
[
this
->
getNextFrameNumber
()])(
this
->
display
,
&
this
->
state
,
x1
,
y1
);
break
;
break
;
}
}
case
FIXED
:
case
FIXED
:
this
->
dirty
|=
(
*
this
->
frameFunctions
[
this
->
state
.
currentFrame
])(
this
->
display
,
&
this
->
state
,
0
,
0
);
this
->
dirty
|=
(
this
->
frameFunctions
[
this
->
state
.
currentFrame
])(
this
->
display
,
&
this
->
state
,
0
,
0
);
break
;
break
;
}
}
}
}
...
@@ -200,12 +200,12 @@ void SSD1306Ui::drawIndicator() {
...
@@ -200,12 +200,12 @@ void SSD1306Ui::drawIndicator() {
for
(
byte
i
=
0
;
i
<
this
->
frameCount
;
i
++
)
{
for
(
byte
i
=
0
;
i
<
this
->
frameCount
;
i
++
)
{
const
char
*
xbm
;
const
char
*
image
;
if
(
posOfCurrentFrame
==
i
)
{
if
(
posOfCurrentFrame
==
i
)
{
xbm
=
this
->
activeSymbole
;
image
=
this
->
activeSymbole
;
}
else
{
}
else
{
xbm
=
this
->
inactiveSymbole
;
image
=
this
->
inactiveSymbole
;
}
}
int
x
,
y
;
int
x
,
y
;
...
@@ -228,13 +228,13 @@ void SSD1306Ui::drawIndicator() {
...
@@ -228,13 +228,13 @@ void SSD1306Ui::drawIndicator() {
break
;
break
;
}
}
this
->
display
->
draw
Xbm
(
x
,
y
,
8
,
8
,
xbm
);
this
->
display
->
draw
FastImage
(
x
,
y
,
8
,
8
,
image
);
}
}
}
}
void
SSD1306Ui
::
drawOverlays
()
{
void
SSD1306Ui
::
drawOverlays
()
{
for
(
int
i
=
0
;
i
<
this
->
overlayCount
;
i
++
){
for
(
int
i
=
0
;
i
<
this
->
overlayCount
;
i
++
){
this
->
dirty
|=
(
*
this
->
overlayFunctions
[
i
])(
this
->
display
,
&
this
->
state
);
this
->
dirty
|=
(
this
->
overlayFunctions
[
i
])(
this
->
display
,
&
this
->
state
);
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
SSD1306Ui.h
+
7
−
4
View file @
b2f87465
...
@@ -70,6 +70,9 @@ struct SSD1306UiState {
...
@@ -70,6 +70,9 @@ struct SSD1306UiState {
int
currentFrame
=
0
;
int
currentFrame
=
0
;
};
};
typedef
bool
(
*
FrameCallback
)(
SSD1306
*
display
,
SSD1306UiState
*
state
,
int
x
,
int
y
);
typedef
bool
(
*
OverlayCallback
)(
SSD1306
*
display
,
SSD1306UiState
*
state
);
class
SSD1306Ui
{
class
SSD1306Ui
{
private:
private:
SSD1306
*
display
;
SSD1306
*
display
;
...
@@ -94,11 +97,11 @@ class SSD1306Ui {
...
@@ -94,11 +97,11 @@ class SSD1306Ui {
bool
autoTransition
=
true
;
bool
autoTransition
=
true
;
bool
(
**
frameFunctions
)(
SSD1306
*
display
,
SSD1306UiState
*
state
,
int
x
,
int
y
)
;
FrameCallback
*
frameFunctions
;
int
frameCount
=
0
;
int
frameCount
=
0
;
// Values for Overlays
// Values for Overlays
bool
(
**
overlayFunctions
)(
SSD1306
*
display
,
SSD1306UiState
*
state
)
;
OverlayCallback
*
overlayFunctions
;
int
overlayCount
=
0
;
int
overlayCount
=
0
;
// UI State
// UI State
...
@@ -185,14 +188,14 @@ class SSD1306Ui {
...
@@ -185,14 +188,14 @@ class SSD1306Ui {
/**
/**
* Add frame drawing functions
* Add frame drawing functions
*/
*/
void
setFrames
(
bool
(
*
frameFunctions
[])(
SSD1306
*
display
,
SSD1306UiState
*
state
,
int
x
,
int
y
)
,
int
frameCount
);
void
setFrames
(
FrameCallback
*
frameFunctions
,
int
frameCount
);
// Overlay
// Overlay
/**
/**
* Add overlays drawing functions that are draw independent of the Frames
* Add overlays drawing functions that are draw independent of the Frames
*/
*/
void
setOverlays
(
bool
(
*
overlayFunctions
[])(
SSD1306
*
display
,
SSD1306UiState
*
state
)
,
int
overlayCount
);
void
setOverlays
(
OverlayCallback
*
overlayFunctions
,
int
overlayCount
);
// Manuell Controll
// Manuell Controll
void
nextFrame
();
void
nextFrame
();
...
...
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