HW layer for the Nucleo board, it only work with old BLE_API
Dependents: Hello_BLE F446RE-BLE
Fork of X_NUCLEO_IDB0XA1 by
utils/inc/Utils.h@50:898acb5227fc, 2014-09-15 (annotated)
- Committer:
- mridup
- Date:
- Mon Sep 15 13:19:08 2014 +0000
- Revision:
- 50:898acb5227fc
- Parent:
- 46:01f97cfcc109
- Child:
- 58:027c65a54097
Initial 128-bit support in Service and Characteristic addition
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
hemddabral | 12:a5d7db4a1e49 | 1 | /* mbed Microcontroller Library |
hemddabral | 12:a5d7db4a1e49 | 2 | * Copyright (c) 2006-2013 ARM Limited |
hemddabral | 12:a5d7db4a1e49 | 3 | * |
hemddabral | 12:a5d7db4a1e49 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
hemddabral | 12:a5d7db4a1e49 | 5 | * you may not use this file except in compliance with the License. |
hemddabral | 12:a5d7db4a1e49 | 6 | * You may obtain a copy of the License at |
hemddabral | 12:a5d7db4a1e49 | 7 | * |
hemddabral | 12:a5d7db4a1e49 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
hemddabral | 12:a5d7db4a1e49 | 9 | * |
hemddabral | 12:a5d7db4a1e49 | 10 | * Unless required by applicable law or agreed to in writing, software |
hemddabral | 12:a5d7db4a1e49 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
hemddabral | 12:a5d7db4a1e49 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
hemddabral | 12:a5d7db4a1e49 | 13 | * See the License for the specific language governing permissions and |
hemddabral | 12:a5d7db4a1e49 | 14 | * limitations under the License. |
hemddabral | 12:a5d7db4a1e49 | 15 | */ |
hemddabral | 12:a5d7db4a1e49 | 16 | |
hemddabral | 12:a5d7db4a1e49 | 17 | #include "hal_types.h" |
hemddabral | 16:8aeb0c44869b | 18 | #include "mbed.h" |
hemddabral | 12:a5d7db4a1e49 | 19 | |
hemddabral | 12:a5d7db4a1e49 | 20 | // utility functions |
hemddabral | 12:a5d7db4a1e49 | 21 | |
hemddabral | 12:a5d7db4a1e49 | 22 | #ifndef __UTIL_H__ |
hemddabral | 12:a5d7db4a1e49 | 23 | #define __UTIL_H__ |
hemddabral | 12:a5d7db4a1e49 | 24 | |
hemddabral | 16:8aeb0c44869b | 25 | #define NEED_CONSOLE_OUTPUT 1 /* Set this if you need debug messages on the console; |
hemddabral | 16:8aeb0c44869b | 26 | * it will have an impact on code-size and power consumption. */ |
hemddabral | 16:8aeb0c44869b | 27 | |
hemddabral | 16:8aeb0c44869b | 28 | #if NEED_CONSOLE_OUTPUT |
mridup | 17:63059fcb8db2 | 29 | //Serial usb(USBTX, USBRX); // tx, rx |
hemddabral | 16:8aeb0c44869b | 30 | extern Serial pc; |
hemddabral | 16:8aeb0c44869b | 31 | #define DEBUG(...) { pc.printf(__VA_ARGS__); } |
hemddabral | 16:8aeb0c44869b | 32 | #else |
hemddabral | 16:8aeb0c44869b | 33 | #define DEBUG(...) /* nothing */ |
hemddabral | 16:8aeb0c44869b | 34 | #endif /* #if NEED_CONSOLE_OUTPUT */ |
hemddabral | 16:8aeb0c44869b | 35 | |
mridup | 46:01f97cfcc109 | 36 | #define STORE_LE_16(buf, val) ( ((buf)[0] = (tHalUint8) (val) ) , \ |
mridup | 46:01f97cfcc109 | 37 | ((buf)[1] = (tHalUint8) (val>>8) ) ) |
mridup | 46:01f97cfcc109 | 38 | |
mridup | 46:01f97cfcc109 | 39 | #define STORE_LE_32(buf, val) ( ((buf)[0] = (tHalUint8) (val) ) , \ |
mridup | 46:01f97cfcc109 | 40 | ((buf)[1] = (tHalUint8) (val>>8) ) , \ |
mridup | 46:01f97cfcc109 | 41 | ((buf)[2] = (tHalUint8) (val>>16) ) , \ |
mridup | 46:01f97cfcc109 | 42 | ((buf)[3] = (tHalUint8) (val>>24) ) ) |
mridup | 50:898acb5227fc | 43 | |
mridup | 50:898acb5227fc | 44 | #define COPY_UUID_128(uuid_struct, uuid_15, uuid_14, uuid_13, uuid_12, uuid_11, uuid_10, uuid_9, uuid_8, uuid_7, uuid_6, uuid_5, uuid_4, uuid_3, uuid_2, uuid_1, uuid_0) \ |
mridup | 50:898acb5227fc | 45 | do {\ |
mridup | 50:898acb5227fc | 46 | uuid_struct[0] = uuid_0; uuid_struct[1] = uuid_1; uuid_struct[2] = uuid_2; uuid_struct[3] = uuid_3; \ |
mridup | 50:898acb5227fc | 47 | uuid_struct[4] = uuid_4; uuid_struct[5] = uuid_5; uuid_struct[6] = uuid_6; uuid_struct[7] = uuid_7; \ |
mridup | 50:898acb5227fc | 48 | uuid_struct[8] = uuid_8; uuid_struct[9] = uuid_9; uuid_struct[10] = uuid_10; uuid_struct[11] = uuid_11; \ |
mridup | 50:898acb5227fc | 49 | uuid_struct[12] = uuid_12; uuid_struct[13] = uuid_13; uuid_struct[14] = uuid_14; uuid_struct[15] = uuid_15; \ |
mridup | 50:898acb5227fc | 50 | }while(0) |
mridup | 50:898acb5227fc | 51 | |
mridup | 50:898acb5227fc | 52 | |
hemddabral | 12:a5d7db4a1e49 | 53 | double getHighPowerAndPALevelValue(int8_t dBMLevel, int8_t& EN_HIGH_POWER, int8_t& PA_LEVEL); |
hemddabral | 12:a5d7db4a1e49 | 54 | |
hemddabral | 12:a5d7db4a1e49 | 55 | #endif // __UTIL_H__ |