Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
PyPCC
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
LOFAR2.0
PyPCC
Commits
9168a14d
Commit
9168a14d
authored
4 years ago
by
Paulus Kruger
Browse files
Options
Downloads
Patches
Plain Diff
UNB2 LED working, inverted
parent
51c1a4d0
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
config/UNB2TR.yaml
+5
-4
5 additions, 4 deletions
config/UNB2TR.yaml
i2cserv/gpio.py
+4
-2
4 additions, 2 deletions
i2cserv/gpio.py
i2cserv/i2c_array2.py
+13
-4
13 additions, 4 deletions
i2cserv/i2c_array2.py
i2cserv/i2c_switch2.py
+21
-3
21 additions, 3 deletions
i2cserv/i2c_switch2.py
with
43 additions
and
13 deletions
config/UNB2TR.yaml
+
5
−
4
View file @
9168a14d
...
@@ -76,7 +76,7 @@ device_registers:
...
@@ -76,7 +76,7 @@ device_registers:
description
:
IO-Expander for front panel
description
:
IO-Expander for front panel
address
:
0x41
address
:
0x41
device
:
PCA9536
device
:
PCA9536
driver
:
d_front_panel
driver
:
switch_FP
registers
:
registers
:
-
name
:
CONF
#default 0xff = all input
-
name
:
CONF
#default 0xff = all input
description
:
Direction of GPIO
description
:
Direction of GPIO
...
@@ -154,7 +154,7 @@ variables:
...
@@ -154,7 +154,7 @@ variables:
mask
:
UNB2_mask
mask
:
UNB2_mask
driver
:
switch_FP
driver
:
switch_FP
devreg
:
FP_IO.GPIO
devreg
:
FP_IO.GPIO
bitoffset
:
4
#
bitoffset: 4
width
:
3
width
:
3
rw
:
rw
rw
:
rw
dtype
:
uint8
dtype
:
uint8
...
@@ -367,10 +367,11 @@ methods:
...
@@ -367,10 +367,11 @@ methods:
-
name
:
UNB2_on
-
name
:
UNB2_on
mask
:
UNB2_mask
mask
:
UNB2_mask
driver
:
switch_FP
instructions
:
instructions
:
#
- FP_IO.CONF: 0xf
f #TODO: setup correctly
-
FP_IO.CONF
:
0xf
8
#bit 0-2 output for LED
-
UNB2_PWR_on
:
0
#already inverted
-
UNB2_PWR_on
:
0
#already inverted
-
UNB2_Front_Panel_LED_colour
:
1
-
UNB2_Front_Panel_LED_colour
:
3
#green
-
UNB2_PCB_ID
:
Update
-
UNB2_PCB_ID
:
Update
-
UNB2_PCB_version
:
Update
-
UNB2_PCB_version
:
Update
...
...
This diff is collapsed.
Click to expand it.
i2cserv/gpio.py
+
4
−
2
View file @
9168a14d
...
@@ -26,6 +26,8 @@ class gpio(hwdev):
...
@@ -26,6 +26,8 @@ class gpio(hwdev):
logging
.
warning
(
"
Wrong mask length
"
);
logging
.
warning
(
"
Wrong mask length
"
);
mask
=
[
True
]
*
self
.
Npins
;
mask
=
[
True
]
*
self
.
Npins
;
if
len
(
data
)
!=
self
.
Npins
:
if
len
(
data
)
!=
self
.
Npins
:
if
len
(
data
)
==
1
:
data
=
[
data
[
0
]]
*
self
.
Npins
;
else
:
logging
.
warning
(
"
Wrong data length
"
);
logging
.
warning
(
"
Wrong data length
"
);
return
[]
return
[]
for
i
,
pin
in
enumerate
(
self
.
pins
):
for
i
,
pin
in
enumerate
(
self
.
pins
):
...
...
This diff is collapsed.
Click to expand it.
i2cserv/i2c_array2.py
+
13
−
4
View file @
9168a14d
...
@@ -37,9 +37,18 @@ class i2c_array2(i2c_array):
...
@@ -37,9 +37,18 @@ class i2c_array2(i2c_array):
self
.
conf
[
'
parentcls
'
].
SetSW3
(
self
.
sw3
[
RCUi
]);
self
.
conf
[
'
parentcls
'
].
SetSW3
(
self
.
sw3
[
RCUi
]);
def
SetSwitchMask
(
self
,
mask
):
def
SetSwitchMask
(
self
,
mask
):
logging
.
warn
(
"
Not implemented!!
"
)
sw1
=
[];
sw2
=
[];
sw3
=
[];
# m=0;
m
=
0
;
# for RCUi in range(self.N):
for
RCUi
in
range
(
self
.
N
):
# if mask[RCUi]: m|=1<<self.RCU_Switch1[RCUi];
if
mask
[
RCUi
]:
if
self
.
sw1
[
RCUi
]
not
in
sw1
:
sw1
.
append
(
self
.
sw1
[
RCUi
])
if
self
.
sw2
[
RCUi
]
not
in
sw2
:
sw2
.
append
(
self
.
sw2
[
RCUi
])
if
len
(
self
.
sw3
)
>
0
:
if
self
.
sw3
[
RCUi
]
not
in
sw3
:
sw3
.
append
(
self
.
sw3
[
RCUi
])
logging
.
info
(
str
((
"
SetSwitchMask
"
,
sw1
,
sw2
,
sw3
)))
self
.
conf
[
'
parentcls
'
].
SetSWx
(
sw1
,
sw2
,
sw3
)
# self.conf['parentcls'].SetSW1(self.sw1[RCUi]);
# m|=1<<self.RCU_Switch1[RCUi];
# self.conf['parentcls'].SetChannel(m);
# self.conf['parentcls'].SetChannel(m);
This diff is collapsed.
Click to expand it.
i2cserv/i2c_switch2.py
+
21
−
3
View file @
9168a14d
...
@@ -12,7 +12,7 @@ class i2c_switch2(i2c):
...
@@ -12,7 +12,7 @@ class i2c_switch2(i2c):
self
.
channel2
=-
1
self
.
channel2
=-
1
self
.
channel3
=-
1
self
.
channel3
=-
1
logging
.
info
(
"
i2c switch2 at address %i,%i,%i
"
%
(
self
.
SWaddr1
,
self
.
SWaddr2
,
self
.
SWaddr3
))
logging
.
info
(
"
i2c switch2 at address %i,%i,%i
"
%
(
self
.
SWaddr1
,
self
.
SWaddr2
,
self
.
SWaddr3
))
logging
.
warn
(
"
APSCT switch disabled for testing
"
)
#
logging.warn("APSCT switch disabled for testing")
def
SetSW1
(
self
,
channelbit
):
def
SetSW1
(
self
,
channelbit
):
channel
=
1
<<
(
channelbit
)
channel
=
1
<<
(
channelbit
)
...
@@ -21,8 +21,8 @@ class i2c_switch2(i2c):
...
@@ -21,8 +21,8 @@ class i2c_switch2(i2c):
self
.
channel1
=
channel
self
.
channel1
=
channel
self
.
channel2
=-
1
self
.
channel2
=-
1
self
.
channel3
=-
1
self
.
channel3
=-
1
return
True
;
#testing without APSCT switch
#
return True; #testing without APSCT switch
#
return self.i2csetget(self.SWaddr1,[channel])
return
self
.
i2csetget
(
self
.
SWaddr1
,[
channel
])
def
SetSW2
(
self
,
channelbit
):
def
SetSW2
(
self
,
channelbit
):
channel
=
1
<<
(
channelbit
)
channel
=
1
<<
(
channelbit
)
...
@@ -39,3 +39,21 @@ class i2c_switch2(i2c):
...
@@ -39,3 +39,21 @@ class i2c_switch2(i2c):
self
.
channel3
=
channel
self
.
channel3
=
channel
return
self
.
i2csetget
(
self
.
SWaddr3
,[
channel
])
return
self
.
i2csetget
(
self
.
SWaddr3
,[
channel
])
def
SetSWx
(
self
,
sw1
,
sw2
,
sw3
):
channel
=
0
;
for
x
in
sw1
:
channel
+=
(
1
<<
x
);
self
.
channel1
=
channel
;
self
.
i2csetget
(
self
.
SWaddr1
,[
channel
])
if
channel
==
0
:
return
;
channel
=
0
;
for
x
in
sw2
:
channel
+=
(
1
<<
x
);
self
.
channel2
=
channel
;
self
.
i2csetget
(
self
.
SWaddr2
,[
channel
])
if
channel
==
0
:
return
;
channel
=
0
;
for
x
in
sw3
:
channel
+=
(
1
<<
x
);
if
channel
==
0
:
return
;
self
.
channel3
=
channel
;
self
.
i2csetget
(
self
.
SWaddr3
,[
channel
])
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