summaryrefslogtreecommitdiffstatshomepage
path: root/cc3200/mods/pybi2c.c
diff options
context:
space:
mode:
authordanicampora <danicampora@gmail.com>2015-03-17 11:05:59 +0100
committerdanicampora <danicampora@gmail.com>2015-03-17 13:26:07 +0100
commit6de1b39368efc27d7a90d64f28f99b9e46422f5b (patch)
treecfb27f5e12cde99857e795ed031aed6db51a6e7c /cc3200/mods/pybi2c.c
parentfcf6db06950c00d83d7d02b6ab0a23de52f27b01 (diff)
downloadmicropython-6de1b39368efc27d7a90d64f28f99b9e46422f5b.tar.gz
micropython-6de1b39368efc27d7a90d64f28f99b9e46422f5b.zip
cc3200: Make peripheral objects static.
This prevents duplication of objects in the sleep list. Also helps with reducing the code size by ~100 bytes.
Diffstat (limited to 'cc3200/mods/pybi2c.c')
-rw-r--r--cc3200/mods/pybi2c.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/cc3200/mods/pybi2c.c b/cc3200/mods/pybi2c.c
index aa4401ee18..ce7bc0e74d 100644
--- a/cc3200/mods/pybi2c.c
+++ b/cc3200/mods/pybi2c.c
@@ -120,6 +120,11 @@ typedef struct _pyb_i2c_obj_t {
}
/******************************************************************************
+ DECLARE PRIVATE DATA
+ ******************************************************************************/
+STATIC pyb_i2c_obj_t pyb_i2c_obj;
+
+/******************************************************************************
DEFINE PRIVATE FUNCTIONS
******************************************************************************/
// only master mode is available for the moment
@@ -327,8 +332,8 @@ STATIC mp_obj_t pyb_i2c_make_new(mp_obj_t type_in, mp_uint_t n_args, mp_uint_t n
nlr_raise(mp_obj_new_exception_msg(&mp_type_ValueError, mpexception_value_invalid_arguments));
}
- // create and setup the object
- pyb_i2c_obj_t *self = m_new_obj_with_finaliser(pyb_i2c_obj_t);
+ // setup the object
+ pyb_i2c_obj_t *self = &pyb_i2c_obj;
self->base.type = &pyb_i2c_type;
self->mode = PYBI2C_MODE_DISABLED;