diff options
| author | Damien George | 2014-03-30 13:35:08 +0100 |
|---|---|---|
| committer | Damien George | 2014-03-30 13:35:08 +0100 |
| commit | d17926db710189db97a49e9b2e72d782fc404231 (patch) | |
| tree | 406396ee6f3010511a606dd4ea3ed5a817d959eb /stm | |
| parent | 09d207785c77c85c957471b064ceebe0d2ee0a23 (diff) | |
Rename rt_* to mp_*.
Mostly just a global search and replace. Except rt_is_true which
becomes mp_obj_is_true.
Still would like to tidy up some of the names, but this will do for now.
Diffstat (limited to 'stm')
| -rw-r--r-- | stm/accel.c | 4 | ||||
| -rw-r--r-- | stm/exti.c | 4 | ||||
| -rw-r--r-- | stm/gpio.c | 2 | ||||
| -rw-r--r-- | stm/lcd.c | 20 | ||||
| -rw-r--r-- | stm/main.c | 8 | ||||
| -rw-r--r-- | stm/pin_map.c | 6 | ||||
| -rw-r--r-- | stm/pyexec.c | 6 | ||||
| -rw-r--r-- | stm/sdcard.c | 2 | ||||
| -rw-r--r-- | stm/timer.c | 12 | ||||
| -rw-r--r-- | stm/usrsw.c | 2 |
10 files changed, 33 insertions, 33 deletions
diff --git a/stm/accel.c b/stm/accel.c index ae9d58868..c55bc6ba2 100644 --- a/stm/accel.c +++ b/stm/accel.c @@ -268,7 +268,7 @@ mp_obj_t pyb_accel_read(void) { data[2] = mp_obj_new_int(accel_buf[2] + accel_buf[5] + accel_buf[8] + accel_buf[11]); data[3] = mp_obj_new_int(jolt_info); - return rt_build_tuple(4, data); + return mp_build_tuple(4, data); } MP_DEFINE_CONST_FUN_OBJ_0(pyb_accel_read_obj, pyb_accel_read); @@ -283,7 +283,7 @@ mp_obj_t pyb_accel_read_all(void) { } data[10] = mp_obj_new_int(accel_read_nack()); - return rt_build_tuple(11, data); + return mp_build_tuple(11, data); } MP_DEFINE_CONST_FUN_OBJ_0(pyb_accel_read_all_obj, pyb_accel_read_all); diff --git a/stm/exti.c b/stm/exti.c index 5b8c694a8..33821cd18 100644 --- a/stm/exti.c +++ b/stm/exti.c @@ -284,7 +284,7 @@ static void exti_load_attr(mp_obj_t self_in, qstr attr_qstr, mp_obj_t *dest) { static mp_obj_t exti_call(mp_obj_t type_in, uint n_args, uint n_kw, const mp_obj_t *args) { // type_in == exti_obj_type - rt_check_nargs(n_args, 4, 4, n_kw, 0); + mp_check_nargs(n_args, 4, 4, n_kw, 0); exti_obj_t *self = m_new_obj(exti_obj_t); self->base.type = type_in; @@ -336,7 +336,7 @@ static void Handle_EXTI_Irq(uint32_t line) { if (line < EXTI_NUM_VECTORS) { exti_vector_t *v = &exti_vector[line]; if (v->callback_obj != mp_const_none) { - rt_call_function_1(v->callback_obj, MP_OBJ_NEW_SMALL_INT(line)); + mp_call_function_1(v->callback_obj, MP_OBJ_NEW_SMALL_INT(line)); } } } diff --git a/stm/gpio.c b/stm/gpio.c index 19e7098ac..9f9e8e079 100644 --- a/stm/gpio.c +++ b/stm/gpio.c @@ -46,7 +46,7 @@ mp_obj_t pyb_gpio(uint n_args, mp_obj_t *args) { } } else { // set pin - if (rt_is_true(args[1])) { + if (mp_obj_is_true(args[1])) { // set pin high port->BSRRL = pin_mask; } else { @@ -209,7 +209,7 @@ mp_obj_t lcd_print(mp_obj_t text) { mp_obj_t lcd_light(mp_obj_t value) { #if defined(PYB_LCD_BL_PORT) - if (rt_is_true(value)) { + if (mp_obj_is_true(value)) { PYB_LCD_BL_PORT->BSRRL = PYB_LCD_BL_PIN; // set pin high to turn backlight on } else { PYB_LCD_BL_PORT->BSRRH = PYB_LCD_BL_PIN; // set pin low to turn backlight off @@ -288,14 +288,14 @@ static mp_obj_t pyb_lcd_init(void) { // Micro Python interface mp_obj_t o = mp_obj_new_type(MP_QSTR_LCD, mp_const_empty_tuple, mp_obj_new_dict(0)); - rt_store_attr(o, qstr_from_str("lcd8"), rt_make_function_n(2, lcd_draw_pixel_8)); - rt_store_attr(o, qstr_from_str("clear"), rt_make_function_n(0, lcd_pix_clear)); - rt_store_attr(o, qstr_from_str("get"), rt_make_function_n(2, lcd_pix_get)); - rt_store_attr(o, qstr_from_str("set"), rt_make_function_n(2, lcd_pix_set)); - rt_store_attr(o, qstr_from_str("reset"), rt_make_function_n(2, lcd_pix_reset)); - rt_store_attr(o, qstr_from_str("show"), rt_make_function_n(0, lcd_pix_show)); - rt_store_attr(o, qstr_from_str("text"), rt_make_function_n(1, lcd_print)); - rt_store_attr(o, qstr_from_str("light"), rt_make_function_n(1, lcd_light)); + mp_store_attr(o, qstr_from_str("lcd8"), mp_make_function_n(2, lcd_draw_pixel_8)); + mp_store_attr(o, qstr_from_str("clear"), mp_make_function_n(0, lcd_pix_clear)); + mp_store_attr(o, qstr_from_str("get"), mp_make_function_n(2, lcd_pix_get)); + mp_store_attr(o, qstr_from_str("set"), mp_make_function_n(2, lcd_pix_set)); + mp_store_attr(o, qstr_from_str("reset"), mp_make_function_n(2, lcd_pix_reset)); + mp_store_attr(o, qstr_from_str("show"), mp_make_function_n(0, lcd_pix_show)); + mp_store_attr(o, qstr_from_str("text"), mp_make_function_n(1, lcd_print)); + mp_store_attr(o, qstr_from_str("light"), mp_make_function_n(1, lcd_light)); mp_lcd = o; return o; } @@ -304,7 +304,7 @@ static MP_DEFINE_CONST_FUN_OBJ_0(pyb_lcd_init_obj, pyb_lcd_init); void lcd_init(void) { mp_lcd = MP_OBJ_NULL; - rt_store_name(qstr_from_str("LCD"), (mp_obj_t)&pyb_lcd_init_obj); + mp_store_name(qstr_from_str("LCD"), (mp_obj_t)&pyb_lcd_init_obj); } void lcd_print_str(const char *str) { diff --git a/stm/main.c b/stm/main.c index 44be4d348..a11a813d2 100644 --- a/stm/main.c +++ b/stm/main.c @@ -233,12 +233,12 @@ soft_reset: // Micro Python init qstr_init(); - rt_init(); + mp_init(); mp_obj_t def_path[3]; def_path[0] = MP_OBJ_NEW_QSTR(MP_QSTR_0_colon__slash_); def_path[1] = MP_OBJ_NEW_QSTR(MP_QSTR_0_colon__slash_src); def_path[2] = MP_OBJ_NEW_QSTR(MP_QSTR_0_colon__slash_lib); - sys_path = mp_obj_new_list(3, def_path); + mp_sys_path = mp_obj_new_list(3, def_path); exti_init(); @@ -270,8 +270,8 @@ soft_reset: pin_map_init(); // add some functions to the builtin Python namespace - rt_store_name(MP_QSTR_help, rt_make_function_n(0, pyb_help)); - rt_store_name(MP_QSTR_open, rt_make_function_n(2, pyb_io_open)); + mp_store_name(MP_QSTR_help, mp_make_function_n(0, pyb_help)); + mp_store_name(MP_QSTR_open, mp_make_function_n(2, pyb_io_open)); // load the pyb module mp_module_register(MP_QSTR_pyb, (mp_obj_t)&pyb_module); diff --git a/stm/pin_map.c b/stm/pin_map.c index e4b1624a3..187ed3e63 100644 --- a/stm/pin_map.c +++ b/stm/pin_map.c @@ -69,7 +69,7 @@ static void pin_map_obj_print(void (*print)(void *env, const char *fmt, ...), vo static mp_obj_t pin_map_call(mp_obj_t self_in, uint n_args, uint n_kw, const mp_obj_t *args) { pin_map_obj_t *self = self_in; - rt_check_nargs(n_args, 1, 2, n_kw, false); + mp_check_nargs(n_args, 1, 2, n_kw, false); if (n_args > 1) { if (!self->map_dict) { @@ -96,7 +96,7 @@ static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pin_map_obj_mapper_obj, 1, 2, pin_map static mp_obj_t pin_map_obj_debug(uint n_args, mp_obj_t *args) { pin_map_obj_t *self = args[0]; if (n_args > 1) { - self->debug = rt_is_true(args[1]); + self->debug = mp_obj_is_true(args[1]); return mp_const_none; } return MP_BOOL(self->debug); @@ -162,7 +162,7 @@ const pin_obj_t *pin_map_user_obj(mp_obj_t user_obj) { } if (pin_map_obj.mapper) { - pin_obj = rt_call_function_1(pin_map_obj.mapper, user_obj); + pin_obj = mp_call_function_1(pin_map_obj.mapper, user_obj); if (pin_obj != mp_const_none) { if (!MP_OBJ_IS_TYPE(pin_obj, &pin_obj_type)) { nlr_jump(mp_obj_new_exception_msg(&mp_type_ValueError, "Pin.mapper didn't return a Pin object")); diff --git a/stm/pyexec.c b/stm/pyexec.c index e3e50441d..7b4da42b0 100644 --- a/stm/pyexec.c +++ b/stm/pyexec.c @@ -154,7 +154,7 @@ bool parse_compile_execute(mp_lexer_t *lex, mp_parse_input_kind_t input_kind, bo uint32_t start = sys_tick_counter; if (nlr_push(&nlr) == 0) { usb_vcp_set_interrupt_char(VCP_CHAR_CTRL_C); // allow ctrl-C to interrupt us - rt_call_function_0(module_fun); + mp_call_function_0(module_fun); usb_vcp_set_interrupt_char(VCP_CHAR_NONE); // disable interrupt nlr_pop(); ret = true; @@ -238,8 +238,8 @@ raw_repl_reset: void pyexec_repl(void) { #if defined(USE_HOST_MODE) && MICROPY_HW_HAS_LCD // in host mode, we enable the LCD for the repl - mp_obj_t lcd_o = rt_call_function_0(rt_load_name(qstr_from_str("LCD"))); - rt_call_function_1(rt_load_attr(lcd_o, qstr_from_str("light")), mp_const_true); + mp_obj_t lcd_o = mp_call_function_0(mp_load_name(qstr_from_str("LCD"))); + mp_call_function_1(mp_load_attr(lcd_o, qstr_from_str("light")), mp_const_true); #endif stdout_tx_str("Micro Python build <git hash> on 25/1/2014; " MICROPY_HW_BOARD_NAME " with STM32F405RG\r\n"); diff --git a/stm/sdcard.c b/stm/sdcard.c index 566fe70d5..59256292f 100644 --- a/stm/sdcard.c +++ b/stm/sdcard.c @@ -173,7 +173,7 @@ static MP_DEFINE_CONST_FUN_OBJ_1(sd_present_obj, sd_present); static mp_obj_t sd_power(mp_obj_t self, mp_obj_t state) { bool result; - if (rt_is_true(state)) { + if (mp_obj_is_true(state)) { result = sdcard_power_on(); } else { sdcard_power_off(); diff --git a/stm/timer.c b/stm/timer.c index d20d3a77b..0a19fa5a8 100644 --- a/stm/timer.c +++ b/stm/timer.c @@ -74,11 +74,11 @@ void timer_init(void) { // Python interface mp_obj_t m = mp_obj_new_module(QSTR_FROM_STR_STATIC("timer")); - rt_store_attr(m, QSTR_FROM_STR_STATIC("callback"), rt_make_function_n(1, timer_py_set_callback)); - rt_store_attr(m, QSTR_FROM_STR_STATIC("period"), rt_make_function_n(1, timer_py_set_period)); - rt_store_attr(m, QSTR_FROM_STR_STATIC("prescaler"), rt_make_function_n(1, timer_py_set_prescaler)); - rt_store_attr(m, QSTR_FROM_STR_STATIC("value"), rt_make_function_n(0, timer_py_get_value)); - rt_store_name(QSTR_FROM_STR_STATIC("timer"), m); + mp_store_attr(m, QSTR_FROM_STR_STATIC("callback"), mp_make_function_n(1, timer_py_set_callback)); + mp_store_attr(m, QSTR_FROM_STR_STATIC("period"), mp_make_function_n(1, timer_py_set_period)); + mp_store_attr(m, QSTR_FROM_STR_STATIC("prescaler"), mp_make_function_n(1, timer_py_set_prescaler)); + mp_store_attr(m, QSTR_FROM_STR_STATIC("value"), mp_make_function_n(0, timer_py_get_value)); + mp_store_name(QSTR_FROM_STR_STATIC("timer"), m); } void timer_interrupt(void) { @@ -86,7 +86,7 @@ void timer_interrupt(void) { nlr_buf_t nlr; if (nlr_push(&nlr) == 0) { // XXX what to do if the GC is in the middle of running?? - rt_call_function_0(timer_py_callback); + mp_call_function_0(timer_py_callback); nlr_pop(); } else { // uncaught exception diff --git a/stm/usrsw.c b/stm/usrsw.c index 98db562e6..a00ca90d2 100644 --- a/stm/usrsw.c +++ b/stm/usrsw.c @@ -33,7 +33,7 @@ static mp_obj_t switch_user_callback_obj; static mp_obj_t switch_callback(mp_obj_t line) { if (switch_user_callback_obj != mp_const_none) { - rt_call_function_0(switch_user_callback_obj); + mp_call_function_0(switch_user_callback_obj); } return mp_const_none; } |
