Skip to content

Commit 6dba016

Browse files
committed
stmhal: Add pyb.wfi() function (calls __WFI).
1 parent 86a0304 commit 6dba016

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

stmhal/modpyb.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,13 @@ STATIC mp_obj_t pyb_udelay(mp_obj_t usec) {
132132

133133
STATIC MP_DEFINE_CONST_FUN_OBJ_1(pyb_udelay_obj, pyb_udelay);
134134

135+
STATIC mp_obj_t pyb_wfi(void) {
136+
__WFI();
137+
return mp_const_none;
138+
}
139+
140+
MP_DEFINE_CONST_FUN_OBJ_0(pyb_wfi_obj, pyb_wfi);
141+
135142
#if 0
136143
STATIC void SYSCLKConfig_STOP(void) {
137144
/* After wake-up from STOP reconfigure the system clock */
@@ -221,6 +228,7 @@ STATIC const mp_map_elem_t pyb_module_globals_table[] = {
221228
{ MP_OBJ_NEW_QSTR(MP_QSTR_gc), (mp_obj_t)&pyb_gc_obj },
222229
{ MP_OBJ_NEW_QSTR(MP_QSTR_repl_info), (mp_obj_t)&pyb_set_repl_info_obj },
223230

231+
{ MP_OBJ_NEW_QSTR(MP_QSTR_wfi), (mp_obj_t)&pyb_wfi_obj },
224232
{ MP_OBJ_NEW_QSTR(MP_QSTR_stop), (mp_obj_t)&pyb_stop_obj },
225233
{ MP_OBJ_NEW_QSTR(MP_QSTR_standby), (mp_obj_t)&pyb_standby_obj },
226234
{ MP_OBJ_NEW_QSTR(MP_QSTR_source_dir), (mp_obj_t)&pyb_source_dir_obj },

stmhal/qstrdefsport.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Q(info)
66
Q(sd_test)
77
Q(present)
88
Q(power)
9+
Q(wfi)
910
Q(stop)
1011
Q(standby)
1112
Q(source_dir)

0 commit comments

Comments
 (0)