From 30216325010e198c2e73ea41811ae63ea5ee3991 Mon Sep 17 00:00:00 2001 From: Damien George Date: Tue, 25 Mar 2014 23:33:47 +0000 Subject: [PATCH] stmhal: Shuffle around some init functions in main(). --- stmhal/accel.h | 1 - stmhal/main.c | 47 ++++++++++++++++++++++++----------------------- stmhal/modpyb.c | 15 ++++++++------- 3 files changed, 32 insertions(+), 31 deletions(-) diff --git a/stmhal/accel.h b/stmhal/accel.h index 9f9c0a8e0..cfc54fcf6 100644 --- a/stmhal/accel.h +++ b/stmhal/accel.h @@ -1,4 +1,3 @@ -extern I2C_HandleTypeDef I2cHandle; extern const mp_obj_type_t pyb_accel_type; void accel_init(void); diff --git a/stmhal/main.c b/stmhal/main.c index e80841ea9..1da7a9a64 100644 --- a/stmhal/main.c +++ b/stmhal/main.c @@ -26,12 +26,12 @@ #include "exti.h" #include "usrsw.h" #include "usb.h" -#include "rng.h" #include "rtc.h" #include "storage.h" #include "sdcard.h" #include "ff.h" #include "lcd.h" +#include "rng.h" #include "i2c.h" #include "accel.h" #include "servo.h" @@ -221,28 +221,6 @@ soft_reset: lcd_init(); #endif -#if MICROPY_HW_ENABLE_RNG - // RNG - rng_init(); -#endif - -#if MICROPY_HW_ENABLE_SERVO - // servo - servo_init(); -#endif - -#if 0 -#if MICROPY_HW_ENABLE_TIMER - // timer - timer_init(); -#endif -#endif - -#if MICROPY_HW_ENABLE_DAC - // DAC - dac_init(); -#endif - pin_map_init(); // check if user switch held (initiates reset of filesystem) @@ -376,6 +354,12 @@ soft_reset: pyb_usb_dev_init(USBD_DEVICE_CDC_MSC, usbd_medium_kind); #endif +#if MICROPY_HW_ENABLE_RNG + // RNG + rng_init(); +#endif + + // I2C i2c_init(); #if MICROPY_HW_HAS_MMA7660 @@ -383,6 +367,23 @@ soft_reset: accel_init(); #endif +#if MICROPY_HW_ENABLE_SERVO + // servo + servo_init(); +#endif + +#if 0 +#if MICROPY_HW_ENABLE_TIMER + // timer + timer_init(); +#endif +#endif + +#if MICROPY_HW_ENABLE_DAC + // DAC + dac_init(); +#endif + // run main script { vstr_t *vstr = vstr_new(); diff --git a/stmhal/modpyb.c b/stmhal/modpyb.c index b0442b65f..d86db52a4 100644 --- a/stmhal/modpyb.c +++ b/stmhal/modpyb.c @@ -253,13 +253,6 @@ STATIC const mp_map_elem_t pyb_module_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR_SD), (mp_obj_t)&pyb_sdcard_obj }, #endif -#if MICROPY_HW_HAS_MMA7660 - { MP_OBJ_NEW_QSTR(MP_QSTR_Accel), (mp_obj_t)&pyb_accel_type }, -#endif - -#if 0 - { MP_OBJ_NEW_QSTR(MP_QSTR_hid), (mp_obj_t)&pyb_hid_send_report_obj }, -#endif { MP_OBJ_NEW_QSTR(MP_QSTR_Led), (mp_obj_t)&pyb_led_type }, { MP_OBJ_NEW_QSTR(MP_QSTR_I2C), (mp_obj_t)&pyb_i2c_type }, { MP_OBJ_NEW_QSTR(MP_QSTR_Usart), (mp_obj_t)&pyb_Usart_obj }, @@ -271,6 +264,14 @@ STATIC const mp_map_elem_t pyb_module_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR_DAC), (mp_obj_t)&pyb_dac_type }, #endif +#if MICROPY_HW_HAS_MMA7660 + { MP_OBJ_NEW_QSTR(MP_QSTR_Accel), (mp_obj_t)&pyb_accel_type }, +#endif + +#if 0 + { MP_OBJ_NEW_QSTR(MP_QSTR_hid), (mp_obj_t)&pyb_hid_send_report_obj }, +#endif + // input { MP_OBJ_NEW_QSTR(MP_QSTR_input), (mp_obj_t)&pyb_input_obj },