mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-04-24 06:02:43 +00:00
wiced: create example apps and readme
This commit is contained in:
parent
9a73f75d9e
commit
1bf1365b63
77
port/wiced/create_examples.py
Executable file
77
port/wiced/create_examples.py
Executable file
@ -0,0 +1,77 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
#
|
||||||
|
# Create project files for all BTstack embedded examples in WICED/apps/btstack
|
||||||
|
|
||||||
|
import os
|
||||||
|
import shutil
|
||||||
|
import sys
|
||||||
|
import time
|
||||||
|
|
||||||
|
mk_template = '''#
|
||||||
|
# BTstack example 'EXAMPLE' for WICED port
|
||||||
|
#
|
||||||
|
# Generated by TOOL
|
||||||
|
# On DATE
|
||||||
|
|
||||||
|
NAME := EXAMPLE
|
||||||
|
|
||||||
|
GLOBAL_INCLUDES += .
|
||||||
|
|
||||||
|
$(NAME)_SOURCES := ../../../libraries/btstack/example/embedded/EXAMPLE.c
|
||||||
|
$(NAME)_COMPONENTS += btstack/port/wiced
|
||||||
|
'''
|
||||||
|
|
||||||
|
# get script path
|
||||||
|
script_path = os.path.abspath(os.path.dirname(sys.argv[0]))
|
||||||
|
|
||||||
|
# validate WICED root by reading version.txt
|
||||||
|
wiced_root = script_path + "/../../../../"
|
||||||
|
wiced_version = ""
|
||||||
|
try:
|
||||||
|
with open(wiced_root + 'version.txt', 'r') as fin:
|
||||||
|
wiced_version = fin.read() # Read the contents of the file into memory.
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
if not "WICED Version" in wiced_version:
|
||||||
|
print("Cannot find WICED root. Make sure BTstack is checked out in WICED-SDK-X/libraries")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
# show WICED version
|
||||||
|
print("Found %s" % wiced_version)
|
||||||
|
|
||||||
|
# path to examples
|
||||||
|
examples_embedded = script_path + "/../../example/embedded/"
|
||||||
|
|
||||||
|
# path to WICED/apps/btstack
|
||||||
|
apps_btstack = wiced_root + "/apps/btstack/"
|
||||||
|
|
||||||
|
print("Creating examples in apps/btstack:")
|
||||||
|
|
||||||
|
# iterate over btstack examples
|
||||||
|
for file in os.listdir(examples_embedded):
|
||||||
|
if not file.endswith(".c"):
|
||||||
|
continue
|
||||||
|
example = file[:-2]
|
||||||
|
|
||||||
|
# check for .gatt file
|
||||||
|
gatt_path = examples_embedded + example + ".gatt"
|
||||||
|
if os.path.exists(gatt_path):
|
||||||
|
print ("(Skipping %s example as .gatt -> .h conversion not implemented yet)" % example)
|
||||||
|
continue
|
||||||
|
|
||||||
|
# create folder
|
||||||
|
apps_folder = apps_btstack + example + "/"
|
||||||
|
if not os.path.exists(apps_folder):
|
||||||
|
os.makedirs(apps_folder)
|
||||||
|
|
||||||
|
# create .mk file
|
||||||
|
with open(apps_folder + example + ".mk", "wt") as fout:
|
||||||
|
fout.write(mk_template.replace("EXAMPLE", example).replace("TOOL", script_path).replace("DATE",time.strftime("%c")))
|
||||||
|
|
||||||
|
# copy .gatt file if present
|
||||||
|
if os.path.exists(gatt_path):
|
||||||
|
shutil.copyfile(gatt_path, apps_folder + example + ".gatt")
|
||||||
|
|
||||||
|
print("- %s" % example)
|
||||||
|
|
||||||
|
|
26
port/wiced/readme.md
Normal file
26
port/wiced/readme.md
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
# BTstack port for WICED platform
|
||||||
|
|
||||||
|
To integrate BTstack into the WICED SDK, please move the BTstack project into WICED-SDK-X/libraries.
|
||||||
|
Then create projects for BTstack examples in WICED/apps/btstack by running:
|
||||||
|
|
||||||
|
./create_examples.py
|
||||||
|
|
||||||
|
Note: the conversion of .gatt files into .h files isn't working yet. Examples with .gatt files are skipped currently.
|
||||||
|
|
||||||
|
Now, the BTstack examples can be build from the WICED root in the same way as other examples, e.g.:
|
||||||
|
|
||||||
|
./make btstack.spp_and_le_counter-RB_Duo
|
||||||
|
|
||||||
|
To build the SPP-and-LE-Counter example.
|
||||||
|
|
||||||
|
See WICED documentation about how to install it.
|
||||||
|
|
||||||
|
Only tested on Redbear Duo platform.
|
||||||
|
|
||||||
|
It should work with all WICED platforms that contain a Broadcom Bluetooth chipset.
|
||||||
|
|
||||||
|
The maximal baud rate is limited to 3 mbps.
|
||||||
|
|
||||||
|
The port uses the generated WIFI address plus 1 as Bluetooth MAC address.
|
||||||
|
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user