component/bt : add uart(1/2) as HCI IO directly

This commit is contained in:
Tian Hao
2017-03-16 17:14:20 +08:00
parent 26bf1e8499
commit f5ebeb4c4d
8 changed files with 151 additions and 19 deletions

View File

@@ -0,0 +1,8 @@
#
# This is a project Makefile. It is assumed the directory this Makefile resides in is a
# project subdirectory.
#
PROJECT_NAME := controller_hci_uart
include $(IDF_PATH)/make/project.mk

View File

@@ -0,0 +1,7 @@
ESP-IDF UART HCI Controller
===========================
This is a btdm controller use UART as HCI IO. This require the UART device support RTS/CTS mandatory.
It can do the configuration of UART number and UART baudrate by menuconfig.

View File

@@ -0,0 +1,4 @@
#
# "main" pseudo-component makefile.
#
# (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.)

View File

@@ -0,0 +1,44 @@
// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include <stdio.h>
#include <string.h>
#include "bt.h"
#include "driver/uart.h"
#include "esp_log.h"
static const char *tag = "CONTROLLER_UART_HCI";
static void uart_gpio_reset(void)
{
ESP_LOGI(tag, "HCI UART Pin select: TX 5, RX, 18, CTS 23, RTS 19\n");
#if CONFIG_HCI_UART_NO
uart_set_pin(CONFIG_HCI_UART_NO, 5, 18, 19, 23);
#endif
}
void app_main()
{
/* As the UART1/2 pin conflict with flash pin, so do matrix of the signal and pin */
uart_gpio_reset();
esp_bt_controller_init();
if (esp_bt_controller_enable(ESP_BT_MODE_BTDM) != ESP_OK) {
return;
}
}

View File

@@ -0,0 +1,10 @@
# Override some defaults so BT stack is enabled
# in this example
#
# BT config
#
CONFIG_BT_ENABLED=y
CONFIG_HCI_UART=y
CONFIG_HCI_UART_NO=1
CONFIG_HCI_UART_BAUDRATE=921600