mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-03-29 13:20:39 +00:00
stm32-f4discovery-cc256x: create update_gatt_db.py in python instead of shell script
This commit is contained in:
parent
858282951e
commit
2b25cc0e93
@ -9,13 +9,27 @@ import subprocess
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
||||||
gatt_update_template = '''#!/bin/sh
|
gatt_update_template = '''#!/usr/bin/env python
|
||||||
DIR=`dirname $0`
|
|
||||||
PROJECT_LOC=$DIR
|
import subprocess
|
||||||
echo "Creating EXAMPLE.h from EXAMPLE.gatt"
|
import os
|
||||||
$PROJECT_LOC/btstack/tool/compile_gatt.py $PROJECT_LOC/example/EXAMPLE.gatt $PROJECT_LOC/example/EXAMPLE.h
|
import sys
|
||||||
|
|
||||||
|
# get project path
|
||||||
|
project_path = os.path.abspath(os.path.dirname(sys.argv[0])) + '/'
|
||||||
|
|
||||||
|
print('Creating EXAMPLE.h from EXAMPLE.gatt')
|
||||||
|
|
||||||
|
# execute script
|
||||||
|
compile_gatt_script = project_path + "/btstack/tool/compile_gatt.py"
|
||||||
|
gatt_file = project_path + '/example/EXAMPLE.gatt'
|
||||||
|
h_file = project_path + '/example/EXAMPLE.h'
|
||||||
|
print(gatt_file)
|
||||||
|
print(h_file)
|
||||||
|
subprocess.call([compile_gatt_script, gatt_file, h_file])
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
|
||||||
## pick correct init script based on your hardware
|
## pick correct init script based on your hardware
|
||||||
# - init script for CC2564B
|
# - init script for CC2564B
|
||||||
cc256x_init_script = 'bluetooth_init_cc2564B_1.6_BT_Spec_4.1.c'
|
cc256x_init_script = 'bluetooth_init_cc2564B_1.6_BT_Spec_4.1.c'
|
||||||
@ -116,7 +130,7 @@ for file in example_files:
|
|||||||
shutil.copy(btstack_root + 'tool/compile_gatt.py', compile_gatt_path)
|
shutil.copy(btstack_root + 'tool/compile_gatt.py', compile_gatt_path)
|
||||||
os.chmod(compile_gatt_path, 0o755)
|
os.chmod(compile_gatt_path, 0o755)
|
||||||
# create example/update_gatt_db.sh
|
# create example/update_gatt_db.sh
|
||||||
update_gatt_script = project_folder + "update_gatt_db.sh"
|
update_gatt_script = project_folder + "update_gatt_db.py"
|
||||||
with open(update_gatt_script, "wt") as fout:
|
with open(update_gatt_script, "wt") as fout:
|
||||||
fout.write(gatt_update_template.replace("EXAMPLE", example))
|
fout.write(gatt_update_template.replace("EXAMPLE", example))
|
||||||
os.chmod(update_gatt_script, 0o755)
|
os.chmod(update_gatt_script, 0o755)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user