summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2014-04-12 00:51:41 +0100
committerDamien George <damien.p.george@gmail.com>2014-04-12 00:51:41 +0100
commit60427864b1aaaedfdd407b62433148381147d674 (patch)
treede5bb24a8cc5856b6e28f2ad32c02477e0de87af
parent8f1931754002b0904c62e481d9dcae2f6e1913e2 (diff)
stmhal: Move I2C objects to ROM.
-rw-r--r--stmhal/i2c.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/stmhal/i2c.c b/stmhal/i2c.c
index e998d5941..9528a3c3c 100644
--- a/stmhal/i2c.c
+++ b/stmhal/i2c.c
@@ -75,7 +75,7 @@ typedef struct _pyb_i2c_obj_t {
I2C_HandleTypeDef *i2c_handle;
} pyb_i2c_obj_t;
-STATIC pyb_i2c_obj_t pyb_i2c_obj[PYB_NUM_I2C] = {{{&pyb_i2c_type}, &I2cHandle_X}, {{&pyb_i2c_type}, &I2cHandle_Y}};
+STATIC const pyb_i2c_obj_t pyb_i2c_obj[PYB_NUM_I2C] = {{{&pyb_i2c_type}, &I2cHandle_X}, {{&pyb_i2c_type}, &I2cHandle_Y}};
STATIC mp_obj_t pyb_i2c_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const mp_obj_t *args) {
// check arguments
@@ -90,12 +90,12 @@ STATIC mp_obj_t pyb_i2c_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const
}
// get i2c object
- pyb_i2c_obj_t *i2c_obj = &pyb_i2c_obj[i2c_id];
+ const pyb_i2c_obj_t *i2c_obj = &pyb_i2c_obj[i2c_id];
// start the peripheral
i2c_start(i2c_obj->i2c_handle);
- return &pyb_i2c_obj;
+ return (mp_obj_t)i2c_obj;
}
STATIC mp_obj_t pyb_i2c_is_ready(mp_obj_t self_in, mp_obj_t i2c_addr_o) {