Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
multipass
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
Package Registry
Model registry
Operate
Environments
Terraform modules
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
derf
multipass
Commits
84f2392e
Commit
84f2392e
authored
3 years ago
by
Birte Kristina Friesel
Browse files
Options
Downloads
Patches
Plain Diff
Add UART→DMX app
parent
7205332a
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/app/uart-to-dmx/Kconfig
+6
-0
6 additions, 0 deletions
src/app/uart-to-dmx/Kconfig
src/app/uart-to-dmx/Makefile.inc
+9
-0
9 additions, 0 deletions
src/app/uart-to-dmx/Makefile.inc
src/app/uart-to-dmx/main.cc
+76
-0
76 additions, 0 deletions
src/app/uart-to-dmx/main.cc
with
91 additions
and
0 deletions
src/app/uart-to-dmx/Kconfig
0 → 100644
+
6
−
0
View file @
84f2392e
# Copyright 2020 Daniel Friesel
#
# SPDX-License-Identifier: CC0-1.0
prompt "UART to DMX gateway"
depends on !loop && !wakeup && meta_driver_dmx && meta_driver_stdin && meta_driver_timer
This diff is collapsed.
Click to expand it.
src/app/uart-to-dmx/Makefile.inc
0 → 100644
+
9
−
0
View file @
84f2392e
# vim:ft=make
#
# Copyright 2020 Daniel Friesel
#
# SPDX-License-Identifier: CC0-1.0
ifdef
app
loop
=
1
endif
This diff is collapsed.
Click to expand it.
src/app/uart-to-dmx/main.cc
0 → 100644
+
76
−
0
View file @
84f2392e
/*
* Copyright 2022 Daniel Friesel
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include
"arch.h"
#include
"driver/gpio.h"
#include
"driver/stdout.h"
#include
"driver/stdin.h"
#include
"driver/uptime.h"
#include
"driver/dmx.h"
#include
"driver/timer.h"
volatile
unsigned
char
timer_done
=
0
;
char
buffer
[
24
];
unsigned
char
buf_pos
=
0
;
void
input_to_dmx
(
void
)
{
unsigned
char
num
=
0
;
unsigned
char
dmx_frame
=
1
;
for
(
unsigned
int
i
=
0
;
i
<
buf_pos
;
i
++
)
{
if
((
buffer
[
i
]
>=
'0'
)
&&
(
buffer
[
i
]
<=
'9'
))
{
num
*=
10
;
num
+=
buffer
[
i
]
-
'0'
;
}
else
{
dmx
.
frames
[
dmx_frame
++
]
=
num
;
num
=
0
;
}
}
}
int
main
(
void
)
{
arch
.
setup
();
gpio
.
setup
();
kout
.
setup
();
kin
.
setup
();
for
(
unsigned
char
i
=
0
;
i
<
16
;
i
++
)
{
dmx
.
frames
[
i
]
=
0
;
}
dmx
.
setup
();
timer
.
setup_hz
(
15
);
timer
.
start
(
1
);
while
(
1
)
{
while
(
!
timer_done
)
{
arch
.
idle
();
while
(
kin
.
hasKey
()
&&
(
buf_pos
<
24
))
{
char
key
=
kin
.
getKey
();
buffer
[
buf_pos
++
]
=
key
;
kout
<<
key
<<
flush
;
if
((
key
==
'\n'
)
||
(
key
==
'\r'
))
{
input_to_dmx
();
kout
<<
endl
<<
"DMX: "
<<
dmx
.
frames
[
1
]
<<
" "
<<
dmx
.
frames
[
2
]
<<
" "
<<
dmx
.
frames
[
3
]
<<
" "
<<
dmx
.
frames
[
4
]
<<
endl
<<
"> "
;
buf_pos
=
0
;
}
}
}
timer
.
stop
();
timer_done
=
0
;
timer
.
start
(
1
);
dmx
.
write
();
}
return
0
;
}
ON_TIMER_INTERRUPT_head
timer_done
=
1
;
ON_TIMER_INTERRUPT_tail
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