forked from micropython/micropython
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests/psoc6: Added board pin allocation and skip if module unavailable.
Signed-off-by: enriquezgarc <enriquezgarcia.external@infineon.com>
- Loading branch information
1 parent
86c1f65
commit 006fa12
Showing
9 changed files
with
92 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |