Max31865 is ATemperatureSensor
git-svn-id: http://moon:8086/svn/projects/HendiControl@195 fda53097-d464-4ada-af97-ba876c37ca34
This commit is contained in:
@@ -1,10 +1,13 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python3
|
||||||
|
|
||||||
import spidev
|
import spidev
|
||||||
|
from atemperatureSensor import ATemperatureSensor
|
||||||
|
|
||||||
|
|
||||||
class Max31865():
|
class Max31865(ATemperatureSensor):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
super(Max31865, self).__init__('Max31865')
|
||||||
|
|
||||||
# Open SPI bus
|
# Open SPI bus
|
||||||
self.spi = spidev.SpiDev()
|
self.spi = spidev.SpiDev()
|
||||||
self.spi.open(0, 0)
|
self.spi.open(0, 0)
|
||||||
@@ -28,7 +31,7 @@ class Max31865():
|
|||||||
|
|
||||||
return digits
|
return digits
|
||||||
|
|
||||||
def getTemperature(self):
|
def temperature(self):
|
||||||
digits = self.read_digits()
|
digits = self.read_digits()
|
||||||
R = Max31865.calc_R(430, digits)
|
R = Max31865.calc_R(430, digits)
|
||||||
T = Max31865.vanDusen_temp(R) + self.temp_correction
|
T = Max31865.vanDusen_temp(R) + self.temp_correction
|
||||||
|
|||||||
Reference in New Issue
Block a user