To get started with Seeed Tiny BLE, include detecting motion, button and battery level.
Dependencies: BLE_API eMPL_MPU6050 mbed nRF51822
nRF51822/nordic-sdk/components/ble/common/ble_srv_common.c@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 | /* Copyright (c) 2012 Nordic Semiconductor. All Rights Reserved. |
yihui | 1:fc2f9d636751 | 2 | * |
yihui | 1:fc2f9d636751 | 3 | * The information contained herein is property of Nordic Semiconductor ASA. |
yihui | 1:fc2f9d636751 | 4 | * Terms and conditions of usage are described in detail in NORDIC |
yihui | 1:fc2f9d636751 | 5 | * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. |
yihui | 1:fc2f9d636751 | 6 | * |
yihui | 1:fc2f9d636751 | 7 | * Licensees are granted free, non-transferable use of the information. NO |
yihui | 1:fc2f9d636751 | 8 | * WARRANTY of ANY KIND is provided. This heading must NOT be removed from |
yihui | 1:fc2f9d636751 | 9 | * the file. |
yihui | 1:fc2f9d636751 | 10 | * |
yihui | 1:fc2f9d636751 | 11 | */ |
yihui | 1:fc2f9d636751 | 12 | |
yihui | 1:fc2f9d636751 | 13 | /* Attention! |
yihui | 1:fc2f9d636751 | 14 | * To maintain compliance with Nordic Semiconductor ASAs Bluetooth profile |
yihui | 1:fc2f9d636751 | 15 | * qualification listings, this section of source code must not be modified. |
yihui | 1:fc2f9d636751 | 16 | */ |
yihui | 1:fc2f9d636751 | 17 | |
yihui | 1:fc2f9d636751 | 18 | #include "ble_srv_common.h" |
yihui | 1:fc2f9d636751 | 19 | #include <string.h> |
yihui | 1:fc2f9d636751 | 20 | #include "nordic_common.h" |
yihui | 1:fc2f9d636751 | 21 | #include "app_error.h" |
yihui | 1:fc2f9d636751 | 22 | |
yihui | 1:fc2f9d636751 | 23 | |
yihui | 1:fc2f9d636751 | 24 | uint8_t ble_srv_report_ref_encode(uint8_t * p_encoded_buffer, |
yihui | 1:fc2f9d636751 | 25 | const ble_srv_report_ref_t * p_report_ref) |
yihui | 1:fc2f9d636751 | 26 | { |
yihui | 1:fc2f9d636751 | 27 | uint8_t len = 0; |
yihui | 1:fc2f9d636751 | 28 | |
yihui | 1:fc2f9d636751 | 29 | p_encoded_buffer[len++] = p_report_ref->report_id; |
yihui | 1:fc2f9d636751 | 30 | p_encoded_buffer[len++] = p_report_ref->report_type; |
yihui | 1:fc2f9d636751 | 31 | |
yihui | 1:fc2f9d636751 | 32 | APP_ERROR_CHECK_BOOL(len == BLE_SRV_ENCODED_REPORT_REF_LEN); |
yihui | 1:fc2f9d636751 | 33 | return len; |
yihui | 1:fc2f9d636751 | 34 | } |
yihui | 1:fc2f9d636751 | 35 | |
yihui | 1:fc2f9d636751 | 36 | |
yihui | 1:fc2f9d636751 | 37 | void ble_srv_ascii_to_utf8(ble_srv_utf8_str_t * p_utf8, char * p_ascii) |
yihui | 1:fc2f9d636751 | 38 | { |
yihui | 1:fc2f9d636751 | 39 | p_utf8->length = (uint16_t)strlen(p_ascii); |
yihui | 1:fc2f9d636751 | 40 | p_utf8->p_str = (uint8_t *)p_ascii; |
yihui | 1:fc2f9d636751 | 41 | } |