diff options
author | Rachel Dowdall <rjdowdall@gmail.com> | 2014-03-22 12:17:36 +0000 |
---|---|---|
committer | Rachel Dowdall <rjdowdall@gmail.com> | 2014-03-22 12:17:36 +0000 |
commit | 17f45d41fefdb75fb76fca00ce4d7d5e158b6ea5 (patch) | |
tree | 36077e73d30aa91f94ed74b707facc86b7ed7937 /stmhal/main.c | |
parent | 300c8bd4c2c0c6d626a6aaeb873c22a8f8b9fc3f (diff) | |
parent | da8d21e0dd236ae5e31bfac4ff8d5b73ddd49282 (diff) | |
download | micropython-17f45d41fefdb75fb76fca00ce4d7d5e158b6ea5.tar.gz micropython-17f45d41fefdb75fb76fca00ce4d7d5e158b6ea5.zip |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'stmhal/main.c')
-rw-r--r-- | stmhal/main.c | 47 |
1 files changed, 18 insertions, 29 deletions
diff --git a/stmhal/main.c b/stmhal/main.c index d77733429b..d92ccdd5b1 100644 --- a/stmhal/main.c +++ b/stmhal/main.c @@ -33,9 +33,9 @@ #include "sdcard.h" #include "ff.h" #include "lcd.h" +#include "accel.h" #if 0 #include "servo.h" -#include "accel.h" #include "timer.h" #include "pybwlan.h" #include "pin.h" @@ -170,22 +170,6 @@ int main(void) { // enable the CCM RAM __CCMDATARAMEN_CLK_ENABLE(); - // some test code to flash LEDs - led_init(); - - led_state(0, 1); - led_state(1, 0); - led_state(2, 1); - -#if 0 - for (;;) { - HAL_Delay(500); - led_state(1, 1); - HAL_Delay(500); - led_state(1, 0); - } -#endif - #if 0 #if defined(NETDUINO_PLUS_2) { @@ -348,6 +332,11 @@ soft_reset: // make sure we have a /boot.py { FILINFO fno; +#if _USE_LFN + 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) { @@ -382,18 +371,13 @@ soft_reset: flash_error(4); } - if (first_soft_reset) { -#if 0 -#if MICROPY_HW_HAS_MMA7660 - // MMA accel: init and reset address to zero - accel_init(); -#endif -#endif - } - // turn boot-up LED off led_state(PYB_LED_GREEN, 0); +#if defined(USE_DEVICE_MODE) + usbd_storage_medium_kind_t usbd_medium_kind = USBD_STORAGE_MEDIUM_FLASH; +#endif + #if MICROPY_HW_HAS_SDCARD // if an SD card is present then mount it on 1:/ if (sdcard_is_present()) { @@ -403,8 +387,8 @@ soft_reset: } else { if (first_soft_reset) { // use SD card as medium for the USB MSD -#if 0 - usbd_storage_select_medium(USBD_STORAGE_MEDIUM_SDCARD); +#if defined(USE_DEVICE_MODE) + usbd_medium_kind = USBD_STORAGE_MEDIUM_SDCARD; #endif } } @@ -416,7 +400,12 @@ soft_reset: pyb_usb_host_init(); #elif defined(USE_DEVICE_MODE) // USB device - pyb_usb_dev_init(PYB_USB_DEV_VCP_MSC); + pyb_usb_dev_init(USBD_DEVICE_MSC, usbd_medium_kind); +#endif + +#if MICROPY_HW_HAS_MMA7660 + // MMA accel: init and reset + accel_init(); #endif // run main script |