diff options
| author | danicampora | 2015-02-20 16:31:30 +0100 |
|---|---|---|
| committer | danicampora | 2015-02-20 16:41:55 +0100 |
| commit | 6b21c3fdd6aaee3266b1ac69017e6c1ffaa2c99b (patch) | |
| tree | 2e0e410b5f4a38cf6071a30e8a2c48fbb5e2a944 /cc3200/mods/modpyb.c | |
| parent | 7807da20ab1e5f91d26d93553545235d3b443044 (diff) | |
cc3200: Refactor UART and I2C object creation.
I2C objects can be freed by the GC and a __del__ method is provided
in order to de-init the peripheral prior to being garbage collected.
UART objects are now added to a local list and this list is now part
of the VM_STATE.
Diffstat (limited to 'cc3200/mods/modpyb.c')
| -rw-r--r-- | cc3200/mods/modpyb.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/cc3200/mods/modpyb.c b/cc3200/mods/modpyb.c index 5cf57244c..104581799 100644 --- a/cc3200/mods/modpyb.c +++ b/cc3200/mods/modpyb.c @@ -243,16 +243,16 @@ MP_DEFINE_CONST_FUN_OBJ_0(pyb_standby_obj, pyb_standby); /// Get or set the UART object that the REPL is repeated on. STATIC mp_obj_t pyb_repl_uart(uint n_args, const mp_obj_t *args) { if (n_args == 0) { - if (MP_STATE_PORT(pyb_stdio_uart) == NULL) { + if (pyb_stdio_uart == NULL) { return mp_const_none; } else { - return MP_STATE_PORT(pyb_stdio_uart); + return pyb_stdio_uart; } } else { if (args[0] == mp_const_none) { - MP_STATE_PORT(pyb_stdio_uart) = NULL; + pyb_stdio_uart = NULL; } else if (mp_obj_get_type(args[0]) == &pyb_uart_type) { - MP_STATE_PORT(pyb_stdio_uart) = args[0]; + pyb_stdio_uart = args[0]; } else { nlr_raise(mp_obj_new_exception_msg(&mp_type_ValueError, mpexception_num_type_invalid_arguments)); } |
