Skip to content

Commit 0095961

Browse files
committed
Fixed SAR weighting configuration
1 parent 6a0e4ff commit 0095961

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

adc_eval/adcs/sar.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ def __init__(self, nbits=8, fs=1, vref=1, seed=1, **kwargs):
6262
self._comp_noise = 0
6363

6464
# Get keyword arguments
65-
self._weights = kwargs.get("weights", None)
65+
self._weights = None
66+
self.weights = kwargs.get("weights", self.weights)
6667

6768
@property
6869
def weights(self):
@@ -75,6 +76,7 @@ def weights(self):
7576
def weights(self, values):
7677
"""Sets the capacitor unit weights."""
7778
self._weights = np.array(values)
79+
self.dbits = np.zeros(len(values))
7880
if self._weights.size < self.nbits:
7981
print(
8082
f"WARNING: Capacitor weight array size is {self._weights.size} for {self.nbits}-bit ADC."

0 commit comments

Comments
 (0)