@@ -17,35 +17,37 @@ def __init__(self, uri=""):
1717 self ._ctrl = self ._ctx .find_device (self ._device_name )
1818
1919 if not self ._ctrl :
20- raise Exception ("ADT7420 device not found" )
21- # STARTS HERE
20+ raise Exception ("ADT7420 device not found" )
21+
2222 self .channel = []
2323 self ._rx_channel_names = []
2424
2525 for ch in self ._ctrl .channels :
26- name = ch ._id # or ch._id depending on backend, usually it's just .id
26+ name = ch ._id
2727
2828 self ._rx_channel_names .append (name )
2929 self .channel .append (name )
3030
3131 if name == "temp" :
32- # no-OS driver
33- setattr (self , name , self .channel_temp_noos (self ._ctrl , name ))
32+ # no-OS
33+ setattr (self , name , self .channel_temp (self ._ctrl , name ))
34+ self .temp = self .channel_temp (self ._ctrl , "temp" )
3435 elif name == "temp1" :
35- # Linux driver
36- setattr (self , name , self .channel_temp_linux (self ._ctrl , name ))
36+ # Linux
37+ setattr (self , name , self .channel_temp1 (self ._ctrl , name ))
38+ self .temp = self .channel_temp1 (self ._ctrl , "temp1" )
3739 else :
3840 raise Exception (f"Unsupported: { name } " )
3941
40- class channel_temp_noos (attribute ):
42+ class channel_temp (attribute ):
4143 """Channel for no-OS driver"""
4244
4345 def __init__ (self , ctrl , channel_name ):
4446 self ._ctrl = ctrl
4547 self .name = channel_name
4648
4749 @property
48- def temp (self ):
50+ def temp_val (self ):
4951 """ Read temperature value """
5052 return self ._get_iio_attr (self .name , "temp" , False )
5153
@@ -81,15 +83,15 @@ def temp_hyst(self):
8183 def temp_hyst (self , value ):
8284 return self ._set_iio_attr (self .name , "temp_hyst" , False , value )
8385
84- class channel_temp_linux (attribute ):
86+ class channel_temp1 (attribute ):
8587 """Channel for Linux driver"""
8688
8789 def __init__ (self , ctrl , channel_name ):
8890 self ._ctrl = ctrl
8991 self .name = channel_name
9092
9193 @property
92- def temp (self ):
94+ def temp_val (self ):
9395 return self ._get_iio_attr (self .name , "input" , False )
9496
9597 @property
@@ -118,8 +120,8 @@ def temp_crit(self, value):
118120
119121 @property
120122 def temp_hyst (self ):
121- return self ._get_iio_attr (self .name , "crit_hyst " , False )
123+ return self ._get_iio_attr (self .name , "max_hyst " , False )
122124
123125 @temp_hyst .setter
124126 def temp_hyst (self , value ):
125- return self ._set_iio_attr (self .name , "crit_hyst " , False , value )
127+ return self ._set_iio_attr (self .name , "max_hyst " , False , value )
0 commit comments