Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi bsp test #89

Merged
merged 3 commits into from
Sep 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .github/workflows/ports_psoc6.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,14 @@ jobs:
source tools/ci.sh && ci_psoc6_flash_multiple_devices ${{ matrix.board }} firmware.hex tools/psoc6/${{ runner.name }}-devs.yml
- name: Run psoc6 multi test
run: |
devs=($(python tools/psoc6/get-devs.py port -b ${{ matrix.board }} -y tools/psoc6/${{ runner.name }}-devs.yml))
cd tests
./psoc6/run_psoc6_tests.sh --psoc6-multi
./psoc6/run_psoc6_tests.sh --psoc6-multi --dev0 ${devs[0]} --dev1 ${devs[1]}
- name: Run psoc6 tests
run: |
devs=($(python tools/psoc6/get-devs.py port -b ${{ matrix.board }} -y tools/psoc6/${{ runner.name }}-devs.yml))
cd tests
./psoc6/run_psoc6_tests.sh --psoc6
./psoc6/run_psoc6_tests.sh --psoc6 --dev0 ${devs[0]}
# TODO: Enable when HIL is updgraded
# - name: Run all implemented tests
# if: github.event_name == 'pull_request'
Expand Down
14 changes: 12 additions & 2 deletions tests/psoc6/adc.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,20 @@
ADC test for the PSoC6 port.
"""

import os
from machine import ADC, Pin

adc_pin = Pin("P10_0")
adc_wrong_pin = Pin("P13_7")
# Allocate pin based on board
machine = os.uname().machine
if "CY8CPROTO-062-4343W" in machine:
adc_pin_name = "P10_0"
adc_wrong_pin_name = "P13_7"
elif "CY8CPROTO-063-BLE" in machine:
print("SKIP")
raise SystemExit

adc_pin = Pin(adc_pin_name)
adc_wrong_pin = Pin(adc_wrong_pin_name)

# Exceptions should be raised
try:
Expand Down
11 changes: 10 additions & 1 deletion tests/psoc6/adcblock.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
"""
ADCBlock test for the PSoC6 port.
"""
import os
from machine import Pin, ADCBlock

pin = Pin("P10_3")
# Allocate pin based on board
machine = os.uname().machine
if "CY8CPROTO-062-4343W" in machine:
pin_name = "P10_3"
elif "CY8CPROTO-063-BLE" in machine:
print("SKIP")
raise SystemExit

pin = Pin(pin_name)

# Negative tests
try:
Expand Down
12 changes: 11 additions & 1 deletion tests/psoc6/i2c_hard.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
### I2C
import os
from machine import I2C

i2c = I2C(id=0, scl="P6_0", sda="P6_1", freq=400000)
# Allocate pin based on board
machine = os.uname().machine
if "CY8CPROTO-062-4343W" in machine:
scl_pin = "P6_0"
sda_pin = "P6_1"
elif "CY8CPROTO-063-BLE" in machine:
print("SKIP")
raise SystemExit

i2c = I2C(id=0, scl=scl_pin, sda=sda_pin, freq=400000)
print(i2c)

print(i2c.scan())
12 changes: 11 additions & 1 deletion tests/psoc6/i2c_soft.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
#### SoftI2C
import os
from machine import SoftI2C

si2c = SoftI2C(scl="P6_0", sda="P6_1", freq=400000)
# Allocate pin based on board
machine = os.uname().machine
if "CY8CPROTO-062-4343W" in machine:
scl_pin = "P6_0"
sda_pin = "P6_1"
elif "CY8CPROTO-063-BLE" in machine:
print("SKIP")
raise SystemExit

si2c = SoftI2C(scl=scl_pin, sda=sda_pin, freq=400000)
print(si2c)

print(si2c.scan())
8 changes: 7 additions & 1 deletion tests/psoc6/multi/network.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
import binascii, network, time
import binascii, time

try:
import network
except ImportError:
print("SKIP")
raise SystemExit

channel_default = 9
channel_new = 5
Expand Down
8 changes: 7 additions & 1 deletion tests/psoc6/multi/network_config.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
import binascii, network, time
import binascii, time

try:
import network
except ImportError:
print("SKIP")
raise SystemExit

channel_new = 5
ssid_new = "mpy-test-conf-wlan"
Expand Down
14 changes: 12 additions & 2 deletions tests/psoc6/pin.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
import os
from machine import Pin
import time
import machine

# Allocate pin based on board
machine = os.uname().machine
if "CY8CPROTO-062-4343W" in machine:
pin1_name = "P13_7"
pin2_name = "P0_4"
elif "CY8CPROTO-063-BLE" in machine:
print("SKIP")
raise SystemExit

# Tests for Output pin
# Instantiate output pin for led operation
# Constr
p1 = Pin("P13_7")
p1 = Pin(pin1_name)
p1.init(Pin.OUT)
print(p1) # Pin:111 or P13_7, Mode=OUT, Pull=None, Value=1

Expand All @@ -20,7 +30,7 @@

# Tests for Input pin
# Instantiate input pin for button operation
p2 = Pin("P0_4", Pin.IN)
p2 = Pin(pin2_name, Pin.IN)
print(p2) # Pin:4 or P0_4, Mode=IN, Pull=None, Value=1
p2.value()
print(p2.value()) # 1 - button is released
11 changes: 10 additions & 1 deletion tests/psoc6/pwm.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
### PWM
import os
from machine import PWM

pwm = PWM("P12_0", freq=50, duty_u16=8192, invert=0)
# Allocate pin based on board
machine = os.uname().machine
if "CY8CPROTO-062-4343W" in machine:
pin_name = "P12_0"
elif "CY8CPROTO-063-BLE" in machine:
print("SKIP")
raise SystemExit

pwm = PWM(pin_name, freq=50, duty_u16=8192, invert=0)
print(pwm)
print(pwm.freq())
print(pwm.duty_u16())
Expand Down
13 changes: 12 additions & 1 deletion tests/psoc6/spi_soft.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
#### SoftSPI
import os
from machine import SoftSPI

spi = SoftSPI(baudrate=100000, polarity=1, phase=0, sck="P9_2", mosi="P9_0", miso="P9_1")
# Allocate pin based on board
machine = os.uname().machine
if "CY8CPROTO-062-4343W" in machine:
sck_pin = "P9_2"
mosi_pin = "P9_0"
miso_pin = "P9_1"
elif "CY8CPROTO-063-BLE" in machine:
print("SKIP")
raise SystemExit

spi = SoftSPI(baudrate=100000, polarity=1, phase=0, sck=sck_pin, mosi=mosi_pin, miso=miso_pin)
print(spi)
spi.init(baudrate=200000)
print(spi)
4 changes: 0 additions & 4 deletions tools/psoc6/get-devs.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,6 @@ def get_devices_port(board=None, devs_yml=None):
return port_list


if __name__ == "__main__":
pass


def parser():
def main_parser_func(args):
parser.print_help()
Expand Down
Loading