summaryrefslogtreecommitdiffstatshomepage
path: root/stmhal/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'stmhal/main.c')
-rw-r--r--stmhal/main.c29
1 files changed, 17 insertions, 12 deletions
diff --git a/stmhal/main.c b/stmhal/main.c
index d92ccdd5b1..6511891a1b 100644
--- a/stmhal/main.c
+++ b/stmhal/main.c
@@ -10,7 +10,6 @@
#include "pendsv.h"
#include "mpconfig.h"
#include "qstr.h"
-#include "nlr.h"
#include "misc.h"
#include "lexer.h"
#include "parse.h"
@@ -23,19 +22,22 @@
#include "gccollect.h"
#include "pyexec.h"
#include "pybmodule.h"
+#include "osmodule.h"
+#include "timemodule.h"
#include "usart.h"
#include "led.h"
#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 "accel.h"
-#if 0
#include "servo.h"
+#if 0
#include "timer.h"
#include "pybwlan.h"
#include "pin.h"
@@ -247,23 +249,24 @@ soft_reset:
lcd_init();
#endif
-#if 0
+#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
-
-#if MICROPY_HW_ENABLE_RNG
- // RNG
- RCC_AHB2PeriphClockCmd(RCC_AHB2Periph_RNG, ENABLE);
- RNG_Cmd(ENABLE);
#endif
+#if 0
pin_map_init();
#endif
@@ -274,6 +277,11 @@ soft_reset:
// probably shouldn't do this, so we are compatible with CPython
rt_store_name(MP_QSTR_pyb, (mp_obj_t)&pyb_module);
+ // pre-import the os and time modules
+ // TODO don't do this! (need a way of registering builtin modules...)
+ rt_store_name(MP_QSTR_os, (mp_obj_t)&os_module);
+ rt_store_name(MP_QSTR_time, (mp_obj_t)&time_module);
+
// check if user switch held (initiates reset of filesystem)
bool reset_filesystem = false;
#if MICROPY_HW_HAS_SWITCH
@@ -336,7 +344,6 @@ soft_reset:
fno.lfname = NULL;
fno.lfsize = 0;
#endif
- led_debug(0, 500);
FRESULT res = f_stat("0:/boot.py", &fno);
if (res == FR_OK) {
if (fno.fattrib & AM_DIR) {
@@ -400,7 +407,7 @@ soft_reset:
pyb_usb_host_init();
#elif defined(USE_DEVICE_MODE)
// USB device
- pyb_usb_dev_init(USBD_DEVICE_MSC, usbd_medium_kind);
+ pyb_usb_dev_init(USBD_DEVICE_CDC_MSC, usbd_medium_kind);
#endif
#if MICROPY_HW_HAS_MMA7660
@@ -474,10 +481,8 @@ soft_reset:
pyexec_repl();
-#if 0
printf("PYB: sync filesystems\n");
storage_flush();
-#endif
printf("PYB: soft reboot\n");