From 1c7ed6f2164dc1d9e34ed72f18714201a026cfb9 Mon Sep 17 00:00:00 2001 From: enriquezgarc Date: Thu, 27 Feb 2025 10:47:29 +0100 Subject: [PATCH 1/3] tools/psoc6/get-devs.py: Fixed literals comparison rule. Signed-off-by: enriquezgarc --- tools/psoc6/get-devs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/psoc6/get-devs.py b/tools/psoc6/get-devs.py index 93564efcffb72..5097d44c473b5 100644 --- a/tools/psoc6/get-devs.py +++ b/tools/psoc6/get-devs.py @@ -74,7 +74,7 @@ def get_kitprog_serial_number(udevadm_output_lines): kitprog_devs = [] dev_list = get_ttyACM_dev_list() - if dev_list is not []: + if dev_list != []: for dev in dev_list: udevadm_output_lines = get_udevadm_port_attrs_output(dev) if is_kitprog_device(udevadm_output_lines): From df1f0824f15fdd7921321d575866c269abff8fc1 Mon Sep 17 00:00:00 2001 From: enriquezgarc Date: Thu, 27 Feb 2025 14:57:48 +0100 Subject: [PATCH 2/3] tools/psoc6/wsl-usb.py: Fixed ruff formatting rules. Signed-off-by: enriquezgarc --- tools/psoc6/wsl-usb.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/psoc6/wsl-usb.py b/tools/psoc6/wsl-usb.py index e145e02653f39..7c932ec627b8a 100644 --- a/tools/psoc6/wsl-usb.py +++ b/tools/psoc6/wsl-usb.py @@ -1,5 +1,5 @@ """ -Use this script to avoid attaching manually usb devices +Use this script to avoid attaching manually usb devices to the WSL Ubuntu instance. 1. Copy this script somewhere in the Windows filesystem @@ -8,6 +8,7 @@ 2. Use the Power Shell with admin rights 3. Use -h, --help flags to find out the available commands and options. """ + import argparse, subprocess version = "1.0.0" From 132cd859b58fa2df5b6593f544a1315dab81265d Mon Sep 17 00:00:00 2001 From: enriquezgarc Date: Thu, 27 Feb 2025 14:58:47 +0100 Subject: [PATCH 3/3] tests/ports/psoc6: Fixed ruff code format rules. Signed-off-by: enriquezgarc --- .../ports/psoc6/board_ext_hw/multi/i2s_rx.py | 2 +- tests/ports/psoc6/board_ext_hw/single/adc.py | 20 ++++++++++--------- tests/ports/psoc6/board_ext_hw/single/i2c.py | 4 ++-- tests/ports/psoc6/board_ext_hw/single/pwm.py | 1 + 4 files changed, 15 insertions(+), 12 deletions(-) diff --git a/tests/ports/psoc6/board_ext_hw/multi/i2s_rx.py b/tests/ports/psoc6/board_ext_hw/multi/i2s_rx.py index 4a163356a6046..7c8d30b3d8f57 100644 --- a/tests/ports/psoc6/board_ext_hw/multi/i2s_rx.py +++ b/tests/ports/psoc6/board_ext_hw/multi/i2s_rx.py @@ -192,7 +192,7 @@ def rx_complete_irq(obj): ############################################################################### print("\n3. shift ") -buf = bytearray(b"\xFF\xFF\xFF\xFF") +buf = bytearray(b"\xff\xff\xff\xff") I2S.shift(buf=buf, bits=16, shift=3) print(binascii.hexlify(buf)) I2S.shift(buf=buf, bits=16, shift=-3) diff --git a/tests/ports/psoc6/board_ext_hw/single/adc.py b/tests/ports/psoc6/board_ext_hw/single/adc.py index c30ecface7442..5aba86ee9fd49 100644 --- a/tests/ports/psoc6/board_ext_hw/single/adc.py +++ b/tests/ports/psoc6/board_ext_hw/single/adc.py @@ -1,14 +1,16 @@ ### ADC Functional test -""" Setup description: - Construct a basic voltage divider with 120 ohms each resistor. Supply the ends with 3.3V and GND. - Available voltage values are then - 3.3V, ~1.7V, 0V. - Pin connections: - Voltage Divider circuit On Target Board - 3.3V end adc_pin_max - Mid point adc_pin_mid - GND end adc_pin_gnd - *Known issue: When connected to GND, you may not get exact 0V and this may vary board to board. + +"""Setup description: +Construct a basic voltage divider with 120 ohms each resistor. Supply the ends with 3.3V and GND. +Available voltage values are then - 3.3V, ~1.7V, 0V. +Pin connections: +Voltage Divider circuit On Target Board + 3.3V end adc_pin_max + Mid point adc_pin_mid + GND end adc_pin_gnd +*Known issue: When connected to GND, you may not get exact 0V and this may vary board to board. """ + import os import time from machine import ADC, ADCBlock diff --git a/tests/ports/psoc6/board_ext_hw/single/i2c.py b/tests/ports/psoc6/board_ext_hw/single/i2c.py index 83e8123782ba9..511ff4d27c1b4 100644 --- a/tests/ports/psoc6/board_ext_hw/single/i2c.py +++ b/tests/ports/psoc6/board_ext_hw/single/i2c.py @@ -112,14 +112,14 @@ def i2c_tests(i2c_master): i2c_slave_rcv_buf = bytearray(8) i2c_slave.conf_receive_buffer(i2c_slave_rcv_buf) - master_write_data = [b"\x01\x44\x55\x23", b"\x98\x03\x44\xEE"] + master_write_data = [b"\x01\x44\x55\x23", b"\x98\x03\x44\xee"] i2c_master.writevto(slave_addr, master_write_data) time.sleep_ms(100) print( "master writevto() and received by slave: ", - i2c_slave_rcv_buf == b"\x01\x44\x55\x23\x98\x03\x44\xEE", + i2c_slave_rcv_buf == b"\x01\x44\x55\x23\x98\x03\x44\xee", ) # 4. Master to slave read diff --git a/tests/ports/psoc6/board_ext_hw/single/pwm.py b/tests/ports/psoc6/board_ext_hw/single/pwm.py index e2e7e8e59fb42..1b788a4ebdd40 100644 --- a/tests/ports/psoc6/board_ext_hw/single/pwm.py +++ b/tests/ports/psoc6/board_ext_hw/single/pwm.py @@ -2,6 +2,7 @@ """ Setup: Connect pwm_pin to pin_in """ + from machine import PWM, Pin import os import time