To get started with Seeed Tiny BLE, include detecting motion, button and battery level.
Dependencies: BLE_API eMPL_MPU6050 mbed nRF51822
nRF51822/btle/btle_advertising.cpp@1:fc2f9d636751, 2015-04-22 (annotated)
- Committer:
- yihui
- Date:
- Wed Apr 22 07:47:17 2015 +0000
- Revision:
- 1:fc2f9d636751
update libraries; ; delete nRF51822/nordic-sdk/components/gpiote/app_gpiote.c to solve GPIOTE_IRQHandler multiply defined issue. temperarily change nRF51822 library to folder
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
yihui | 1:fc2f9d636751 | 1 | /* mbed Microcontroller Library |
yihui | 1:fc2f9d636751 | 2 | * Copyright (c) 2006-2013 ARM Limited |
yihui | 1:fc2f9d636751 | 3 | * |
yihui | 1:fc2f9d636751 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
yihui | 1:fc2f9d636751 | 5 | * you may not use this file except in compliance with the License. |
yihui | 1:fc2f9d636751 | 6 | * You may obtain a copy of the License at |
yihui | 1:fc2f9d636751 | 7 | * |
yihui | 1:fc2f9d636751 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
yihui | 1:fc2f9d636751 | 9 | * |
yihui | 1:fc2f9d636751 | 10 | * Unless required by applicable law or agreed to in writing, software |
yihui | 1:fc2f9d636751 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
yihui | 1:fc2f9d636751 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
yihui | 1:fc2f9d636751 | 13 | * See the License for the specific language governing permissions and |
yihui | 1:fc2f9d636751 | 14 | * limitations under the License. |
yihui | 1:fc2f9d636751 | 15 | */ |
yihui | 1:fc2f9d636751 | 16 | #include "common/common.h" |
yihui | 1:fc2f9d636751 | 17 | |
yihui | 1:fc2f9d636751 | 18 | #include "ble_advdata.h" |
yihui | 1:fc2f9d636751 | 19 | #include "btle.h" |
yihui | 1:fc2f9d636751 | 20 | |
yihui | 1:fc2f9d636751 | 21 | /**************************************************************************/ |
yihui | 1:fc2f9d636751 | 22 | /*! |
yihui | 1:fc2f9d636751 | 23 | @brief Starts the advertising process |
yihui | 1:fc2f9d636751 | 24 | |
yihui | 1:fc2f9d636751 | 25 | @returns |
yihui | 1:fc2f9d636751 | 26 | */ |
yihui | 1:fc2f9d636751 | 27 | /**************************************************************************/ |
yihui | 1:fc2f9d636751 | 28 | error_t btle_advertising_start(void) |
yihui | 1:fc2f9d636751 | 29 | { |
yihui | 1:fc2f9d636751 | 30 | ble_gap_adv_params_t adv_para = {0}; |
yihui | 1:fc2f9d636751 | 31 | |
yihui | 1:fc2f9d636751 | 32 | /* Set the default advertising parameters */ |
yihui | 1:fc2f9d636751 | 33 | adv_para.type = BLE_GAP_ADV_TYPE_ADV_IND; |
yihui | 1:fc2f9d636751 | 34 | adv_para.p_peer_addr = NULL; /* Undirected advertising */ |
yihui | 1:fc2f9d636751 | 35 | adv_para.fp = BLE_GAP_ADV_FP_ANY; |
yihui | 1:fc2f9d636751 | 36 | adv_para.p_whitelist = NULL; |
yihui | 1:fc2f9d636751 | 37 | adv_para.interval = (CFG_GAP_ADV_INTERVAL_MS * 8) / 5; /* Advertising |
yihui | 1:fc2f9d636751 | 38 | * interval in |
yihui | 1:fc2f9d636751 | 39 | * units of 0.625 |
yihui | 1:fc2f9d636751 | 40 | * ms */ |
yihui | 1:fc2f9d636751 | 41 | adv_para.timeout = CFG_GAP_ADV_TIMEOUT_S; |
yihui | 1:fc2f9d636751 | 42 | |
yihui | 1:fc2f9d636751 | 43 | ASSERT_STATUS( sd_ble_gap_adv_start(&adv_para)); |
yihui | 1:fc2f9d636751 | 44 | |
yihui | 1:fc2f9d636751 | 45 | return ERROR_NONE; |
yihui | 1:fc2f9d636751 | 46 | } |