Skip to content

Commit

Permalink
Fix threading lock issue
Browse files Browse the repository at this point in the history
  • Loading branch information
mtiggelman committed Aug 29, 2018
1 parent 2b818ec commit bd77c1f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# SPI Rack
The SPI Rack is a modular electronic instrumentation platform developed by QuTech. It has been developed to perform measurements on nanoelectronic devices, but is not limited to these experiments. Design priority was the minimalisation of noise and interference signals on the wires connected to the measured device (sample). To learn more about the SPI Rack, the use cases and the available modules, browse the [homepage](http://qtwork.tudelft.nl/~mtiggelman/).
The SPI Rack is a modular electronic instrumentation platform developed by QuTech. It has been developed to perform measurements on nanoelectronic devices, but is not limited to this. Design priority was the minimization of noise and interference signals on the wires connected to the measured device (sample). To learn more about the SPI Rack, use cases and the available modules, browse the [homepage](http://qtwork.tudelft.nl/~mtiggelman/).

This repository contains the Python code to interface with the hardware. All the low level communication is handled by the classes and the user is presented with an easy interface to control the modules. Here is a simple example on how to use the D5a (16 channel 18-bit DAC module) to show how easy it is to get going:

Expand Down
12 changes: 5 additions & 7 deletions spirack/spi_rack.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,9 @@ def get_temperature(self):
Returns:
Temperature (float) in Celcius
"""
with self._tlock:
s_data = bytearray([0, 0])
r_data = self.read_data(0, 1, ADT7301_MODE, ADT7301_SPEED, s_data)
t_data = (r_data[0]<<8) | r_data[1]
s_data = bytearray([0, 0])
r_data = self.read_data(0, 1, ADT7301_MODE, ADT7301_SPEED, s_data)
t_data = (r_data[0]<<8) | r_data[1]

# Check sign bit for negative value
if (t_data & 0x2000) == 0x2000:
Expand Down Expand Up @@ -188,9 +187,8 @@ def read_adc(self, channel):
Returns:
12-bit ADC data (int)
"""
with self._tlock:
s_data = bytearray([1, 160|(channel<<6), 0])
r_data = self.read_data(0, 0, MCP320x_MODE, MCP320x_SPEED, s_data)
s_data = bytearray([1, 160|(channel<<6), 0])
r_data = self.read_data(0, 0, MCP320x_MODE, MCP320x_SPEED, s_data)

return (r_data[1] & 0xf)<<8 | r_data[2]

Expand Down

0 comments on commit bd77c1f

Please sign in to comment.