diff options
| author | Daniel Campora | 2015-09-27 17:04:49 +0200 |
|---|---|---|
| committer | Daniel Campora | 2015-09-27 17:35:58 +0200 |
| commit | 37a2015cc541bbc27099a09ff0bffd61bb8ccc01 (patch) | |
| tree | 48920fe3dc4a6e5806cd9745c83609e066b30c61 /cc3200/mods | |
| parent | 958e273336644833de52c91ffee67b91493bb403 (diff) | |
tests/wipy: Add machine module tests.
Diffstat (limited to 'cc3200/mods')
| -rw-r--r-- | cc3200/mods/modmachine.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/cc3200/mods/modmachine.c b/cc3200/mods/modmachine.c index 514335abb..228aff0cf 100644 --- a/cc3200/mods/modmachine.c +++ b/cc3200/mods/modmachine.c @@ -134,6 +134,16 @@ STATIC mp_obj_t machine_unique_id(void) { } STATIC MP_DEFINE_CONST_FUN_OBJ_0(machine_unique_id_obj, machine_unique_id); +STATIC mp_obj_t machine_main(mp_obj_t main) { + if (MP_OBJ_IS_STR(main)) { + MP_STATE_PORT(machine_config_main) = main; + } else { + nlr_raise(mp_obj_new_exception_msg(&mp_type_ValueError, mpexception_value_invalid_arguments)); + } + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_1(machine_main_obj, machine_main); + STATIC mp_obj_t machine_idle(void) { __WFI(); return mp_const_none; @@ -162,8 +172,6 @@ STATIC mp_obj_t machine_wake_reason (void) { } STATIC MP_DEFINE_CONST_FUN_OBJ_0(machine_wake_reason_obj, machine_wake_reason); -MP_DECLARE_CONST_FUN_OBJ(machine_main_obj); // defined in main.c - STATIC const mp_map_elem_t machine_module_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_machine) }, |
