Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
F
FMC ADC 100M 14b 4cha - Testing
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
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
FMC ADC 100M 14b 4cha - Testing
Commits
71ae6af7
Commit
71ae6af7
authored
Jan 11, 2012
by
Matthieu Cattin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rearange cp210x folders and files.
parent
079cb6ee
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
71 additions
and
2 deletions
+71
-2
calibr_box.py
test/fmcadc100m14b4cha/python/calibr_box.py
+2
-2
__init__.py
test/fmcadc100m14b4cha/python/cp210x/__init__.py
+0
-0
cp210x.py
test/fmcadc100m14b4cha/python/cp210x/cp210x.py
+0
-0
eeprom.py
test/fmcadc100m14b4cha/python/cp210x/eeprom.py
+0
-0
usb.py
test/fmcadc100m14b4cha/python/cp210x/usb.py
+0
-0
valuefile.py
test/fmcadc100m14b4cha/python/cp210x/valuefile.py
+0
-0
cp210x_eeprom.py
test/fmcadc100m14b4cha/python/cp210x_eeprom.py
+69
-0
cp210x_gpio.py
test/fmcadc100m14b4cha/python/cp210x_gpio.py
+0
-0
No files found.
test/fmcadc100m14b4cha/python/calibr_box.py
View file @
71ae6af7
...
...
@@ -11,7 +11,7 @@ import rr
import
time
import
os
import
cp210x
import
cp210x
_gpio
from
PAGE.Agilent33250A
import
*
from
PAGE.SineWaveform
import
*
...
...
@@ -24,7 +24,7 @@ calibr_box: Access to calibration box via USB-UART bridge CP2103
class
CCalibr_box
:
def
__init__
(
self
,
device
):
self
.
cp210x
=
cp210x
.
CCP210x
(
device
)
self
.
cp210x
=
cp210x
_gpio
.
CCP210x
(
device
)
# Select AWG as default output
self
.
cp210x
.
gpio_set
(
0x0
)
...
...
test/fmcadc100m14b4cha/python/cp210x
_eeprom
/__init__.py
→
test/fmcadc100m14b4cha/python/cp210x/__init__.py
View file @
71ae6af7
File moved
test/fmcadc100m14b4cha/python/cp210x
_eeprom
/cp210x.py
→
test/fmcadc100m14b4cha/python/cp210x/cp210x.py
View file @
71ae6af7
File moved
test/fmcadc100m14b4cha/python/cp210x
_eeprom
/eeprom.py
→
test/fmcadc100m14b4cha/python/cp210x/eeprom.py
View file @
71ae6af7
File moved
test/fmcadc100m14b4cha/python/cp210x
_eeprom
/usb.py
→
test/fmcadc100m14b4cha/python/cp210x/usb.py
View file @
71ae6af7
File moved
test/fmcadc100m14b4cha/python/cp210x
_eeprom
/valuefile.py
→
test/fmcadc100m14b4cha/python/cp210x/valuefile.py
View file @
71ae6af7
File moved
test/fmcadc100m14b4cha/python/cp210x_eeprom.py
0 → 100644
View file @
71ae6af7
#! /usr/bin/env python
# coding: utf8
# Copyright CERN, 2011
# Author: Matthieu Cattin <matthieu.cattin@cern.ch>
# Licence: GPL v2 or later.
# Website: http://www.ohwr.org
import
sys
import
rr
import
time
import
os
import
re
from
ctypes
import
*
from
ptsexcept
import
*
from
cp210x
import
usb
,
valuefile
,
cp210x
from
cp210x.eeprom
import
EEPROM
CALIBR_RANGES
=
[
'10V'
,
'1V'
,
'100mV'
]
class
CCP210x_Eeprom
:
def
__init__
(
self
,
vid
,
pid
):
usb
.
init
()
usb_patterns
=
[]
vid
=
int
(
vid
,
16
)
pid
=
int
(
pid
,
16
)
usb_patterns
.
append
(
dict
(
idVendor
=
vid
,
idProduct
=
pid
))
self
.
dev
=
[
item
for
item
in
cp210x
.
Cp210xProgrammer
.
list_devices
(
usb_patterns
)]
self
.
dev
=
self
.
dev
[
0
]
def
get_calibr_data
(
self
):
self
.
dev
.
open
()
try
:
eeprom
=
EEPROM
(
self
.
dev
)
finally
:
self
.
dev
.
close
()
eeprom_value
=
eeprom
.
get_values
()
product_string
=
eeprom_value
[
'product_string'
]
#print "Product string: \"%s\"" % product_string
calibr_string_list
=
product_string
.
split
(
' '
)
if
len
(
calibr_string_list
)
!=
3
:
raise
Exception
(
'Product string has the wrong format.'
)
calibr_data
=
{}
for
i
in
range
(
len
(
calibr_string_list
)):
pattern
=
r'\b[0-9]\.[0-9]{8}\b'
if
re
.
search
(
pattern
,
calibr_string_list
[
i
]):
calibr_data
[
CALIBR_RANGES
[
i
]]
=
calibr_string_list
[
i
]
else
:
raise
Exception
(
'Product string has the wrong format.'
)
return
calibr_data
def
set_calibr_data
(
self
,
data
):
self
.
dev
.
open
()
product_string
=
data
[
CALIBR_RANGES
[
0
]]
+
' '
+
data
[
CALIBR_RANGES
[
1
]]
+
' '
+
data
[
CALIBR_RANGES
[
2
]]
#print "New product string value: \"%s\"" % product_string
try
:
self
.
dev
.
set_product_string
(
product_string
)
print
"Calibration data written to cp210x EEPROM."
finally
:
self
.
dev
.
close
()
test/fmcadc100m14b4cha/python/cp210x.py
→
test/fmcadc100m14b4cha/python/cp210x
_gpio
.py
View file @
71ae6af7
File moved
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