summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2014-03-25 23:33:47 +0000
committerDamien George <damien.p.george@gmail.com>2014-03-25 23:33:47 +0000
commit30216325010e198c2e73ea41811ae63ea5ee3991 (patch)
tree2f2d57e113adfbf149008419f5f30339b0856ad0
parent6cfda3084dfef44892e85b1c658f0ad9b0643641 (diff)
downloadmicropython-30216325010e198c2e73ea41811ae63ea5ee3991.tar.gz
micropython-30216325010e198c2e73ea41811ae63ea5ee3991.zip
stmhal: Shuffle around some init functions in main().
-rw-r--r--stmhal/accel.h1
-rw-r--r--stmhal/main.c47
-rw-r--r--stmhal/modpyb.c15
3 files changed, 32 insertions, 31 deletions
diff --git a/stmhal/accel.h b/stmhal/accel.h
index 9f9c0a8e06..cfc54fcf67 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 e80841ea9d..1da7a9a649 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 b0442b65f7..d86db52a41 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 },