Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
lichtstream_teensy
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
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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Paul Geisler
lichtstream_teensy
Commits
6c163aad
Commit
6c163aad
authored
6 years ago
by
dronus
Browse files
Options
Downloads
Patches
Plain Diff
Test-Bilderzeugung aus Sender ausgelagert
parent
0df138fb
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitignore
+2
-0
2 additions, 0 deletions
.gitignore
sender.c
+25
-22
25 additions, 22 deletions
sender.c
test.c
+30
-0
30 additions, 0 deletions
test.c
with
57 additions
and
22 deletions
.gitignore
+
2
−
0
View file @
6c163aad
test
sender
This diff is collapsed.
Click to expand it.
sender.c
+
25
−
22
View file @
6c163aad
#include
<stdio.h>
#include
<stdlib.h>
#include
<unistd.h>
#include
<string.h>
#define WIDTH 1000
#define HEIGHT 8
#define WIDTH 60
#define HEIGHT 16
int
image
[
WIDTH
*
HEIGHT
];
char
data
[(
WIDTH
*
HEIGHT
/
8
)
*
6
*
4
+
1
];
int
image_new
[
WIDTH
*
HEIGHT
];
int
image_old
[
WIDTH
*
HEIGHT
];
char
data
[(
WIDTH
*
HEIGHT
/
8
)
*
6
*
4
+
3
];
void
image2data
(
int
*
image
,
char
*
data
,
int
layout
)
{
int
offset
=
1
;
int
offset
=
3
;
int
x
,
y
,
xbegin
,
xend
,
xinc
,
mask
;
int
linesPerPin
=
HEIGHT
/
8
;
int
pixel
[
8
];
data
[
0
]
=
'*'
;
data
[
1
]
=
0
;
// sync delay, sync immediately.
data
[
2
]
=
0
;
for
(
y
=
0
;
y
<
linesPerPin
;
y
++
)
{
if
((
y
&
1
)
==
(
layout
?
0
:
1
))
{
// even numbered rows are left to right
...
...
@@ -62,33 +68,30 @@ int fade(int b, int a, int t)
return
(
rc
<<
0
)
+
(
gc
<<
8
)
+
(
bc
<<
16
);
}
int
main
()
{
int
old
=
0x000000
;
while
(
1
)
{
long
int
r
=
rand
()
>>
24
;
int
new
=
r
+
((
256
-
r
)
<<
16
);
for
(
int
t
=
0
;
t
<
256
;
t
+=
16
)
{
for
(
int
i
=
0
;
i
<
WIDTH
*
HEIGHT
;
i
++
)
//image[i]=c+(c<<8)+(c<<16)+(c<<24);
//image[i]=c;
image
[
i
]
=
fade
(
old
,
new
,
t
);
fprintf
(
stderr
,
"Data size: %i
\n
"
,
(
int
)
sizeof
(
data
));
int
read
=
fread
(
image_new
,
1
,
sizeof
(
image_new
),
stdin
);
fprintf
(
stderr
,
"Sender input size: %i
\n
"
,
(
int
)
read
);
// do a fade
for
(
int
t
=
0
;
t
<
256
;
t
+=
1
)
{
for
(
int
i
=
0
;
i
<
sizeof
(
image
)
/
4
;
i
++
)
image
[
i
]
=
fade
(
image_old
[
i
],
image_new
[
i
],
t
);
image2data
(
image
,
data
,
0
);
int
written
=
fwrite
(
data
,
1
,
sizeof
(
data
),
stdout
);
fflush
(
stdout
);
fprintf
(
stderr
,
"
Data
written: %i
\n
"
,
written
);
fprintf
(
stderr
,
"
Sender output
written: %i
\n
"
,
written
);
usleep
(
2000L
);
}
old
=
new
;
memcpy
(
image_old
,
image_new
,
sizeof
(
image_old
));
}
}
This diff is collapsed.
Click to expand it.
test.c
0 → 100644
+
30
−
0
View file @
6c163aad
#include
<stdio.h>
#include
<stdlib.h>
#include
<unistd.h>
#define WIDTH 60
#define HEIGHT 16
char
image
[
WIDTH
*
HEIGHT
*
4
];
int
main
()
{
while
(
1
)
{
for
(
int
i
=
0
;
i
<
WIDTH
*
HEIGHT
;
i
++
)
{
int
c
=
rand
()
&
0x1F1F1F
;
image
[
i
*
4
+
0
]
=
(
c
>>
0
)
&
0xFF
;
image
[
i
*
4
+
1
]
=
(
c
>>
8
)
&
0xFF
;
image
[
i
*
4
+
2
]
=
(
c
>>
16
)
&
0xFF
;
image
[
i
*
4
+
3
]
=
0
;
}
int
written
=
fwrite
(
image
,
1
,
sizeof
(
image
),
stdout
);
fflush
(
stdout
);
fprintf
(
stderr
,
"Test image data written: %i
\n
"
,
written
);
}
}
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