Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
uPython-mirror
Commits
7a6dbaa8
Commit
7a6dbaa8
authored
Apr 11, 2015
by
Damien George
Browse files
stmhal: Make LED object print LED(x) for consistency with constructor.
parent
b1bbe966
Changes
2
Hide whitespace changes
Inline
Side-by-side
stmhal/led.c
View file @
7a6dbaa8
...
...
@@ -212,7 +212,7 @@ void led_debug(int n, int delay) {
void
led_obj_print
(
void
(
*
print
)(
void
*
env
,
const
char
*
fmt
,
...),
void
*
env
,
mp_obj_t
self_in
,
mp_print_kind_t
kind
)
{
pyb_led_obj_t
*
self
=
self_in
;
print
(
env
,
"
<
LED
%lu
>
"
,
self
->
led_id
);
print
(
env
,
"LED
(
%lu
)
"
,
self
->
led_id
);
}
/// \classmethod \constructor(id)
...
...
@@ -228,7 +228,7 @@ STATIC mp_obj_t led_obj_make_new(mp_obj_t type_in, mp_uint_t n_args, mp_uint_t n
// check led number
if
(
!
(
1
<=
led_id
&&
led_id
<=
NUM_LEDS
))
{
nlr_raise
(
mp_obj_new_exception_msg_varg
(
&
mp_type_ValueError
,
"LED
%d does not exist"
,
led_id
));
nlr_raise
(
mp_obj_new_exception_msg_varg
(
&
mp_type_ValueError
,
"LED
(
%d
)
does not exist"
,
led_id
));
}
// return static led object
...
...
tests/pyb/led.py.exp
View file @
7a6dbaa8
<
LED
1>
<
LED
2>
<
LED
3>
<
LED
4>
LED
(1)
LED
(2)
LED
(3)
LED
(4)
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