Skip to content

Commit

Permalink
tests/psoc6: Adding test support for BLE board.
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 authored and jaenrig-ifx committed May 10, 2024
1 parent 1c3f76f commit 3a70d83
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
8 changes: 8 additions & 0 deletions tests/psoc6/hw_ext/spi_master.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@
mosi_master_pin = "P6_0"
miso_master_pin = "P6_1"
ssel_master_pin = "P6_3"
if "CY8CPROTO-063-BLE" in machine:
master_write_notify_pin = "P9_4" # Sends signals when master wants to write data
master_read_notify_pin = "P9_5" # interrupt pin to check if slave is writing data
# Allocate pin based on board
sck_master_pin = "P9_2"
mosi_master_pin = "P9_0"
miso_master_pin = "P9_1"
ssel_master_pin = "P9_3"


print("\n*** SPI MASTER INSTANCE ***\n")
Expand Down
21 changes: 9 additions & 12 deletions tests/psoc6/hw_ext/spi_slave.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@
miso_slave_pin = "P13_1"
ssel_slave_pin = "P13_3"

if "CY8CPROTO-063-BLE" in machine:
slave_write_notify_pin = "P9_5" # Sends signals when master wants to write data
slave_read_notify_pin = "P9_4" # interrupt pin to check if slave is writing data
# Allocate pin based on board
sck_slave_pin = "P9_2"
mosi_slave_pin = "P9_0"
miso_slave_pin = "P9_1"
ssel_slave_pin = "P9_3"

signal_received = False


Expand Down Expand Up @@ -56,17 +65,6 @@ def spi_slave_configure():
mosi=mosi_slave_pin,
miso=miso_slave_pin,
)

"""spi_obj = SPISlave(
baudrate=1000000,
polarity=0,
phase=0,
bits=8,
firstbit=SPISlave.MSB,
sck=sck_slave_pin,
mosi=mosi_slave_pin,
miso=miso_slave_pin,
)"""
return spi_obj


Expand All @@ -87,7 +85,6 @@ def spi_half_duplex_communication(spi_obj, tx, rx):
# print("\n1) master-->write and slave-->read")
_wait_for_master_signal()
spi_obj.read(rx)
print("rx: ", rx)
# print("slave read successful : ", rx==tx)
_slave_ready_to_write()
spi_obj.write(rx)
Expand Down

0 comments on commit 3a70d83

Please sign in to comment.