Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
Kaffeekasse
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
Service Desk
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tom Kunze
Kaffeekasse
Commits
580129ba
Commit
580129ba
authored
5 years ago
by
Tim Rheinfels
Browse files
Options
Downloads
Patches
Plain Diff
+ Implemented backlight control
parent
b1581e28
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
case/backlight.py
+50
-0
50 additions, 0 deletions
case/backlight.py
case/backlight.sh
+14
-14
14 additions, 14 deletions
case/backlight.sh
with
64 additions
and
14 deletions
case/backlight.py
0 → 100644
+
50
−
0
View file @
580129ba
#!/usr/bin/python
###
### @brief Script for accessing the display's backlight
###
import
RPi.GPIO
as
GPIO
# Configuration
backlight_channel
=
16
# Function for accessing the backlight
def
init
():
# Adviced by the library...
GPIO
.
setwarnings
(
False
)
GPIO
.
setmode
(
GPIO
.
BCM
)
GPIO
.
setup
(
backlight_channel
,
GPIO
.
OUT
)
def
enable
():
init
()
GPIO
.
output
(
backlight_channel
,
GPIO
.
HIGH
)
def
disable
():
init
()
GPIO
.
output
(
backlight_channel
,
GPIO
.
LOW
)
# If the script is executed directly...
if
__name__
==
'
__main__
'
:
import
sys
en
=
None
if
len
(
sys
.
argv
)
==
2
:
if
sys
.
argv
[
1
]
==
'
on
'
:
en
=
True
elif
sys
.
argv
[
1
]
==
'
off
'
:
en
=
False
if
en
is
None
:
print
(
'
Usage: %s <state>
'
)
print
(
''
)
print
(
'
Parameters:
'
)
print
(
'
state: Either
"
on
"
or
"
off
"
to enable/disable the backlight
'
)
print
(
''
)
sys
.
exit
(
1
)
if
en
:
enable
()
else
:
disable
()
This diff is collapsed.
Click to expand it.
case/backlight.sh
+
14
−
14
View file @
580129ba
...
@@ -8,13 +8,13 @@ while true; do
...
@@ -8,13 +8,13 @@ while true; do
if
xset
-q
|
grep
"Monitor is On"
>
/dev/null 2>&1
;
then
if
xset
-q
|
grep
"Monitor is On"
>
/dev/null 2>&1
;
then
if
[
"
$MONITOR_ACTIVE
"
!=
true
]
;
then
if
[
"
$MONITOR_ACTIVE
"
!=
true
]
;
then
MONITOR_ACTIVE
=
true
MONITOR_ACTIVE
=
true
#echo Monitor just switched
on
python /opt/backlight.py
on
xset led named
"Scroll Lock"
xset led named
"Scroll Lock"
fi
fi
else
else
if
[
"
$MONITOR_ACTIVE
"
=
true
]
;
then
if
[
"
$MONITOR_ACTIVE
"
=
true
]
;
then
MONITOR_ACTIVE
=
false
MONITOR_ACTIVE
=
false
#echo Monitor just switched
off
python /opt/backlight.py
off
xset
-led
named
"Scroll Lock"
xset
-led
named
"Scroll Lock"
fi
fi
fi
fi
...
...
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