Преглед изворни кода

component/bt : modify some files adapt to new master

1. fix some header files include
2. modify demo
Tian Hao пре 9 година
родитељ
комит
1c877be609
21 измењених фајлова са 13 додато и 136 уклоњено
  1. 1 1
      components/bt/bluedroid/hci/hci_hal_h4.c
  2. 1 1
      components/bt/bluedroid/hci/hci_layer.c
  3. 2 10
      components/bt/bluedroid/include/bt_defs.h
  4. 2 0
      components/bt/bluedroid/include/bt_trace.h
  5. 1 0
      components/bt/include/bt.h
  6. 0 123
      examples/05_bluedroid_demos/sdkconfig
  7. 0 0
      examples/06_bluedroid_demos/Makefile
  8. 0 0
      examples/06_bluedroid_demos/README.rst
  9. 0 0
      examples/06_bluedroid_demos/components/bluedroid_demos/app_client_profiles/battery_c/battery_c.c
  10. 0 0
      examples/06_bluedroid_demos/components/bluedroid_demos/app_core/bt_app.c
  11. 0 0
      examples/06_bluedroid_demos/components/bluedroid_demos/app_core/bt_app_core.c
  12. 0 0
      examples/06_bluedroid_demos/components/bluedroid_demos/app_profiles/app_sample_button/app_button.c
  13. 0 0
      examples/06_bluedroid_demos/components/bluedroid_demos/app_project/SampleClientProject.c
  14. 0 0
      examples/06_bluedroid_demos/components/bluedroid_demos/app_project/SampleServerProject.c
  15. 0 0
      examples/06_bluedroid_demos/components/bluedroid_demos/component.mk
  16. 0 0
      examples/06_bluedroid_demos/components/bluedroid_demos/include/app_button.h
  17. 0 0
      examples/06_bluedroid_demos/components/bluedroid_demos/include/bt_app_common.h
  18. 0 0
      examples/06_bluedroid_demos/components/bluedroid_demos/include/bt_app_defs.h
  19. 0 0
      examples/06_bluedroid_demos/components/bluedroid_demos/include/gattc_profile.h
  20. 0 0
      examples/06_bluedroid_demos/main/component.mk
  21. 6 1
      examples/06_bluedroid_demos/main/demo_main.c

+ 1 - 1
components/bt/bluedroid/hci/hci_hal_h4.c

@@ -24,8 +24,8 @@
 #include "hci_hal.h"
 #include "hci_internals.h"
 #include "hci_layer.h"
-
 #include "thread.h"
+#include "bt.h"
 
 #define HCI_HAL_SERIAL_BUFFER_SIZE 1026
 #define HCI_BLE_EVENT 0x3e

+ 1 - 1
components/bt/bluedroid/hci/hci_layer.c

@@ -16,7 +16,7 @@
  *
  ******************************************************************************/
 #include <string.h>
-
+#include "bt.h"
 #include "bt_defs.h"
 #include "bt_trace.h"
 #include "hcidefs.h"

+ 2 - 10
components/bt/bluedroid/include/bt_defs.h

@@ -69,7 +69,7 @@ inline uint32_t swap_byte_32(uint32_t x) {
           ((x & 0x00ff0000UL) >> 8) |
           ((x & 0xff000000UL) >> 24));
 }
-
+#ifndef ntohs
 inline uint16_t ntohs(uint16_t x) {
 #ifdef CPU_LITTLE_ENDIAN
   return swap_byte_16(x);
@@ -77,14 +77,6 @@ inline uint16_t ntohs(uint16_t x) {
   return x;
 #endif
 }
-
-typedef struct vhci_host_callback {
-    void (*notify_host_send_available)(void);
-    int (*notify_host_recv)(uint8_t *data, uint16_t len);
-} vhci_host_callback_t;
-
-bool API_vhci_host_check_send_available(void);
-void API_vhci_host_send_packet(uint8_t *data, uint16_t len);
-void API_vhci_host_register_callback(const vhci_host_callback_t *callback);
+#endif
 
 #endif /* _BT_DEFS_H_ */

+ 2 - 0
components/bt/bluedroid/include/bt_trace.h

@@ -24,7 +24,9 @@
 #include "rom/ets_sys.h"
 //extern void ets_printf(const char *fmt, ...);
 
+#ifndef assert
 #define assert(x)	do { if (!(x)) ets_printf("bt host error %s %u\n", __FILE__, __LINE__); } while (0)
+#endif
 
 inline void trc_dump_buffer(uint8_t *prefix, uint8_t *data, uint16_t len)
 {

+ 1 - 0
components/bt/include/bt.h

@@ -16,6 +16,7 @@
 #define __BT_H__
 
 #include <stdint.h>
+#include <stdbool.h>
 #include "esp_err.h"
 
 #ifdef __cplusplus

+ 0 - 123
examples/05_bluedroid_demos/sdkconfig

@@ -1,123 +0,0 @@
-#
-# Automatically generated file; DO NOT EDIT.
-# Espressif IoT Development Framework Configuration
-#
-
-#
-# SDK tool configuration
-#
-CONFIG_TOOLPREFIX="xtensa-esp32-elf-"
-CONFIG_PYTHON="python"
-
-#
-# Bootloader config
-#
-# CONFIG_LOG_BOOTLOADER_LEVEL_NONE is not set
-# CONFIG_LOG_BOOTLOADER_LEVEL_ERROR is not set
-CONFIG_LOG_BOOTLOADER_LEVEL_WARN=y
-# CONFIG_LOG_BOOTLOADER_LEVEL_INFO is not set
-# CONFIG_LOG_BOOTLOADER_LEVEL_DEBUG is not set
-# CONFIG_LOG_BOOTLOADER_LEVEL_VERBOSE is not set
-CONFIG_LOG_BOOTLOADER_LEVEL=2
-
-#
-# Serial flasher config
-#
-CONFIG_ESPTOOLPY_PORT="/dev/tty.usbserial-AK05BX2L"
-# CONFIG_ESPTOOLPY_BAUD_115200B is not set
-# CONFIG_ESPTOOLPY_BAUD_230400B is not set
-CONFIG_ESPTOOLPY_BAUD_921600B=y
-# CONFIG_ESPTOOLPY_BAUD_2MB is not set
-# CONFIG_ESPTOOLPY_BAUD_OTHER is not set
-CONFIG_ESPTOOLPY_BAUD_OTHER_VAL=115200
-CONFIG_ESPTOOLPY_BAUD=921600
-CONFIG_ESPTOOLPY_COMPRESSED=y
-# CONFIG_ESPTOOLPY_FLASHMODE_QIO is not set
-# CONFIG_ESPTOOLPY_FLASHMODE_QOUT is not set
-CONFIG_ESPTOOLPY_FLASHMODE_DIO=y
-# CONFIG_ESPTOOLPY_FLASHMODE_DOUT is not set
-CONFIG_ESPTOOLPY_FLASHMODE="dio"
-# CONFIG_ESPTOOLPY_FLASHFREQ_80M is not set
-CONFIG_ESPTOOLPY_FLASHFREQ_40M=y
-# CONFIG_ESPTOOLPY_FLASHFREQ_26M is not set
-# CONFIG_ESPTOOLPY_FLASHFREQ_20M is not set
-CONFIG_ESPTOOLPY_FLASHFREQ="40m"
-
-#
-# Partition Table
-#
-CONFIG_PARTITION_TABLE_SINGLE_APP=y
-# CONFIG_PARTITION_TABLE_TWO_OTA is not set
-# CONFIG_PARTITION_TABLE_CUSTOM is not set
-CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv"
-CONFIG_PARTITION_TABLE_CUSTOM_APP_BIN_OFFSET=0x10000
-CONFIG_PARTITION_TABLE_FILENAME="partitions_singleapp.csv"
-CONFIG_APP_OFFSET=0x10000
-
-#
-# Component config
-#
-
-#
-# BT config
-#
-CONFIG_BT_ENABLED=y
-
-#
-# ESP32-specific config
-#
-CONFIG_ESP32_DEFAULT_CPU_FREQ_80=y
-# CONFIG_ESP32_DEFAULT_CPU_FREQ_160 is not set
-# CONFIG_ESP32_DEFAULT_CPU_FREQ_240 is not set
-CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ=80
-# CONFIG_ESP32_ENABLE_STACK_WIFI is not set
-CONFIG_ESP32_ENABLE_STACK_BT=y
-# CONFIG_ESP32_ENABLE_STACK_NONE is not set
-CONFIG_MEMMAP_BT=y
-CONFIG_MEMMAP_SMP=y
-# CONFIG_MEMMAP_TRACEMEM is not set
-# CONFIG_MEMMAP_SPISRAM is not set
-CONFIG_NEWLIB_STDOUT_ADDCR=y
-
-#
-# FreeRTOS
-#
-# CONFIG_FREERTOS_UNICORE is not set
-CONFIG_FREERTOS_CORETIMER_0=y
-# CONFIG_FREERTOS_CORETIMER_1 is not set
-# CONFIG_FREERTOS_CORETIMER_2 is not set
-CONFIG_FREERTOS_HZ=100
-CONFIG_FREERTOS_CHECK_STACKOVERFLOW_NONE=y
-# CONFIG_FREERTOS_CHECK_STACKOVERFLOW_PTRVAL is not set
-# CONFIG_FREERTOS_CHECK_STACKOVERFLOW_CANARY is not set
-CONFIG_FREERTOS_THREAD_LOCAL_STORAGE_POINTERS=1
-# CONFIG_FREERTOS_PANIC_PRINT_HALT is not set
-CONFIG_FREERTOS_PANIC_PRINT_REBOOT=y
-# CONFIG_FREERTOS_PANIC_SILENT_REBOOT is not set
-# CONFIG_FREERTOS_PANIC_GDBSTUB is not set
-CONFIG_FREERTOS_DEBUG_OCDAWARE=y
-CONFIG_FREERTOS_ASSERT_FAIL_ABORT=y
-# CONFIG_FREERTOS_ASSERT_FAIL_PRINT_CONTINUE is not set
-# CONFIG_FREERTOS_ASSERT_DISABLE is not set
-CONFIG_FREERTOS_BREAK_ON_SCHEDULER_START_JTAG=y
-# CONFIG_ENABLE_MEMORY_DEBUG is not set
-# CONFIG_FREERTOS_DEBUG_INTERNALS is not set
-
-#
-# Log output
-#
-# CONFIG_LOG_DEFAULT_LEVEL_NONE is not set
-# CONFIG_LOG_DEFAULT_LEVEL_ERROR is not set
-# CONFIG_LOG_DEFAULT_LEVEL_WARN is not set
-CONFIG_LOG_DEFAULT_LEVEL_INFO=y
-# CONFIG_LOG_DEFAULT_LEVEL_DEBUG is not set
-# CONFIG_LOG_DEFAULT_LEVEL_VERBOSE is not set
-CONFIG_LOG_DEFAULT_LEVEL=3
-CONFIG_LOG_COLORS=y
-
-#
-# LWIP
-#
-CONFIG_LWIP_MAX_SOCKETS=4
-CONFIG_LWIP_THREAD_LOCAL_STORAGE_INDEX=0
-# CONFIG_LWIP_SO_REUSE is not set

+ 0 - 0
examples/05_bluedroid_demos/Makefile → examples/06_bluedroid_demos/Makefile


+ 0 - 0
examples/05_bluedroid_demos/README.rst → examples/06_bluedroid_demos/README.rst


+ 0 - 0
examples/05_bluedroid_demos/components/bluedroid_demos/app_client_profiles/battery_c/battery_c.c → examples/06_bluedroid_demos/components/bluedroid_demos/app_client_profiles/battery_c/battery_c.c


+ 0 - 0
examples/05_bluedroid_demos/components/bluedroid_demos/app_core/bt_app.c → examples/06_bluedroid_demos/components/bluedroid_demos/app_core/bt_app.c


+ 0 - 0
examples/05_bluedroid_demos/components/bluedroid_demos/app_core/bt_app_core.c → examples/06_bluedroid_demos/components/bluedroid_demos/app_core/bt_app_core.c


+ 0 - 0
examples/05_bluedroid_demos/components/bluedroid_demos/app_profiles/app_sample_button/app_button.c → examples/06_bluedroid_demos/components/bluedroid_demos/app_profiles/app_sample_button/app_button.c


+ 0 - 0
examples/05_bluedroid_demos/components/bluedroid_demos/app_project/SampleClientProject.c → examples/06_bluedroid_demos/components/bluedroid_demos/app_project/SampleClientProject.c


+ 0 - 0
examples/05_bluedroid_demos/components/bluedroid_demos/app_project/SamleServerProject.c → examples/06_bluedroid_demos/components/bluedroid_demos/app_project/SampleServerProject.c


+ 0 - 0
examples/05_bluedroid_demos/components/bluedroid_demos/component.mk → examples/06_bluedroid_demos/components/bluedroid_demos/component.mk


+ 0 - 0
examples/05_bluedroid_demos/components/bluedroid_demos/include/app_button.h → examples/06_bluedroid_demos/components/bluedroid_demos/include/app_button.h


+ 0 - 0
examples/05_bluedroid_demos/components/bluedroid_demos/include/bt_app_common.h → examples/06_bluedroid_demos/components/bluedroid_demos/include/bt_app_common.h


+ 0 - 0
examples/05_bluedroid_demos/components/bluedroid_demos/include/bt_app_defs.h → examples/06_bluedroid_demos/components/bluedroid_demos/include/bt_app_defs.h


+ 0 - 0
examples/05_bluedroid_demos/components/bluedroid_demos/include/gattc_profile.h → examples/06_bluedroid_demos/components/bluedroid_demos/include/gattc_profile.h


+ 0 - 0
examples/05_bluedroid_demos/main/component.mk → examples/06_bluedroid_demos/main/component.mk


+ 6 - 1
examples/05_bluedroid_demos/main/demo_main.c → examples/06_bluedroid_demos/main/demo_main.c

@@ -1,6 +1,10 @@
 #include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include "bt.h"
 #include "freertos/FreeRTOS.h"
 #include "freertos/task.h"
+#include "string.h"
 
 
 extern void bte_main_boot_entry(void *);
@@ -15,8 +19,9 @@ void pingTask(void *pvParameters)
     }
 }
 
-void bt_app_main()
+void app_main()
 {
+    bt_controller_init();
     xTaskCreatePinnedToCore(&pingTask, "pingTask", 2048, NULL, 5, NULL, 0);
     bt_app_task_start_up();
     bte_main_boot_entry(bt_app_core_start);