summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGlenn Ruben Bakke <glennbakke@gmail.com>2017-03-06 23:30:56 +0100
committerGlenn Ruben Bakke <glennbakke@gmail.com>2017-03-06 23:30:56 +0100
commit4afa41ac368f84c0578cafa858ddc781ab453446 (patch)
tree020d609024aeb2a3237ecc8bf50f6cb93c7a9769
parent5acba015ef391f66c8699b7fb187cc8db0c8bd0a (diff)
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.
-rw-r--r--nrf5/modules/machine/modmachine.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/nrf5/modules/machine/modmachine.c b/nrf5/modules/machine/modmachine.c
index 4c1890d63..07f5b7453 100644
--- a/nrf5/modules/machine/modmachine.c
+++ b/nrf5/modules/machine/modmachine.c
@@ -162,11 +162,34 @@ STATIC mp_obj_t machine_reset_cause(void) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_0(machine_reset_cause_obj, machine_reset_cause);
+STATIC mp_obj_t machine_enable_irq(void) {
+#ifndef BLUETOOTH_SD
+ __enable_irq();
+#else
+
+#endif
+ return mp_const_none;
+}
+MP_DEFINE_CONST_FUN_OBJ_0(machine_enable_irq_obj, machine_enable_irq);
+
+// Resets the pyboard in a manner similar to pushing the external RESET button.
+STATIC mp_obj_t machine_disable_irq(void) {
+#ifndef BLUETOOTH_SD
+ __disable_irq();
+#else
+
+#endif
+ return mp_const_none;
+}
+MP_DEFINE_CONST_FUN_OBJ_0(machine_disable_irq_obj, machine_disable_irq);
+
STATIC const mp_map_elem_t machine_module_globals_table[] = {
{ MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_umachine) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_info), (mp_obj_t)&machine_info_obj },
{ MP_OBJ_NEW_QSTR(MP_QSTR_reset), (mp_obj_t)&machine_reset_obj },
{ MP_OBJ_NEW_QSTR(MP_QSTR_soft_reset), (mp_obj_t)&machine_soft_reset_obj },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_enable_irq), (mp_obj_t)&machine_enable_irq_obj },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_disable_irq), (mp_obj_t)&machine_disable_irq_obj },
#if MICROPY_HW_ENABLE_RNG
{ MP_OBJ_NEW_QSTR(MP_QSTR_rng), (mp_obj_t)&pyb_rng_get_obj },
#endif