Merge branch 'develop' of https://github.com/bluekitchen/btstack into develop

This commit is contained in:
Matthias Ringwald 2016-07-04 14:21:10 +02:00
commit 42e3fd9c0c
6 changed files with 35 additions and 10 deletions

View File

@ -12,7 +12,7 @@
// BTstack features that can be enabled // BTstack features that can be enabled
#define ENABLE_BLE #define ENABLE_BLE
#define ENABLE_CLASSIC #define ENABLE_CLASSIC
#define ENABLE_LE_SECURE_CONNECTIONS // #define ENABLE_LE_SECURE_CONNECTIONS
#define ENABLE_LOG_ERROR #define ENABLE_LOG_ERROR
#define ENABLE_LOG_INFO #define ENABLE_LOG_INFO

View File

@ -20,6 +20,7 @@ GLOBAL_INCLUDES += .
$(NAME)_SOURCES := ../../../libraries/btstack/example/EXAMPLE.c $(NAME)_SOURCES := ../../../libraries/btstack/example/EXAMPLE.c
$(NAME)_COMPONENTS += btstack/port/wiced $(NAME)_COMPONENTS += btstack/port/wiced
$(NAME)_CFLAGS += ADDITIONAL_CFLAGS
''' '''
gatt_update_template = '''#!/bin/sh gatt_update_template = '''#!/bin/sh
@ -45,7 +46,14 @@ if not "WICED Version" in wiced_version:
sys.exit(1) sys.exit(1)
# show WICED version # show WICED version
print("Found %s" % wiced_version) wiced_version = wiced_version.split()[2]
print("Found WICED SDK version: %s" % wiced_version)
additional_cflags = ""
if wiced_version < "3.4.0":
print("Adding WICED_UART_READ_DOES_NOT_RETURN_BYTES_READ for SDK < 3.4.0")
additional_cflags = "-DWICED_UART_READ_DOES_NOT_RETURN_BYTES_READ"
# path to examples # path to examples
examples_embedded = script_path + "/../../example/" examples_embedded = script_path + "/../../example/"
@ -68,7 +76,7 @@ for file in os.listdir(examples_embedded):
# create .mk file # create .mk file
with open(apps_folder + example + ".mk", "wt") as fout: 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"))) fout.write(mk_template.replace("EXAMPLE", example).replace("TOOL", script_path).replace("ADDITIONAL_CFLAGS", additional_cflags).replace("DATE",time.strftime("%c")))
# create update_gatt.sh if .gatt file is present # create update_gatt.sh if .gatt file is present
gatt_path = examples_embedded + example + ".gatt" gatt_path = examples_embedded + example + ".gatt"

View File

@ -121,10 +121,22 @@ static wiced_result_t h4_main_notify_packet_send(void *arg){
} }
// executed on rx worker thread // executed on rx worker thread
static void h4_rx_worker_receive_bytes(int bytes_to_read){ static void h4_rx_worker_receive_bytes(int bytes_to_read){
#ifdef WICED_UART_READ_DOES_NOT_RETURN_BYTES_READ
// older API passes in number of bytes to read (checked in 3.3.1 and 3.4.0)
platform_uart_receive_bytes(wiced_bt_uart_driver, &hci_packet[rx_worker_read_pos], bytes_to_read, WICED_NEVER_TIMEOUT); platform_uart_receive_bytes(wiced_bt_uart_driver, &hci_packet[rx_worker_read_pos], bytes_to_read, WICED_NEVER_TIMEOUT);
#else
// newer API uses pointer to return number of read bytes
uint32_t bytes = bytes_to_read;
platform_uart_receive_bytes(wiced_bt_uart_driver, &hci_packet[rx_worker_read_pos], &bytes, WICED_NEVER_TIMEOUT);
// assumption: bytes = bytes_to_rad as timeout is never
#endif
rx_worker_read_pos += bytes_to_read; rx_worker_read_pos += bytes_to_read;
} }
static wiced_result_t h4_rx_worker_receive_packet(void * arg){ static wiced_result_t h4_rx_worker_receive_packet(void * arg){
#ifdef WICED_BT_UART_MANUAL_CTS_RTS #ifdef WICED_BT_UART_MANUAL_CTS_RTS

View File

@ -82,7 +82,7 @@ void application_start(void){
// hci_dump_open(NULL, HCI_DUMP_STDOUT); // hci_dump_open(NULL, HCI_DUMP_STDOUT);
// init HCI // init HCI
hci_init(hci_transport_h4_instance(btstack_uart_block_embedded_instance()), (void*) &hci_transport_config_uart); hci_init(hci_transport_h4_instance(NULL), (void*) &hci_transport_config_uart);
hci_set_link_key_db(btstack_link_key_db_memory_instance()); hci_set_link_key_db(btstack_link_key_db_memory_instance());
hci_set_chipset(btstack_chipset_bcm_instance()); hci_set_chipset(btstack_chipset_bcm_instance());

View File

@ -1,6 +1,8 @@
# BTstack port for WICED platform # BTstack port for WICED platform
To integrate BTstack into the WICED SDK, please move the BTstack project into WICED-SDK-X/libraries. Only tested on Redbear Duo platform. Please install [RedBear WICED Add-On](https://github.com/redbear/WICED-SDK) first.
To integrate BTstack into the WICED SDK, please move the BTstack project into WICED-SDK-3.5.2/libraries.
Then create projects for BTstack examples in WICED/apps/btstack by running: Then create projects for BTstack examples in WICED/apps/btstack by running:
./create_examples.py ./create_examples.py
@ -13,15 +15,13 @@ to build the SPP-and-LE-Counter example.
See WICED documentation about how to install it. 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. It should work with all WICED platforms that contain a Broadcom Bluetooth chipset.
The maximal baud rate is limited to 3 mbps. The maximal baud rate is limited to 3 mbps.
The port uses the generated WIFI address plus 1 as Bluetooth MAC address. The port uses the generated WIFI address plus 1 as Bluetooth MAC address.
The examples that implement a BLE Peripheral/provide a GATT Server use the GATT DB in the .gatt file. The examples that implement a BLE Peripheral/provide a GATT Server that uses the GATT DB in the .gatt file.
After modifying the .gatt file, please run ./update_gatt_db.sh in the apps/btstack/$(EXAMPLE) folder. After modifying the .gatt file, please run ./update_gatt_db.sh in the apps/btstack/$(EXAMPLE) folder.

View File

@ -24,6 +24,7 @@ $(NAME)_SOURCES += \
../../src/classic/sdp_client.c \ ../../src/classic/sdp_client.c \
../../src/classic/sdp_client_rfcomm.c \ ../../src/classic/sdp_client_rfcomm.c \
../../src/classic/sdp_util.c \ ../../src/classic/sdp_util.c \
../../src/classic/spp_server.c \
../../src/btstack_linked_list.c \ ../../src/btstack_linked_list.c \
../../src/btstack_memory.c \ ../../src/btstack_memory.c \
../../src/btstack_memory_pool.c \ ../../src/btstack_memory_pool.c \
@ -39,7 +40,11 @@ $(NAME)_SOURCES += \
$(NAME)_SOURCES += \ $(NAME)_SOURCES += \
main.c \ main.c \
btstack_run_loop_wiced.c \ btstack_run_loop_wiced.c \
btstack_uart_block_embedded.c \
hci_transport_h4_wiced.c \ hci_transport_h4_wiced.c \
../../chipset/bcm/btstack_chipset_bcm.c \ ../../chipset/bcm/btstack_chipset_bcm.c \
../../../drivers/bluetooth/firmware/$(BT_CHIP)$(BT_CHIP_REVISION)/bt_firmware_image.c \
ifeq ($(BT_CHIP_XTAL_FREQUENCY),)
$(NAME)_SOURCES := ../../../drivers/bluetooth/firmware/$(BT_CHIP)$(BT_CHIP_REVISION)/bt_firmware_image.c
else
$(NAME)_SOURCES := ../../../drivers/bluetooth/firmware/$(BT_CHIP)$(BT_CHIP_REVISION)/$(BT_CHIP_XTAL_FREQUENCY)/bt_firmware_image.c
endif