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.
Dependencies: mbed HC_SR04_Ultrasonic_Library
BLE_BlueNRG/utils/inc/Utils.h@3:829f081fde15, 2015-05-19 (annotated)
- Committer:
- julientiron
- Date:
- Tue May 19 20:42:25 2015 +0000
- Revision:
- 3:829f081fde15
- Parent:
- 0:3d641e170a74
hihi;
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| julientiron | 0:3d641e170a74 | 1 | /* mbed Microcontroller Library |
| julientiron | 0:3d641e170a74 | 2 | * Copyright (c) 2006-2013 ARM Limited |
| julientiron | 0:3d641e170a74 | 3 | * |
| julientiron | 0:3d641e170a74 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| julientiron | 0:3d641e170a74 | 5 | * you may not use this file except in compliance with the License. |
| julientiron | 0:3d641e170a74 | 6 | * You may obtain a copy of the License at |
| julientiron | 0:3d641e170a74 | 7 | * |
| julientiron | 0:3d641e170a74 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| julientiron | 0:3d641e170a74 | 9 | * |
| julientiron | 0:3d641e170a74 | 10 | * Unless required by applicable law or agreed to in writing, software |
| julientiron | 0:3d641e170a74 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| julientiron | 0:3d641e170a74 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| julientiron | 0:3d641e170a74 | 13 | * See the License for the specific language governing permissions and |
| julientiron | 0:3d641e170a74 | 14 | * limitations under the License. |
| julientiron | 0:3d641e170a74 | 15 | */ |
| julientiron | 0:3d641e170a74 | 16 | |
| julientiron | 0:3d641e170a74 | 17 | #include "hal_types.h" |
| julientiron | 0:3d641e170a74 | 18 | #include "mbed.h" |
| julientiron | 0:3d641e170a74 | 19 | |
| julientiron | 0:3d641e170a74 | 20 | // utility functions |
| julientiron | 0:3d641e170a74 | 21 | |
| julientiron | 0:3d641e170a74 | 22 | #ifndef __UTIL_H__ |
| julientiron | 0:3d641e170a74 | 23 | #define __UTIL_H__ |
| julientiron | 0:3d641e170a74 | 24 | |
| julientiron | 0:3d641e170a74 | 25 | #define NEED_CONSOLE_OUTPUT 1 /* Set this if you need debug messages on the console; |
| julientiron | 0:3d641e170a74 | 26 | * it will have an impact on code-size and power consumption. */ |
| julientiron | 0:3d641e170a74 | 27 | |
| julientiron | 0:3d641e170a74 | 28 | #if NEED_CONSOLE_OUTPUT |
| julientiron | 0:3d641e170a74 | 29 | //Serial usb(USBTX, USBRX); // tx, rx |
| julientiron | 0:3d641e170a74 | 30 | extern Serial pc; |
| julientiron | 0:3d641e170a74 | 31 | #define DEBUG(...) { pc.printf(__VA_ARGS__); } |
| julientiron | 0:3d641e170a74 | 32 | #else |
| julientiron | 0:3d641e170a74 | 33 | #define DEBUG(...) /* nothing */ |
| julientiron | 0:3d641e170a74 | 34 | #endif /* #if NEED_CONSOLE_OUTPUT */ |
| julientiron | 0:3d641e170a74 | 35 | |
| julientiron | 0:3d641e170a74 | 36 | #define STORE_LE_16(buf, val) ( ((buf)[0] = (tHalUint8) (val) ) , \ |
| julientiron | 0:3d641e170a74 | 37 | ((buf)[1] = (tHalUint8) (val>>8) ) ) |
| julientiron | 0:3d641e170a74 | 38 | |
| julientiron | 0:3d641e170a74 | 39 | #define STORE_LE_32(buf, val) ( ((buf)[0] = (tHalUint8) (val) ) , \ |
| julientiron | 0:3d641e170a74 | 40 | ((buf)[1] = (tHalUint8) (val>>8) ) , \ |
| julientiron | 0:3d641e170a74 | 41 | ((buf)[2] = (tHalUint8) (val>>16) ) , \ |
| julientiron | 0:3d641e170a74 | 42 | ((buf)[3] = (tHalUint8) (val>>24) ) ) |
| julientiron | 0:3d641e170a74 | 43 | |
| julientiron | 0:3d641e170a74 | 44 | |
| julientiron | 0:3d641e170a74 | 45 | double getHighPowerAndPALevelValue(int8_t dBMLevel, int8_t& EN_HIGH_POWER, int8_t& PA_LEVEL); |
| julientiron | 0:3d641e170a74 | 46 | |
| julientiron | 0:3d641e170a74 | 47 | #endif // __UTIL_H__ |