Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
ModuleIT-M5Stack
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Operate
Terraform modules
Analyze
Contributor analytics
Repository analytics
Help
Help
Support
GitLab documentation
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Privacy
Imprint
Contact
Snippets
Groups
Projects
Show more breadcrumbs
Abdulrahman Othman
ModuleIT-M5Stack
Compare revisions
6d13731ab8db08795862194839ea8c56e34c321e to ce55e9eb08012cfa6c0e23d66fb40ded2b8e9f90
Compare revisions
Changes are shown as if the
source
revision was being merged into the
target
revision.
Learn more about comparing revisions.
Source
aoth93/moduleit-m5stack
Select target project
No results found
ce55e9eb08012cfa6c0e23d66fb40ded2b8e9f90
Select Git revision
Branches
master
Swap
Target
aoth93/moduleit-m5stack
Select target project
aoth93/moduleit-m5stack
1 result
6d13731ab8db08795862194839ea8c56e34c321e
Select Git revision
Branches
master
Show changes
Only incoming changes from source
Include changes to target since source was created
Compare
Commits on Source (3)
removed unused modul
· 33e79f91
Abdulrahman Othman
authored
1 year ago
33e79f91
Merge branch 'master' of git.thm.de:aoth93/moduleit-m5stack
· 44facdda
Abdulrahman Othman
authored
1 year ago
44facdda
reader comments
· ce55e9eb
Abdulrahman Othman
authored
1 year ago
ce55e9eb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
project/reader.py
+27
-3
27 additions, 3 deletions
project/reader.py
with
27 additions
and
3 deletions
project/reader.py
View file @
ce55e9eb
'''
| Project: Moduleit-M5Stack
| File: reader.py
| Author: Abdulrahman Othman
| Created: 01.08.2023
| Last Modified: 03.02.2024
'''
from
machine
import
UART
,
Pin
from
time
import
sleep
,
sleep_ms
from
time
import
sleep_ms
'''
'
M5Stack Commands
'''
M5C
=
{
"
hardware_version
"
:
[
0xBB
,
0x00
,
0x03
,
0x00
,
0x01
,
0x00
,
0x04
,
0x7E
],
"
start_multi_plling
"
:
[
0xBB
,
0x00
,
0x27
,
0x00
,
0x03
,
0x22
,
0x27
,
0x10
,
0x83
,
0x7E
],
"
start_single_polling
"
:
[
0xBB
,
0x00
,
0x22
,
0x00
,
0x00
,
0x22
,
0x7E
],
"
stop_multid_polling
"
:
[
0xBB
,
0x00
,
0x28
,
0x00
,
0x00
,
0x28
,
0x7E
]
}
'''
'
Reader Class to run M5Stack
'''
class
Reader
:
'''
'
In Constructor only object instance of UART Protocol
'''
def
__init__
(
self
,
baudrate
:
int
,
tx_pin
:
int
,
rx_pin
:
int
):
self
.
__uart
=
UART
(
0
,
baudrate
=
baudrate
,
tx
=
Pin
(
tx_pin
),
rx
=
Pin
(
rx_pin
))
self
.
init_reader
()
'''
'
Send command to read tags
'''
def
_send_command
(
self
,
command
:
list
):
self
.
__uart
.
write
(
bytearray
(
command
))
sleep_ms
(
50
)
# Allow time for the command to be processed
'''
'
Init function to check reader functionality
'''
def
init_reader
(
self
):
self
.
_send_command
(
M5C
[
'
hardware_version
'
])
response
=
self
.
__uart
.
read
()
...
...
@@ -25,7 +47,9 @@ class Reader:
else
:
return
"
Init Error => {}
"
.
format
(
response
)
'''
'
catch epc
'
s once avalible reader functionality
'''
def
read_epc
(
self
):
if
self
.
__uart
.
any
():
resp
=
self
.
__uart
.
read
()
...
...
This diff is collapsed.
Click to expand it.