Press buttons to activate the LED.
Dependencies: BLE_API nRF51822
Fork of Puck by
Log.h@12:8a8cc109f048, 2014-08-05 (annotated)
- Committer:
- cristea
- Date:
- Tue Aug 05 08:34:51 2014 +0000
- Revision:
- 12:8a8cc109f048
- Parent:
- 7:c07c01c2a741
- Child:
- 25:cd6703df9501
Add license
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
cristea | 12:8a8cc109f048 | 1 | /** |
cristea | 12:8a8cc109f048 | 2 | * Copyright 2014 Nordic Semiconductor |
cristea | 12:8a8cc109f048 | 3 | * |
cristea | 12:8a8cc109f048 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
cristea | 12:8a8cc109f048 | 5 | * you may not use this file except in compliance with the License. |
cristea | 12:8a8cc109f048 | 6 | * You may obtain a copy of the License at |
cristea | 12:8a8cc109f048 | 7 | * |
cristea | 12:8a8cc109f048 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
cristea | 12:8a8cc109f048 | 9 | * |
cristea | 12:8a8cc109f048 | 10 | * Unless required by applicable law or agreed to in writing, software |
cristea | 12:8a8cc109f048 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
cristea | 12:8a8cc109f048 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
cristea | 12:8a8cc109f048 | 13 | * See the License for the specific language governing permissions and |
cristea | 12:8a8cc109f048 | 14 | * limitations under the License |
cristea | 12:8a8cc109f048 | 15 | */ |
cristea | 12:8a8cc109f048 | 16 | |
cristea | 12:8a8cc109f048 | 17 | |
cristea | 7:c07c01c2a741 | 18 | #ifndef __LOG__H__ |
cristea | 7:c07c01c2a741 | 19 | #define __LOG__H__ |
cristea | 7:c07c01c2a741 | 20 | |
cristea | 7:c07c01c2a741 | 21 | |
cristea | 7:c07c01c2a741 | 22 | #ifdef LOG_LEVEL_VERBOSE |
cristea | 7:c07c01c2a741 | 23 | #define __PUCK_LOG_LEVEL_VERBOSE__ |
cristea | 7:c07c01c2a741 | 24 | #endif |
cristea | 7:c07c01c2a741 | 25 | #ifdef LOG_LEVEL_DEBUG |
cristea | 7:c07c01c2a741 | 26 | #define __PUCK_LOG_LEVEL_DEBUG__ |
cristea | 7:c07c01c2a741 | 27 | #endif |
cristea | 7:c07c01c2a741 | 28 | #ifdef LOG_LEVEL_INFO |
cristea | 7:c07c01c2a741 | 29 | #define __PUCK_LOG_LEVEL_INFO__ |
cristea | 7:c07c01c2a741 | 30 | #endif |
cristea | 7:c07c01c2a741 | 31 | #ifdef LOG_LEVEL_WARN |
cristea | 7:c07c01c2a741 | 32 | #define __PUCK_LOG_LEVEL_WARN__ |
cristea | 7:c07c01c2a741 | 33 | #endif |
cristea | 7:c07c01c2a741 | 34 | #ifdef LOG_LEVEL_ERROR |
cristea | 7:c07c01c2a741 | 35 | #define __PUCK_LOG_LEVEL_ERROR__ |
cristea | 7:c07c01c2a741 | 36 | #endif |
cristea | 7:c07c01c2a741 | 37 | |
cristea | 7:c07c01c2a741 | 38 | #ifdef __PUCK_LOG_LEVEL_VERBOSE__ |
cristea | 7:c07c01c2a741 | 39 | #define LOG_VERBOSE(fmt, ...) do { logger.printf("[V] "); logger.printf(fmt, ##__VA_ARGS__); } while(0) |
cristea | 7:c07c01c2a741 | 40 | #define __PUCK_LOG_LEVEL_DEBUG__ |
cristea | 7:c07c01c2a741 | 41 | #else |
cristea | 7:c07c01c2a741 | 42 | #define LOG_VERBOSE(fmt, ...) |
cristea | 7:c07c01c2a741 | 43 | #endif |
cristea | 7:c07c01c2a741 | 44 | |
cristea | 7:c07c01c2a741 | 45 | #ifdef __PUCK_LOG_LEVEL_DEBUG__ |
cristea | 7:c07c01c2a741 | 46 | #define LOG_DEBUG(fmt, ...) do { logger.printf("[D] "); logger.printf(fmt, ##__VA_ARGS__); } while(0) |
cristea | 7:c07c01c2a741 | 47 | #define __PUCK_LOG_LEVEL_INFO__ |
cristea | 7:c07c01c2a741 | 48 | #else |
cristea | 7:c07c01c2a741 | 49 | #define LOG_DEBUG(fmt, ...) |
cristea | 7:c07c01c2a741 | 50 | #endif |
cristea | 7:c07c01c2a741 | 51 | |
cristea | 7:c07c01c2a741 | 52 | #ifdef __PUCK_LOG_LEVEL_INFO__ |
cristea | 7:c07c01c2a741 | 53 | #define LOG_INFO(fmt, ...) do { logger.printf("[I] "); logger.printf(fmt, ##__VA_ARGS__); } while(0) |
cristea | 7:c07c01c2a741 | 54 | #define __PUCK_LOG_LEVEL_WARN__ |
cristea | 7:c07c01c2a741 | 55 | #else |
cristea | 7:c07c01c2a741 | 56 | #define LOG_INFO(fmt, ...) |
cristea | 7:c07c01c2a741 | 57 | #endif |
cristea | 7:c07c01c2a741 | 58 | |
cristea | 7:c07c01c2a741 | 59 | #ifdef __PUCK_LOG_LEVEL_WARN__ |
cristea | 7:c07c01c2a741 | 60 | #define LOG_WARN(fmt, ...) do { logger.printf("![W] "); logger.printf(fmt, ##__VA_ARGS__); } while(0) |
cristea | 7:c07c01c2a741 | 61 | #define __PUCK_LOG_LEVEL_ERROR__ |
cristea | 7:c07c01c2a741 | 62 | #else |
cristea | 7:c07c01c2a741 | 63 | #define LOG_WARN(fmt, ...) |
cristea | 7:c07c01c2a741 | 64 | #endif |
cristea | 7:c07c01c2a741 | 65 | |
cristea | 7:c07c01c2a741 | 66 | #ifdef __PUCK_LOG_LEVEL_ERROR__ |
cristea | 7:c07c01c2a741 | 67 | #define LOG_ERROR(fmt, ...) do { logger.printf("!![E] "); logger.printf(fmt, ##__VA_ARGS__); } while(0) |
cristea | 7:c07c01c2a741 | 68 | #else |
cristea | 7:c07c01c2a741 | 69 | #define LOG_ERROR(fmt, ...) |
cristea | 7:c07c01c2a741 | 70 | #endif |
cristea | 7:c07c01c2a741 | 71 | |
cristea | 7:c07c01c2a741 | 72 | #ifdef __PUCK_LOG_LEVEL_ERROR__ |
cristea | 7:c07c01c2a741 | 73 | static Serial logger(USBTX, USBRX); |
cristea | 7:c07c01c2a741 | 74 | #endif |
cristea | 7:c07c01c2a741 | 75 | |
cristea | 7:c07c01c2a741 | 76 | |
cristea | 7:c07c01c2a741 | 77 | #endif //__LOG__H__ |