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_advdata_parser.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 | #include "ble_advdata_parser.h" |
yihui | 1:fc2f9d636751 | 2 | |
yihui | 1:fc2f9d636751 | 3 | uint32_t ble_advdata_parser_field_find(uint8_t type, |
yihui | 1:fc2f9d636751 | 4 | uint8_t * p_advdata, |
yihui | 1:fc2f9d636751 | 5 | uint8_t * len, |
yihui | 1:fc2f9d636751 | 6 | uint8_t ** pp_field_data) |
yihui | 1:fc2f9d636751 | 7 | { |
yihui | 1:fc2f9d636751 | 8 | uint32_t index = 0; |
yihui | 1:fc2f9d636751 | 9 | |
yihui | 1:fc2f9d636751 | 10 | while (index < *len) |
yihui | 1:fc2f9d636751 | 11 | { |
yihui | 1:fc2f9d636751 | 12 | uint8_t field_length = p_advdata[index]; |
yihui | 1:fc2f9d636751 | 13 | uint8_t field_type = p_advdata[index + 1]; |
yihui | 1:fc2f9d636751 | 14 | |
yihui | 1:fc2f9d636751 | 15 | if (field_type == type) |
yihui | 1:fc2f9d636751 | 16 | { |
yihui | 1:fc2f9d636751 | 17 | *pp_field_data = &p_advdata[index + 2]; |
yihui | 1:fc2f9d636751 | 18 | *len = field_length - 1; |
yihui | 1:fc2f9d636751 | 19 | return NRF_SUCCESS; |
yihui | 1:fc2f9d636751 | 20 | } |
yihui | 1:fc2f9d636751 | 21 | index += field_length + 1; |
yihui | 1:fc2f9d636751 | 22 | } |
yihui | 1:fc2f9d636751 | 23 | return NRF_ERROR_NOT_FOUND; |
yihui | 1:fc2f9d636751 | 24 | } |