stmhal: Shuffle around some init functions in main().

This commit is contained in:
Damien George 2014-03-25 23:33:47 +00:00
parent 6cfda3084d
commit 3021632501
3 changed files with 32 additions and 31 deletions

View File

@ -1,4 +1,3 @@
extern I2C_HandleTypeDef I2cHandle;
extern const mp_obj_type_t pyb_accel_type;
void accel_init(void);

View File

@ -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();

View File

@ -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 },