Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Ján Labuda
FPGA - UART
Commits
b45434e3
Commit
b45434e3
authored
Dec 10, 2021
by
Ján Labuda
Browse files
feat: script for communication
parent
78977b04
Changes
2
Hide whitespace changes
Inline
Side-by-side
.gitignore
View file @
b45434e3
...
...
@@ -58,3 +58,6 @@
!*.tcl
# End of https://www.toptal.com/developers/gitignore/api/alteraquartusii
# scripts
!*.py
uart.py
0 → 100644
View file @
b45434e3
import
serial
import
serial.tools.list_ports
as
ports
def
sendAF
(
port
):
ser
=
serial
.
Serial
(
port
,
115200
)
num
=
0xAF
packet
=
bytearray
([
num
])
ser
.
write
(
packet
)
ser
.
close
()
def
readBlock
(
port
,
n
):
ser
=
serial
.
Serial
(
port
,
115200
)
for
_
in
range
(
n
):
num
=
ser
.
read
()
print
(
num
.
hex
())
ser
.
close
()
if
__name__
==
'__main__'
:
print
(
list
(
map
(
lambda
x
:
x
.
device
,
ports
.
comports
())))
#sendAF('COM3')
readBlock
(
'COM3'
,
5
)
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment