diff options
author | Damien George <damien.p.george@gmail.com> | 2014-01-21 21:40:13 +0000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-01-21 21:40:13 +0000 |
commit | 55baff4c9bcbc001cbb8972c289ebfa356d4665b (patch) | |
tree | bd086f9ddf8c5f2db9642ee04fc382064ebd2029 /stm/timer.c | |
parent | 91d457a27752fa125e9c6107bf51c918e021dc95 (diff) | |
download | micropython-55baff4c9bcbc001cbb8972c289ebfa356d4665b.tar.gz micropython-55baff4c9bcbc001cbb8972c289ebfa356d4665b.zip |
Revamp qstrs: they now include length and hash.
Can now have null bytes in strings. Can define ROM qstrs per port using
qstrdefsport.h
Diffstat (limited to 'stm/timer.c')
-rw-r--r-- | stm/timer.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/stm/timer.c b/stm/timer.c index 062f8c689e..d20d3a77bd 100644 --- a/stm/timer.c +++ b/stm/timer.c @@ -1,5 +1,6 @@ #include <stdint.h> #include <stdio.h> +#include <string.h> #include "stm_misc.h" #include "stm32f4xx_rcc.h" @@ -8,6 +9,7 @@ #include "nlr.h" #include "misc.h" #include "mpconfig.h" +#include "qstr.h" #include "parse.h" #include "obj.h" #include "runtime.h" @@ -71,12 +73,12 @@ void timer_init(void) { TIM_Cmd(TIM6, ENABLE); // 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_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); } void timer_interrupt(void) { |