Skip to content

Commit e0fd7b2

Browse files
committed
Modify "mbed new" to create mbed_app.json with default content.
1 parent ec6eb11 commit e0fd7b2

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

mbed/mbed.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
import re
3838
import subprocess
3939
import os
40+
import json
4041
import platform
4142
import contextlib
4243
import shutil
@@ -221,6 +222,13 @@ def hide_progress(max_width=80):
221222
if sys.stdout.isatty():
222223
sys.stdout.write("\r%s\r" % (' ' * max_width))
223224

225+
def create_default_mbed_app():
226+
# Default data content
227+
data = {'target_overrides':{'K64F':{'platform.stdio-baud-rate': 9600}}}
228+
filehandler = open("mbed_app.json","w")
229+
json.dump(data, filehandler, indent=4)
230+
filehandler.close()
231+
224232
# Process execution
225233
class ProcessException(Exception):
226234
pass
@@ -2088,6 +2096,7 @@ def new(name, scm='git', program=False, library=False, mbedlib=False, create_onl
20882096
try:
20892097
with cd(d_path):
20902098
add(url, path=d, depth=depth, protocol=protocol, top=False)
2099+
create_default_mbed_app()
20912100
except Exception as e:
20922101
if os.path.isdir(os.path.join(d_path, d)):
20932102
rmtree_readonly(os.path.join(d_path, d))

0 commit comments

Comments
 (0)