diff options
author | Damien George <damien.p.george@gmail.com> | 2014-03-08 15:20:36 +0000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-03-08 15:20:36 +0000 |
commit | 8fd7d7e102372a3fe067030aa0f2049f744b1567 (patch) | |
tree | e27fb73e638460a0da3e88163a7a247f19d1b981 /stm/main.c | |
parent | 5260810d70311b9baaea249ef4a8bcd80f56f5dc (diff) | |
parent | 360b25ab0f8df087d6ad986e4cd6fa2cff1d256b (diff) |
Merge branch 'master' of github.com:micropython/micropython
Diffstat (limited to 'stm/main.c')
-rw-r--r-- | stm/main.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/stm/main.c b/stm/main.c index 5ab17cd3d..e5f5d4e76 100644 --- a/stm/main.c +++ b/stm/main.c @@ -110,6 +110,16 @@ mp_obj_t pyb_delay(mp_obj_t count) { return mp_const_none; } +mp_obj_t pyb_udelay(mp_obj_t usec) { + uint32_t count = 0; + const uint32_t utime = (168 * mp_obj_get_int(usec) / 5); + for (;;) { + if (++count > utime) { + return mp_const_none; + } + } +} + void fatality(void) { led_state(PYB_LED_R1, 1); led_state(PYB_LED_G1, 1); @@ -387,11 +397,6 @@ soft_reset: servo_init(); #endif -#if MICROPY_HW_ENABLE_AUDIO - // audio - audio_init(); -#endif - #if MICROPY_HW_ENABLE_TIMER // timer timer_init(); @@ -420,6 +425,7 @@ soft_reset: rt_store_attr(m, MP_QSTR_main, rt_make_function_n(1, pyb_main)); rt_store_attr(m, MP_QSTR_sync, rt_make_function_n(0, pyb_sync)); rt_store_attr(m, MP_QSTR_delay, rt_make_function_n(1, pyb_delay)); + rt_store_attr(m, MP_QSTR_udelay, rt_make_function_n(1, pyb_udelay)); #if MICROPY_HW_HAS_SWITCH rt_store_attr(m, MP_QSTR_switch, (mp_obj_t)&pyb_switch_obj); #endif @@ -450,6 +456,10 @@ soft_reset: rt_store_attr(m, MP_QSTR_ADC, (mp_obj_t)&pyb_ADC_obj); rt_store_attr(m, qstr_from_str("millis"), rt_make_function_n(0, pyb_millis)); +#if MICROPY_HW_ENABLE_AUDIO + rt_store_attr(m, qstr_from_str("Audio"), (mp_obj_t)&pyb_Audio_obj); +#endif + pin_map_init(m); gpio_init(m); exti_init(m); |