Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
P
Programmable RF Attenuator
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
Programmable RF Attenuator
Commits
97f79aef
Commit
97f79aef
authored
Nov 09, 2021
by
Juan David González Cobas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix inconsistent indentation and tabbing
parent
54a5d97d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
15 deletions
+15
-15
liboasis-usb-att.c
software/lib/liboasis-usb-att.c
+12
-13
oautest
software/lib/oautest
+3
-2
No files found.
software/lib/liboasis-usb-att.c
View file @
97f79aef
...
...
@@ -48,39 +48,38 @@ int oau_att_open(char *serial)
struct
oau_context
*
ctx
=
&
oau_contexts
[
oau_current_handle
];
int
fd
=
oau_current_handle
;
oau_current_handle
++
;
if
((
ctx
->
ftdi
=
ftdi_new
())
==
0
)
{
return
-
ENOMEM
;
return
-
ENOMEM
;
}
if
(
serial
)
{
if
(
serial
)
{
ret
=
ftdi_usb_open_desc
(
ctx
->
ftdi
,
OAU_VENDOR_ID
,
OAU_DEVICE_ID
,
NULL
,
serial
);
if
(
ret
<
0
)
{
ftdi_free
(
ctx
->
ftdi
);
return
ret
;
ftdi_free
(
ctx
->
ftdi
);
return
ret
;
}
}
else
{
/* open first, and maybe only, device at hand */
ret
=
ftdi_usb_open
(
ctx
->
ftdi
,
OAU_VENDOR_ID
,
OAU_DEVICE_ID
);
if
(
ret
<
0
)
{
ftdi_free
(
ctx
->
ftdi
);
return
ret
;
ftdi_free
(
ctx
->
ftdi
);
return
ret
;
}
}
if
(
(
ret
=
ftdi_set_bitmode
(
ctx
->
ftdi
,
0xff
,
BITMODE_BITBANG
))
<
0
)
{
if
(
(
ret
=
ftdi_set_bitmode
(
ctx
->
ftdi
,
0xff
,
BITMODE_BITBANG
))
<
0
)
{
ftdi_usb_close
(
ctx
->
ftdi
);
ftdi_free
(
ctx
->
ftdi
);
return
ret
;
}
return
ret
;
}
uint8_t
pins
;
if
(
(
ret
=
ftdi_read_pins
(
ctx
->
ftdi
,
&
pins
)
)
<
0
)
{
if
(
(
ret
=
ftdi_read_pins
(
ctx
->
ftdi
,
&
pins
)
)
<
0
)
{
ftdi_usb_close
(
ctx
->
ftdi
);
ftdi_free
(
ctx
->
ftdi
);
return
ret
;
return
ret
;
}
ctx
->
relay_state
=
pins
;
...
...
software/lib/oautest
View file @
97f79aef
...
...
@@ -46,7 +46,8 @@ class OauTest(cmd.Cmd):
self
.
fd
=
fd
self
.
nchannels
=
self
.
read_nchannels
()
print
(
'current device: serial {}, fd {}, {} channels'
.
format
(
serial
,
fd
,
self
.
nchannels
))
str
(
serial
,
'utf8'
)
if
serial
else
'??'
,
fd
,
self
.
nchannels
))
def
do_close
(
self
,
arg
):
"""close connection to current device."""
...
...
@@ -112,7 +113,7 @@ class OauTest(cmd.Cmd):
print
(
'no active connection'
)
return
for
ch
in
range
(
1
,
self
.
nchannels
+
1
):
err
=
self
.
api
.
oau_att_set_relay
(
self
.
fd
,
ch
,
attn_values
[
'-40dB'
])
err
=
self
.
api
.
oau_att_set_relay
(
self
.
fd
,
ch
,
self
.
attn_values
[
'-40dB'
])
if
err
<
0
:
print
(
'error resetting attenuation in channel {}'
.
format
(
ch
))
return
...
...
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