-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a75a6a3
commit a5afad6
Showing
8 changed files
with
150 additions
and
25 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
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,17 +1,40 @@ | ||
from manta import Manta | ||
import socket | ||
import time | ||
def write(addrs, datas): | ||
bytes_out = b"" | ||
for addr, data in zip(addrs, datas): | ||
bytes_out += int(1).to_bytes(4, byteorder="little") | ||
bytes_out += int(addr).to_bytes(2, byteorder="little") | ||
bytes_out += int(data).to_bytes(2, byteorder="little") | ||
|
||
if __name__ == "__main__": | ||
ip_address = "192.168.0.110" | ||
udp_port = 42069 | ||
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) | ||
sock.sendto(bytes_out, (fpga_ip_addr, udp_port)) | ||
|
||
def read(addrs): | ||
bytes_out = b"" | ||
for addr in addrs: | ||
bytes_out += int(0).to_bytes(4, byteorder="little") | ||
bytes_out += int(addr).to_bytes(2, byteorder="little") | ||
bytes_out += int(0).to_bytes(2, byteorder="little") | ||
|
||
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) | ||
sock.bind((host_ip_addr, udp_port)) | ||
sock.sendto(bytes_out, (fpga_ip_addr, udp_port)) | ||
data, addr = sock.recvfrom(1024) | ||
|
||
return int.from_bytes(data, "little") | ||
|
||
if __name__ == "__main__": | ||
host_ip_addr = "192.168.0.100" | ||
fpga_ip_addr = "192.168.0.110" | ||
udp_port = 42069 | ||
|
||
for i in range(256): | ||
data = [0, 0] | ||
data = [int(d).to_bytes(4, byteorder="big") for d in data] | ||
data = b"".join(data) | ||
print(data) | ||
sock.sendto(data, (ip_address, udp_port)) | ||
# time.sleep(0.2) | ||
for i in range(2**16): | ||
write([0x0000],[0x0000]) | ||
write([0x0000],[0x0001]) | ||
write([0x0000],[0x0000]) | ||
write([0x0002],[i]) | ||
# print(read([0x0002])) | ||
# write([0x0002],[0b0101_0101_0101_0101]) | ||
# write([0x0000],[0x0000]) | ||
# write([0x0000],[0x0001]) | ||
# write([0x0000],[0x0000]) |
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from manta import Manta | ||
m = Manta("manta.yaml") | ||
|
||
print(bin(m.io_core.get_probe("sw"))) | ||
m.io_core.set_probe("led", 4) |
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 |
---|---|---|
|
@@ -17,6 +17,7 @@ def __init__(self): | |
"data": 16, | ||
"rw": 1, | ||
"valid": 1, | ||
"last": 1, | ||
} | ||
) | ||
|
||
|