fork
Embed:
(wiki syntax)
Show/hide line numbers
platform_config.py
00001 import json 00002 from time import sleep 00003 import sys 00004 import re 00005 import os 00006 00007 myfile = os.path.join('example-ublox-cellular-interface','mbed_app.json') 00008 #with open(myfile, 'r') as f: 00009 # data = json.load(f) 00010 00011 data={} 00012 00013 if 'config' not in data: 00014 data['config'] = {} 00015 data['target_overrides'] = {} 00016 data['config']['debug-on'] = {} 00017 data['config']['default-pin'] = {} 00018 data['config']['apn'] = {} 00019 data['config']['username'] = {} 00020 data['config']['password'] = {} 00021 data['config']['ntp-server'] = {} 00022 data['config']['ntp-port'] = {} 00023 00024 data['config']['debug-on']['value'] = True 00025 data['config']['default-pin'] = '\"1234\"' 00026 data['config']['apn'] = 0 00027 data['config']['username'] = 0 00028 data['config']['password'] = 0 00029 data['config']['ntp-server'] = '\"2.pool.ntp.org\"' 00030 data['config']['ntp-port'] = 123 00031 00032 data['target_overrides']['*'] = {} 00033 data['target_overrides']['*']['lwip.ppp-enabled'] = True 00034 data['target_overrides']['*']['platform.stdio-convert-newlines'] = True 00035 00036 00037 print('data', data) 00038 else: 00039 data['config']['debug-on']['value'] = True 00040 00041 print('debug-on', data['config']['debug-on']['value']) 00042 00043 with open(myfile, 'w') as f: 00044 json.dump(data, f)
Generated on Wed Jul 13 2022 14:24:30 by 1.7.2