File tree Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -211,7 +211,17 @@ def current(self):
211
211
212
212
@current .setter
213
213
def current (self , value : float ):
214
- raw = 0 if value == 0 else self .unscale (value )
215
- raw = int (np .clip (raw , 0 , self ._RESOLUTION ))
216
- self ._multi_write (raw )
217
- self ._current = self .scale (raw )
214
+ # Output current is a function of the voltage set on the MCP4728's V+
215
+ # pin (assuming negligible load resistance):
216
+ # I(V) = 3.3e-3 - V / 1000
217
+ # I.e. the lower the voltage the higher the current. However, the
218
+ # function is discontinuous in V = 0:
219
+ # I(0) = 0
220
+ if value == 0 :
221
+ self ._multi_write (0 )
222
+ self ._current = 0
223
+ else :
224
+ raw = self .unscale (value )
225
+ raw = int (np .clip (raw , 0 , self ._RESOLUTION ))
226
+ self ._multi_write (raw )
227
+ self ._current = self .scale (raw )
You can’t perform that action at this time.
0 commit comments