Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
micropython
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
card10
micropython
Commits
baafb290
Commit
baafb290
authored
10 years ago
by
Damien George
Browse files
Options
Downloads
Patches
Plain Diff
stmhal: Add uart.sendbreak() method, to send a break condition.
parent
089c3f32
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
docs/library/pyb.UART.rst
+6
-0
6 additions, 0 deletions
docs/library/pyb.UART.rst
stmhal/qstrdefsport.h
+1
-0
1 addition, 0 deletions
stmhal/qstrdefsport.h
stmhal/uart.c
+9
-0
9 additions, 0 deletions
stmhal/uart.c
tests/pyb/uart.py
+3
-0
3 additions, 0 deletions
tests/pyb/uart.py
with
19 additions
and
0 deletions
docs/library/pyb.UART.rst
+
6
−
0
View file @
baafb290
...
@@ -134,3 +134,9 @@ Methods
...
@@ -134,3 +134,9 @@ Methods
Write a single character on the bus. ``char`` is an integer to write.
Write a single character on the bus. ``char`` is an integer to write.
Return value: ``None``.
Return value: ``None``.
.. method:: uart.sendbreak()
Send a break condition on the bus. This drives the bus low for a duration
of 13 bits.
Return value: ``None``.
This diff is collapsed.
Click to expand it.
stmhal/qstrdefsport.h
+
1
−
0
View file @
baafb290
...
@@ -186,6 +186,7 @@ Q(any)
...
@@ -186,6 +186,7 @@ Q(any)
Q
(
writechar
)
Q
(
writechar
)
Q
(
readchar
)
Q
(
readchar
)
Q
(
readinto
)
Q
(
readinto
)
Q
(
sendbreak
)
Q
(
RTS
)
Q
(
RTS
)
Q
(
CTS
)
Q
(
CTS
)
...
...
This diff is collapsed.
Click to expand it.
stmhal/uart.c
+
9
−
0
View file @
baafb290
...
@@ -614,6 +614,14 @@ STATIC mp_obj_t pyb_uart_readchar(mp_obj_t self_in) {
...
@@ -614,6 +614,14 @@ STATIC mp_obj_t pyb_uart_readchar(mp_obj_t self_in) {
}
}
STATIC
MP_DEFINE_CONST_FUN_OBJ_1
(
pyb_uart_readchar_obj
,
pyb_uart_readchar
);
STATIC
MP_DEFINE_CONST_FUN_OBJ_1
(
pyb_uart_readchar_obj
,
pyb_uart_readchar
);
// uart.sendbreak()
STATIC
mp_obj_t
pyb_uart_sendbreak
(
mp_obj_t
self_in
)
{
pyb_uart_obj_t
*
self
=
self_in
;
self
->
uart
.
Instance
->
CR1
|=
USART_CR1_SBK
;
return
mp_const_none
;
}
STATIC
MP_DEFINE_CONST_FUN_OBJ_1
(
pyb_uart_sendbreak_obj
,
pyb_uart_sendbreak
);
STATIC
const
mp_map_elem_t
pyb_uart_locals_dict_table
[]
=
{
STATIC
const
mp_map_elem_t
pyb_uart_locals_dict_table
[]
=
{
// instance methods
// instance methods
...
@@ -634,6 +642,7 @@ STATIC const mp_map_elem_t pyb_uart_locals_dict_table[] = {
...
@@ -634,6 +642,7 @@ STATIC const mp_map_elem_t pyb_uart_locals_dict_table[] = {
{
MP_OBJ_NEW_QSTR
(
MP_QSTR_writechar
),
(
mp_obj_t
)
&
pyb_uart_writechar_obj
},
{
MP_OBJ_NEW_QSTR
(
MP_QSTR_writechar
),
(
mp_obj_t
)
&
pyb_uart_writechar_obj
},
{
MP_OBJ_NEW_QSTR
(
MP_QSTR_readchar
),
(
mp_obj_t
)
&
pyb_uart_readchar_obj
},
{
MP_OBJ_NEW_QSTR
(
MP_QSTR_readchar
),
(
mp_obj_t
)
&
pyb_uart_readchar_obj
},
{
MP_OBJ_NEW_QSTR
(
MP_QSTR_sendbreak
),
(
mp_obj_t
)
&
pyb_uart_sendbreak_obj
},
// class constants
// class constants
{
MP_OBJ_NEW_QSTR
(
MP_QSTR_RTS
),
MP_OBJ_NEW_SMALL_INT
(
UART_HWCONTROL_RTS
)
},
{
MP_OBJ_NEW_QSTR
(
MP_QSTR_RTS
),
MP_OBJ_NEW_SMALL_INT
(
UART_HWCONTROL_RTS
)
},
...
...
This diff is collapsed.
Click to expand it.
tests/pyb/uart.py
+
3
−
0
View file @
baafb290
...
@@ -12,3 +12,6 @@ print(uart.any())
...
@@ -12,3 +12,6 @@ print(uart.any())
print
(
uart
.
write
(
'
123
'
))
print
(
uart
.
write
(
'
123
'
))
print
(
uart
.
write
(
b
'
abcd
'
))
print
(
uart
.
write
(
b
'
abcd
'
))
print
(
uart
.
writechar
(
1
))
print
(
uart
.
writechar
(
1
))
# make sure this method exists
uart
.
sendbreak
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment