summaryrefslogtreecommitdiff
path: root/stmhal/main.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2014-04-09 01:16:49 +0100
committerDamien George <damien.p.george@gmail.com>2014-04-09 01:16:49 +0100
commitb99ca2cdde4e728308152028db9e67f2c33dde8f (patch)
treeb87cbe96afc7d971d44ee6a875ffb87bbcf748f1 /stmhal/main.c
parent8e6f98b166cdc7d62e14e99a994688a0df85fec2 (diff)
stmhal: Add windows cdc .inf driver to flash filesystem.
Diffstat (limited to 'stmhal/main.c')
-rw-r--r--stmhal/main.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/stmhal/main.c b/stmhal/main.c
index e5ba67dc1..64d9022ae 100644
--- a/stmhal/main.c
+++ b/stmhal/main.c
@@ -133,6 +133,10 @@ static const char fresh_main_py[] =
"# main.py -- put your code here!\n"
;
+static const char fresh_pybcdc_inf[] =
+#include "pybcdc.h"
+;
+
int main(void) {
// TODO disable JTAG
@@ -206,7 +210,9 @@ soft_reset:
}
HAL_Delay(20);
if (i % 30 == 29) {
- reset_mode = (reset_mode + 1) & 7;
+ if (++reset_mode > 3) {
+ reset_mode = 1;
+ }
led_state(2, reset_mode & 1);
led_state(3, reset_mode & 2);
led_state(4, reset_mode & 4);
@@ -310,6 +316,11 @@ soft_reset:
// TODO check we could write n bytes
f_close(&fp);
+ // create .inf driver file
+ f_open(&fp, "0:/pybcdc.inf", FA_WRITE | FA_CREATE_ALWAYS);
+ f_write(&fp, fresh_pybcdc_inf, sizeof(fresh_pybcdc_inf) - 1 /* don't count null terminator */, &n);
+ f_close(&fp);
+
// keep LED on for at least 200ms
sys_tick_wait_at_least(start_tick, 200);
led_state(PYB_LED_R2, 0);