Skip to content

Commit af8b489

Browse files
authored
Clean up sar_adc.py by removing unused code
Removed unused imports and commented-out code related to SMU and plotting.
1 parent 055833b commit af8b489

1 file changed

Lines changed: 0 additions & 29 deletions

File tree

code/SAR_ADC/sar_adc.py

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,8 @@
33
import spidev as SPI
44
import matplotlib.pyplot as plt
55
import numpy as np
6-
from scipy import stats
7-
import sys
86
from tqdm import tqdm
97

10-
sys.path.insert(1, '/home/pi/Embedded-System-Lab/code/SMU')
11-
from smu_class import SMU
12-
13-
# voltage source with current measurement
14-
smu = SMU()
15-
cvm = smu.ch[0]
16-
cvm.enable_autorange()
17-
18-
19-
208
# SPI bus setup
219
spi = SPI.SpiDev()
2210
spi.open(0,0) # (bus, device)
@@ -32,30 +20,13 @@
3220
GPIO.setup(SAMPLE, GPIO.OUT)
3321
GPIO.output(SAMPLE, GPIO.LOW) # open switch
3422

35-
36-
3723
cvm.set_voltage(1500) # mV units
3824

3925
def write_dac(value):
4026
spi.xfer([value]) # write DAC register
4127

4228

4329

44-
45-
# # prepare plots for Exercise 4
46-
# adc_hist = [10,8,10,12]
47-
# bin_edges = [1,2,3,4,5]
48-
# lower_bound = 2
49-
# upper_bound = 4
50-
# figure, plot = plt.subplots(1, 1)
51-
# plot.stairs(adc_hist, bin_edges, fill=True)
52-
# plot.set_xticks(range(0, 260, 32))
53-
# plot.set_ylabel("Counts")
54-
# plot.axvline(x=lower_bound, color='red', linestyle='--')
55-
# plot.axvline(x=upper_bound, color='red', linestyle='--')
56-
57-
# plt.show()
58-
5930
GPIO.cleanup()
6031

6132

0 commit comments

Comments
 (0)