Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
A
AIDA-2020 TLU - Software
Project
Project
Details
Activity
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
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
AIDA-2020 TLU - Software
Commits
7b09e8c7
Commit
7b09e8c7
authored
Aug 14, 2018
by
Paolo Baesso
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor tweaks and added David's latest firmware (which might still have some bugs)
parent
ab189fa3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
19 deletions
+21
-19
localIni.ini
TLU_v1e/scripts/localIni.ini
+2
-0
top_tlu_v1e_0x1e000013.bit
bitFiles/top_tlu_v1e_0x1e000013.bit
+0
-0
I2CDISP.py
packages/I2CDISP.py
+19
-19
No files found.
TLU_v1e/scripts/localIni.ini
View file @
7b09e8c7
...
@@ -25,6 +25,8 @@ I2C_ID_Addr = 0x50
...
@@ -25,6 +25,8 @@ I2C_ID_Addr = 0x50
I2C_EXP1_Addr
=
0x74
I2C_EXP1_Addr
=
0x74
#I2C address of 2st expander PCA9539PW
#I2C address of 2st expander PCA9539PW
I2C_EXP2_Addr
=
0x75
I2C_EXP2_Addr
=
0x75
#I2C address of EEPROM on powermodule
I2C_pwrId_Addr
=
0x51
#I2C address of AD5665R on powermodule
#I2C address of AD5665R on powermodule
I2C_DACModule_Addr
=
0x1C
I2C_DACModule_Addr
=
0x1C
# Max value for control voltage on PMTs (usually 1 V)
# Max value for control voltage on PMTs (usually 1 V)
...
...
bitFiles/top_tlu_v1e_0x1e000013.bit
0 → 100644
View file @
7b09e8c7
File added
packages/I2CDISP.py
View file @
7b09e8c7
...
@@ -18,7 +18,7 @@ class CFA632:
...
@@ -18,7 +18,7 @@ class CFA632:
def
test
(
self
):
def
test
(
self
):
print
"Testing the display"
print
"Testing the display"
return
return
def
writeSomething
(
self
,
i2ccmd
):
def
writeSomething
(
self
,
i2ccmd
):
mystop
=
True
mystop
=
True
print
"Write to CFA632"
print
"Write to CFA632"
...
@@ -34,7 +34,7 @@ class LCD_ada:
...
@@ -34,7 +34,7 @@ class LCD_ada:
self
.
slaveaddr
=
slaveaddr
self
.
slaveaddr
=
slaveaddr
self
.
nRows
=
2
self
.
nRows
=
2
self
.
nCols
=
16
self
.
nCols
=
16
def
test
(
self
):
def
test
(
self
):
mystop
=
True
mystop
=
True
i2ccmd
=
[]
i2ccmd
=
[]
...
@@ -46,7 +46,7 @@ class LCD_ada:
...
@@ -46,7 +46,7 @@ class LCD_ada:
self
.
getIOdir
()
self
.
getIOdir
()
self
.
setGPIO
(
0x80
)
self
.
setGPIO
(
0x80
)
self
.
i2c
.
write
(
self
.
slaveaddr
,
i2ccmd
,
mystop
)
self
.
i2c
.
write
(
self
.
slaveaddr
,
i2ccmd
,
mystop
)
def
getGPIO
(
self
):
def
getGPIO
(
self
):
# Read port (if configured as inputs)
# Read port (if configured as inputs)
mystop
=
False
mystop
=
False
...
@@ -56,14 +56,14 @@ class LCD_ada:
...
@@ -56,14 +56,14 @@ class LCD_ada:
res
=
self
.
i2c
.
read
(
self
.
slaveaddr
,
nwords
)
res
=
self
.
i2c
.
read
(
self
.
slaveaddr
,
nwords
)
print
"MCP23008 IOdir"
,
res
print
"MCP23008 IOdir"
,
res
return
res
return
res
def
setGPIO
(
self
,
gpio
):
def
setGPIO
(
self
,
gpio
):
# Sets the output latch
# Sets the output latch
mystop
=
True
mystop
=
True
i2ccmd
=
[
9
,
gpio
]
i2ccmd
=
[
9
,
gpio
]
print
"Write GPIO to MCP23008"
print
"Write GPIO to MCP23008"
self
.
i2c
.
write
(
self
.
slaveaddr
,
i2ccmd
,
mystop
)
self
.
i2c
.
write
(
self
.
slaveaddr
,
i2ccmd
,
mystop
)
def
getIOdir
(
self
):
def
getIOdir
(
self
):
mystop
=
False
mystop
=
False
regN
=
0x00
regN
=
0x00
...
@@ -72,7 +72,7 @@ class LCD_ada:
...
@@ -72,7 +72,7 @@ class LCD_ada:
res
=
self
.
i2c
.
read
(
self
.
slaveaddr
,
nwords
)
res
=
self
.
i2c
.
read
(
self
.
slaveaddr
,
nwords
)
print
"MCP23008 IOdir"
,
res
print
"MCP23008 IOdir"
,
res
return
res
return
res
def
setIOdir
(
self
,
iodir
):
def
setIOdir
(
self
,
iodir
):
# 1 indicates the port is an input
# 1 indicates the port is an input
# 0 indicates the port is an output
# 0 indicates the port is an output
...
@@ -128,7 +128,7 @@ class LCD09052:
...
@@ -128,7 +128,7 @@ class LCD09052:
self
.
clearLine
(
1
)
self
.
clearLine
(
1
)
self
.
writeString
([
80
,
81
,
80
,
81
,
82
])
self
.
writeString
([
80
,
81
,
80
,
81
,
82
])
return
return
def
test2
(
self
,
myString1
=
""
,
myString2
=
""
):
def
test2
(
self
,
myString1
=
""
,
myString2
=
""
):
#myString= [80, 81, 80, 81, 82]
#myString= [80, 81, 80, 81, 82]
self
.
clear
()
self
.
clear
()
...
@@ -145,7 +145,7 @@ class LCD09052:
...
@@ -145,7 +145,7 @@ class LCD09052:
#time.sleep(1)
#time.sleep(1)
#self.writeChar(1)
#self.writeChar(1)
return
return
def
dispString
(
self
,
myString
):
def
dispString
(
self
,
myString
):
### Writes the string on the display
### Writes the string on the display
myInts
=
[]
myInts
=
[]
...
@@ -153,7 +153,7 @@ class LCD09052:
...
@@ -153,7 +153,7 @@ class LCD09052:
myInts
.
append
(
ord
(
iChar
))
myInts
.
append
(
ord
(
iChar
))
self
.
writeString
(
myInts
)
self
.
writeString
(
myInts
)
return
return
def
writeString
(
self
,
myChars
):
def
writeString
(
self
,
myChars
):
### Writes a list of chars from the current position of the cursor
### Writes a list of chars from the current position of the cursor
## NOTE: myChars is a list of integers corresponding to the ASCII code of each
## NOTE: myChars is a list of integers corresponding to the ASCII code of each
...
@@ -162,31 +162,31 @@ class LCD09052:
...
@@ -162,31 +162,31 @@ class LCD09052:
myChars
.
insert
(
0
,
1
)
myChars
.
insert
(
0
,
1
)
mystop
=
True
mystop
=
True
self
.
i2c
.
write
(
self
.
slaveaddr
,
myChars
,
mystop
)
self
.
i2c
.
write
(
self
.
slaveaddr
,
myChars
,
mystop
)
def
posCursor
(
self
,
line
,
pos
):
def
posCursor
(
self
,
line
,
pos
):
### Position the cursor on a specific location
### Position the cursor on a specific location
## line can be 1 (top) or 2 (bottom)
## line can be 1 (top) or 2 (bottom)
## pos can be [1, 16}
## pos can be [1, 16}
if
(
(
line
==
1
)
or
(
line
==
2
)
and
(
1
<=
pos
<=
self
.
nCols
)):
if
(
((
line
==
1
)
or
(
line
==
2
)
)
and
(
1
<=
pos
<=
self
.
nCols
)):
i2ccmd
=
[
2
,
line
,
pos
]
i2ccmd
=
[
2
,
line
,
pos
]
mystop
=
True
mystop
=
True
self
.
i2c
.
write
(
self
.
slaveaddr
,
i2ccmd
,
mystop
)
self
.
i2c
.
write
(
self
.
slaveaddr
,
i2ccmd
,
mystop
)
else
:
else
:
print
"Cursor line can only be 1 or 2, position must be in range [1,"
,
self
.
nCols
,
"]"
print
"Cursor line can only be 1 or 2, position must be in range [1,"
,
self
.
nCols
,
"]"
def
clearLine
(
self
,
iLine
):
def
clearLine
(
self
,
iLine
):
### Clear line. Place cursor at beginning of line.
### Clear line. Place cursor at beginning of line.
if
((
iLine
==
1
)
or
(
iLine
==
2
)):
if
((
iLine
==
1
)
or
(
iLine
==
2
)):
i2ccmd
=
[
3
,
iLine
]
i2ccmd
=
[
3
,
iLine
]
mystop
=
True
mystop
=
True
self
.
i2c
.
write
(
self
.
slaveaddr
,
i2ccmd
,
mystop
)
self
.
i2c
.
write
(
self
.
slaveaddr
,
i2ccmd
,
mystop
)
def
clear
(
self
):
def
clear
(
self
):
### Clears the display and locates the curson on position (1,1), i.e. top left
### Clears the display and locates the curson on position (1,1), i.e. top left
i2ccmd
=
[
4
]
i2ccmd
=
[
4
]
mystop
=
True
mystop
=
True
self
.
i2c
.
write
(
self
.
slaveaddr
,
i2ccmd
,
mystop
)
self
.
i2c
.
write
(
self
.
slaveaddr
,
i2ccmd
,
mystop
)
def
setLCDtype
(
self
,
nLines
,
nColumns
):
def
setLCDtype
(
self
,
nLines
,
nColumns
):
### Specifies the number of lines and columns in the display.
### Specifies the number of lines and columns in the display.
## This does not seem to do much but we use it anyway.
## This does not seem to do much but we use it anyway.
...
@@ -195,7 +195,7 @@ class LCD09052:
...
@@ -195,7 +195,7 @@ class LCD09052:
i2ccmd
=
[
5
,
nLines
,
nColumns
]
i2ccmd
=
[
5
,
nLines
,
nColumns
]
mystop
=
True
mystop
=
True
self
.
i2c
.
write
(
self
.
slaveaddr
,
i2ccmd
,
mystop
)
self
.
i2c
.
write
(
self
.
slaveaddr
,
i2ccmd
,
mystop
)
def
setBrightness
(
self
,
value
=
250
):
def
setBrightness
(
self
,
value
=
250
):
### Sets the brightness level of the backlight.
### Sets the brightness level of the backlight.
## Value is an integer in range [0, 250]. 0= no light, 250= maximum light.
## Value is an integer in range [0, 250]. 0= no light, 250= maximum light.
...
@@ -208,7 +208,7 @@ class LCD09052:
...
@@ -208,7 +208,7 @@ class LCD09052:
i2ccmd
=
[
7
,
value
]
i2ccmd
=
[
7
,
value
]
mystop
=
True
mystop
=
True
self
.
i2c
.
write
(
self
.
slaveaddr
,
i2ccmd
,
mystop
)
self
.
i2c
.
write
(
self
.
slaveaddr
,
i2ccmd
,
mystop
)
def
writeChar
(
self
,
value
):
def
writeChar
(
self
,
value
):
### Writes a char in the current cursor position
### Writes a char in the current cursor position
## The cursor is then shifted right one position
## The cursor is then shifted right one position
...
@@ -217,7 +217,7 @@ class LCD09052:
...
@@ -217,7 +217,7 @@ class LCD09052:
mystop
=
True
mystop
=
True
self
.
i2c
.
write
(
self
.
slaveaddr
,
i2ccmd
,
mystop
)
self
.
i2c
.
write
(
self
.
slaveaddr
,
i2ccmd
,
mystop
)
return
return
def
createChar
(
self
,
pos
=
1
,
myChar
=
[]):
def
createChar
(
self
,
pos
=
1
,
myChar
=
[]):
### Define a personalized character and stores it in position "pos"
### Define a personalized character and stores it in position "pos"
## NOTE: This is not working yet.
## NOTE: This is not working yet.
...
@@ -226,7 +226,7 @@ class LCD09052:
...
@@ -226,7 +226,7 @@ class LCD09052:
myChar
.
insert
(
0
,
64
)
myChar
.
insert
(
0
,
64
)
self
.
i2c
.
write
(
self
.
slaveaddr
,
myChar
,
mystop
)
self
.
i2c
.
write
(
self
.
slaveaddr
,
myChar
,
mystop
)
return
return
def
writeSomething
(
self
,
i2ccmd
):
def
writeSomething
(
self
,
i2ccmd
):
mystop
=
True
mystop
=
True
print
"Write to LCD09052"
print
"Write to LCD09052"
...
@@ -246,4 +246,4 @@ class LCD09052:
...
@@ -246,4 +246,4 @@ class LCD09052:
for
iPt
in
myList
:
for
iPt
in
myList
:
iBright
=
int
(
250
*
abs
(
math
.
cos
(
iPt
)))
iBright
=
int
(
250
*
abs
(
math
.
cos
(
iPt
)))
self
.
setBrightness
(
iBright
)
self
.
setBrightness
(
iBright
)
time
.
sleep
(
0.1
)
time
.
sleep
(
0.1
)
\ No newline at end of file
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