Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
micropython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
micropython
Commits
067c7cd9
Commit
067c7cd9
authored
Mar 09, 2023
by
Damien George
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
stm32/pin: Make pin_find debug output use mp_printf.
Signed-off-by:
Damien George
<
damien@micropython.org
>
parent
f43c4dfc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
18 deletions
+16
-18
ports/stm32/pin.c
ports/stm32/pin.c
+16
-18
No files found.
ports/stm32/pin.c
View file @
067c7cd9
...
...
@@ -24,10 +24,6 @@
* THE SOFTWARE.
*/
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include "py/runtime.h"
#include "py/mphal.h"
#include "extmod/virtpin.h"
...
...
@@ -102,15 +98,17 @@ void pin_init0(void) {
// C API used to convert a user-supplied pin name into an ordinal pin number.
const
pin_obj_t
*
pin_find
(
mp_obj_t
user_obj
)
{
const
mp_print_t
*
print
=
&
mp_plat_print
;
const
pin_obj_t
*
pin_obj
;
// If a pin was provided, then use it
if
(
mp_obj_is_type
(
user_obj
,
&
pin_type
))
{
pin_obj
=
MP_OBJ_TO_PTR
(
user_obj
);
if
(
pin_class_debug
)
{
printf
(
"Pin map passed pin "
);
mp_printf
(
print
,
"Pin map passed pin "
);
mp_obj_print
(
MP_OBJ_FROM_PTR
(
pin_obj
),
PRINT_STR
);
printf
(
"
\n
"
);
mp_printf
(
print
,
"
\n
"
);
}
return
pin_obj
;
}
...
...
@@ -122,11 +120,11 @@ const pin_obj_t *pin_find(mp_obj_t user_obj) {
mp_raise_ValueError
(
MP_ERROR_TEXT
(
"Pin.mapper didn't return a Pin object"
));
}
if
(
pin_class_debug
)
{
printf
(
"Pin.mapper maps "
);
mp_printf
(
print
,
"Pin.mapper maps "
);
mp_obj_print
(
user_obj
,
PRINT_REPR
);
printf
(
" to "
);
mp_printf
(
print
,
" to "
);
mp_obj_print
(
o
,
PRINT_STR
);
printf
(
"
\n
"
);
mp_printf
(
print
,
"
\n
"
);
}
return
MP_OBJ_TO_PTR
(
o
);
}
...
...
@@ -140,11 +138,11 @@ const pin_obj_t *pin_find(mp_obj_t user_obj) {
if
(
elem
!=
NULL
&&
elem
->
value
!=
MP_OBJ_NULL
)
{
mp_obj_t
o
=
elem
->
value
;
if
(
pin_class_debug
)
{
printf
(
"Pin.map_dict maps "
);
mp_printf
(
print
,
"Pin.map_dict maps "
);
mp_obj_print
(
user_obj
,
PRINT_REPR
);
printf
(
" to "
);
mp_printf
(
print
,
" to "
);
mp_obj_print
(
o
,
PRINT_STR
);
printf
(
"
\n
"
);
mp_printf
(
print
,
"
\n
"
);
}
return
MP_OBJ_TO_PTR
(
o
);
}
...
...
@@ -154,11 +152,11 @@ const pin_obj_t *pin_find(mp_obj_t user_obj) {
pin_obj
=
pin_find_named_pin
(
&
pin_board_pins_locals_dict
,
user_obj
);
if
(
pin_obj
)
{
if
(
pin_class_debug
)
{
printf
(
"Pin.board maps "
);
mp_printf
(
print
,
"Pin.board maps "
);
mp_obj_print
(
user_obj
,
PRINT_REPR
);
printf
(
" to "
);
mp_printf
(
print
,
" to "
);
mp_obj_print
(
MP_OBJ_FROM_PTR
(
pin_obj
),
PRINT_STR
);
printf
(
"
\n
"
);
mp_printf
(
print
,
"
\n
"
);
}
return
pin_obj
;
}
...
...
@@ -167,11 +165,11 @@ const pin_obj_t *pin_find(mp_obj_t user_obj) {
pin_obj
=
pin_find_named_pin
(
&
pin_cpu_pins_locals_dict
,
user_obj
);
if
(
pin_obj
)
{
if
(
pin_class_debug
)
{
printf
(
"Pin.cpu maps "
);
mp_printf
(
print
,
"Pin.cpu maps "
);
mp_obj_print
(
user_obj
,
PRINT_REPR
);
printf
(
" to "
);
mp_printf
(
print
,
" to "
);
mp_obj_print
(
MP_OBJ_FROM_PTR
(
pin_obj
),
PRINT_STR
);
printf
(
"
\n
"
);
mp_printf
(
print
,
"
\n
"
);
}
return
pin_obj
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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