Skip to content

Commit

Permalink
tests/psoc6: Making tests to work right.
Browse files Browse the repository at this point in the history
Signed-off-by: NikhitaR-IFX <Nikhita.Rajasekhar@infineon.com>
  • Loading branch information
NikhitaR-IFX committed Jul 12, 2023
1 parent a903b12 commit 48ae0ad
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 13 deletions.
15 changes: 6 additions & 9 deletions tests/psoc6/adc.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,14 @@
adc_pin = Pin("P10_0")
adc_wrong_pin = Pin("P13_7")

adc = ADC(adc_pin)
print(adc)

adc = ADC(adc_pin, sample_ns=1200)
print(adc)

print(adc.read_uv() > 0)
print(adc.read_u16() > 0)

# Exceptions should be raised
try:
adc = ADC(adc_wrong_pin)
except:
print("Invalid ADC Pin")

adc = ADC(adc_pin, sample_ns=1000)
print(adc)

print(adc.read_u16() > 0)
print(adc.read_uv() > 0)
5 changes: 2 additions & 3 deletions tests/psoc6/adc.py.exp
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
Invalid ADC Pin
<ADC Pin=80, Channel=0, sampling_time_ns=1000>
<ADC Pin=80, Channel=0, sampling_time_ns=1200>
False
True
Invalid ADC Pin
True
2 changes: 1 addition & 1 deletion tests/psoc6/adcblock.py.exp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
TypeError: Specified ADC id not supported. Currently only block 0 is configured!
TypeError: Invalid bits. Current ADC configuration supports only 12 bits resolution!
TypeError: Wrong pin specified for the mentioned channel
False
True

0 comments on commit 48ae0ad

Please sign in to comment.