print warning and reboot on bluetooth hardware error

This commit is contained in:
Matthias Ringwald 2015-05-18 21:25:23 +02:00
parent d23838ec66
commit 03d7978d74

View File

@ -4,7 +4,8 @@
#include <Arduino.h>
#include <SPI.h>
#include <avr/wdt.h>
#include "BTstack.h"
#include "btstack_memory.h"
@ -596,6 +597,14 @@ void BTstackManager::setPublicBdAddr(bd_addr_t addr){
// static hci_uart_config_t config;
void bluetooth_hardware_error(){
printf("Bluetooth Hardware Error event. Restarting...\n\n\n");
wdt_enable(WDTO_15MS);
// wait for watchdog to trigger
while(1);
}
void BTstackManager::setup(void){
#ifdef PIN_LED
@ -617,6 +626,8 @@ void BTstackManager::setup(void){
hci_set_bd_addr(public_bd_addr);
}
hci_set_hardware_error_callback(&bluetooth_hardware_error);
l2cap_init();
// setup central device db