Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cp210x_gpio
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Elphel
cp210x_gpio
Commits
f71e5c8d
Commit
f71e5c8d
authored
Nov 23, 2013
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug fix
parent
a780d129
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
4 deletions
+6
-4
cp210x_gpio.py
cp210x_gpio.py
+6
-4
No files found.
cp210x_gpio.py
View file @
f71e5c8d
...
...
@@ -44,14 +44,14 @@ parser.add_argument('-m', '--mask', default="0xff",help='hex value for masking o
args
=
parser
.
parse_args
()
device
=
args
.
device
if
args
.
gpio_value
is
None
:
mask
=
0
gpio
=
0xff
mask
=
0x00
gpio
=
(
0xff
<<
16
)
|
mask
else
:
mask
=
int
(
args
.
mask
,
0
)
gpio
=
(
int
(
args
.
gpio_value
,
0
)
<<
16
)
|
mask
print
(
'Target GPIO value: 0x
%
x, mask: 0x
%
x'
%
(
gpio
,
mask
))
exit
(
0
)
try
:
fd
=
open
(
device
,
'r+'
)
...
...
@@ -64,8 +64,10 @@ buf = array.array('l', [0])
fcntl
.
ioctl
(
fd
,
IOCTL_GPIOGET
,
buf
,
1
)
print
(
'Old GPIO value:'
),
hex
(
buf
[
0
])
buf
[
0
]
=
gpio
if
args
.
gpio_value
is
None
:
exit
(
0
)
buf
[
0
]
=
gpio
fcntl
.
ioctl
(
fd
,
IOCTL_GPIOSET
,
buf
,
1
)
fcntl
.
ioctl
(
fd
,
IOCTL_GPIOGET
,
buf
,
1
)
print
(
'New GPIO value:'
),
hex
(
buf
[
0
])
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment