Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of BLE_BlueNRG by
BlueNRGDevice.cpp
00001 /* mbed Microcontroller Library 00002 * Copyright (c) 2006-2013 ARM Limited 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 00017 #include "mbed.h" 00018 #include "BlueNRGDevice.h" 00019 00020 #include "btle.h" 00021 00022 /** 00023 * The singleton which represents the BlueNRG transport for the BLEDevice. 00024 */ 00025 static BlueNRGDevice deviceInstance; 00026 00027 /** 00028 * BLE-API requires an implementation of the following function in order to 00029 * obtain its transport handle. 00030 */ 00031 BLEDeviceInstanceBase * 00032 createBLEDeviceInstance(void) 00033 { 00034 return (&deviceInstance); 00035 } 00036 00037 /**************************************************************************/ 00038 /*! 00039 @brief Constructor 00040 */ 00041 /**************************************************************************/ 00042 BlueNRGDevice::BlueNRGDevice(void) 00043 { 00044 } 00045 00046 /**************************************************************************/ 00047 /*! 00048 @brief Destructor 00049 */ 00050 /**************************************************************************/ 00051 BlueNRGDevice::~BlueNRGDevice(void) 00052 { 00053 } 00054 00055 /**************************************************************************/ 00056 /*! 00057 @brief Initialises anything required to start using BLE 00058 00059 @returns ble_error_t 00060 00061 @retval BLE_ERROR_NONE 00062 Everything executed properly 00063 00064 @section EXAMPLE 00065 00066 @code 00067 00068 @endcode 00069 */ 00070 /**************************************************************************/ 00071 ble_error_t BlueNRGDevice::init(void) 00072 { 00073 /* ToDo: Clear memory contents, reset the SD, etc. */ 00074 btle_init(); 00075 00076 return BLE_ERROR_NONE; 00077 } 00078 00079 /**************************************************************************/ 00080 /*! 00081 @brief Resets the BLE HW, removing any existing services and 00082 characteristics 00083 00084 @returns ble_error_t 00085 00086 @retval BLE_ERROR_NONE 00087 Everything executed properly 00088 00089 @section EXAMPLE 00090 00091 @code 00092 00093 @endcode 00094 */ 00095 /**************************************************************************/ 00096 ble_error_t BlueNRGDevice::reset(void) 00097 { 00098 wait(0.5); 00099 00100 /* Reset BlueNRG SPI interface */ 00101 //BlueNRG_RST(); 00102 00103 /* Wait for the radio to come back up */ 00104 wait(1); 00105 00106 return BLE_ERROR_NONE; 00107 } 00108 00109 void BlueNRGDevice::waitForEvent(void) 00110 { 00111 HCI_Process();//Send App Events?? 00112 00113 }
Generated on Tue Jul 12 2022 16:24:20 by
1.7.2
