Skip to content
GitLab
Explore
Sign in
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
ad3d7fcd
Commit
ad3d7fcd
authored
6 months ago
by
Hannes Feldt
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' into yocto
parents
7963eebe
257648c3
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
pypcc/config/APSCTTR.yaml
+1
-1
1 addition, 1 deletion
pypcc/config/APSCTTR.yaml
pypcc/i2cserv/i2c_smbus2.py
+53
-0
53 additions, 0 deletions
pypcc/i2cserv/i2c_smbus2.py
pypcc/i2cserv/i2c_switch.py
+2
-1
2 additions, 1 deletion
pypcc/i2cserv/i2c_switch.py
pypcc/pypcc.py
+21
-21
21 additions, 21 deletions
pypcc/pypcc.py
with
77 additions
and
23 deletions
pypcc/config/APSCTTR.yaml
+
1
−
1
View file @
ad3d7fcd
...
@@ -3,7 +3,7 @@ description: "1234"
...
@@ -3,7 +3,7 @@ description: "1234"
drivers
:
drivers
:
-
name
:
I2C
-
name
:
I2C
type
:
i2c
type
:
i2c
_smbus2
parameters
:
[
5
]
#I2C port number
parameters
:
[
5
]
#I2C port number
-
name
:
I2C_CLK
-
name
:
I2C_CLK
type
:
i2c_dev
#I2C devices
type
:
i2c_dev
#I2C devices
...
...
This diff is collapsed.
Click to expand it.
pypcc/i2cserv/i2c_smbus2.py
0 → 100644
+
53
−
0
View file @
ad3d7fcd
import
os
from
smbus2
import
SMBus
,
i2c_msg
import
time
import
logging
#read=0: write to register
#read=1: read from register
#read=2: write to register (common in group)
#read=3: wait ms second
from
.hwdev
import
hwdev
;
class
i2c_smbus2
(
hwdev
):
def
__init__
(
self
,
config
):
hwdev
.
__init__
(
self
,
config
);
self
.
bus_nr
=
config
[
'
parameters
'
][
0
]
logging
.
info
(
"
smbus2 driver on bus
"
+
str
(
self
.
bus_nr
))
self
.
bus
=
SMBus
(
self
.
bus_nr
)
self
.
I2Ccounter
=
0
def
i2csetget
(
self
,
addr
,
data
,
reg
=
None
,
read
=
0
):
# logging.debug(str(("I2C",addr,reg,data,read)))
try
:
# if True:
if
read
==
3
:
time
.
sleep
(
data
[
0
]
/
1000.
)
return
True
if
read
==
1
:
if
not
(
reg
is
None
):
data
[:]
=
self
.
bus
.
read_i2c_block_data
(
addr
,
reg
,
len
(
data
))
else
:
msg
=
i2c_msg
.
read
(
addr
,
len
(
data
))
self
.
bus
.
i2c_rdwr
(
msg
)
if
len
(
msg
)
!=
len
(
data
):
logging
.
debug
(
str
((
"
I2C get failed
"
,
addr
,
reg
,
data
,
read
)))
data
[
0
]
=
0
;
return
False
data
[:]
=
list
(
msg
)
logging
.
debug
(
str
((
"
I2C get
"
,
addr
,
reg
,
data
,
read
)))
else
:
if
not
(
reg
is
None
):
self
.
bus
.
write_i2c_block_data
(
addr
,
reg
,
data
)
else
:
msg
=
i2c_msg
.
write
(
addr
,
data
)
self
.
bus
.
i2c_rdwr
(
msg
)
return
True
;
except
:
# else:
logging
.
debug
(
"
I2C failed!
"
)
if
len
(
data
)
>
0
:
data
[
0
]
=
0
return
False
;
This diff is collapsed.
Click to expand it.
pypcc/i2cserv/i2c_switch.py
+
2
−
1
View file @
ad3d7fcd
import
logging
import
logging
from
.i2c
import
i2c
#from .i2c import i2c
from
.i2c_smbus2
import
i2c_smbus2
as
i2c
#import HWconf
#import HWconf
#SWaddr=0x70
#SWaddr=0x70
...
...
This diff is collapsed.
Click to expand it.
pypcc/pypcc.py
+
21
−
21
View file @
ad3d7fcd
...
@@ -138,15 +138,15 @@ def main():
...
@@ -138,15 +138,15 @@ def main():
time
.
sleep
(
0.1
);
time
.
sleep
(
0.1
);
for
c
in
configs
:
for
c
in
configs
:
if
c
.
Monitor
():
continue
if
c
.
Monitor
():
continue
if
not
(
args
.
simulator
)
and
not
(
args
.
test
):
#
if not(args.simulator) and not(args.test):
for
i
,
c
in
enumerate
(
configs
):
#
for i,c in enumerate(configs):
timeout
=
c
.
watchdog
()
#
timeout=c.watchdog()
if
timeout
>
10
:
#
if timeout>10:
print
(
i
,
timeout
)
#
print(i,timeout)
if
timeout
>
60
:
#
if timeout>60:
logging
.
error
(
"
I2C timeout!
"
)
#
logging.error("I2C timeout!")
# restart_I2C(i)
# restart_I2C(i)
RunTimer
=
False
#
RunTimer=False
# cnt+=1;
# cnt+=1;
# if cnt==60*10*2:
# if cnt==60*10*2:
# print("****** restart test *****")
# print("****** restart test *****")
...
...
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