8000 nrf5/modules/machine: Adding enable_irq() and disable_irq() method to… · boneskull/circuitpython@4afa41a · GitHub
[go: up one dir, main page]

Skip to content

Commit 4afa41a

Browse files
committed
nrf5/modules/machine: Adding enable_irq() and disable_irq() method to the machine module. No implementation yet for the case where bluetooth stack is used.
1 parent 5acba01 commit 4afa41a

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

nrf5/modules/machine/modmachine.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,11 +162,34 @@ STATIC mp_obj_t machine_reset_cause(void) {
162162
}
163163
STATIC MP_DEFINE_CONST_FUN_OBJ_0(machine_reset_cause_obj, machine_reset_cause);
164164

165+
STATIC mp_obj_t machine_enable_irq(void) {
166+
#ifndef BLUETOOTH_SD
167+
__enable_irq();
168+
#else
169+
170+
#endif
171+
return mp_const_none;
172+
}
173+
MP_DEFINE_CONST_FUN_OBJ_0(machine_enable_irq_obj, machine_enable_irq);
174+
175+
// Resets the pyboard in a manner similar to pushing the external RESET button.
176+
STATIC mp_obj_t machine_disable_irq(void) {
177+
#ifndef BLUETOOTH_SD
178+
__disable_irq();
179+
#else
180+
181+
#endif
182+
return mp_const_none;
183+
}
184+
MP_DEFINE_CONST_FUN_OBJ_0(machine_disable_irq_obj, machine_disable_irq);
185+
165186
STATIC const mp_map_elem_t machine_module_globals_table[] = {
166187
{ MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_umachine) },
167188
{ MP_OBJ_NEW_QSTR(MP_QSTR_info), (mp_obj_t)&machine_info_obj },
168189
{ MP_OBJ_NEW_QSTR(MP_QSTR_reset), (mp_obj_t)&machine_reset_obj },
169190
{ MP_OBJ_NEW_QSTR(MP_QSTR_soft_reset), (mp_obj_t)&machine_soft_reset_obj },
191+
{ MP_OBJ_NEW_QSTR(MP_QSTR_enable_irq), (mp_obj_t)&machine_enable_irq_obj },
192+
{ MP_OBJ_NEW_QSTR(MP_QSTR_disable_irq), (mp_obj_t)&machine_disable_irq_obj },
170193
#if MICROPY_HW_ENABLE_RNG
171194
{ MP_OBJ_NEW_QSTR(MP_QSTR_rng), (mp_obj_t)&pyb_rng_get_obj },
172195
#endif

0 commit comments

Comments
 (0)
0