Mouse code for the MacroRat

Dependencies:   ITG3200 QEI

Committer:
sahilmgandhi
Date:
Sat Jun 03 00:22:44 2017 +0000
Revision:
46:b156ef445742
Parent:
18:6a4db94011d3
Final code for internal battlebot competition.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sahilmgandhi 18:6a4db94011d3 1
sahilmgandhi 18:6a4db94011d3 2 /** \addtogroup platform */
sahilmgandhi 18:6a4db94011d3 3 /** @{*/
sahilmgandhi 18:6a4db94011d3 4 /* mbed Microcontroller Library
sahilmgandhi 18:6a4db94011d3 5 * Copyright (c) 2006-2013 ARM Limited
sahilmgandhi 18:6a4db94011d3 6 *
sahilmgandhi 18:6a4db94011d3 7 * Licensed under the Apache License, Version 2.0 (the "License");
sahilmgandhi 18:6a4db94011d3 8 * you may not use this file except in compliance with the License.
sahilmgandhi 18:6a4db94011d3 9 * You may obtain a copy of the License at
sahilmgandhi 18:6a4db94011d3 10 *
sahilmgandhi 18:6a4db94011d3 11 * http://www.apache.org/licenses/LICENSE-2.0
sahilmgandhi 18:6a4db94011d3 12 *
sahilmgandhi 18:6a4db94011d3 13 * Unless required by applicable law or agreed to in writing, software
sahilmgandhi 18:6a4db94011d3 14 * distributed under the License is distributed on an "AS IS" BASIS,
sahilmgandhi 18:6a4db94011d3 15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
sahilmgandhi 18:6a4db94011d3 16 * See the License for the specific language governing permissions and
sahilmgandhi 18:6a4db94011d3 17 * limitations under the License.
sahilmgandhi 18:6a4db94011d3 18 */
sahilmgandhi 18:6a4db94011d3 19 #ifndef MBED_DEBUG_H
sahilmgandhi 18:6a4db94011d3 20 #define MBED_DEBUG_H
sahilmgandhi 18:6a4db94011d3 21 #if DEVICE_STDIO_MESSAGES
sahilmgandhi 18:6a4db94011d3 22 #include <stdio.h>
sahilmgandhi 18:6a4db94011d3 23 #include <stdarg.h>
sahilmgandhi 18:6a4db94011d3 24 #endif
sahilmgandhi 18:6a4db94011d3 25
sahilmgandhi 18:6a4db94011d3 26 #ifdef __cplusplus
sahilmgandhi 18:6a4db94011d3 27 extern "C" {
sahilmgandhi 18:6a4db94011d3 28 #endif
sahilmgandhi 18:6a4db94011d3 29
sahilmgandhi 18:6a4db94011d3 30
sahilmgandhi 18:6a4db94011d3 31 /** Output a debug message
sahilmgandhi 18:6a4db94011d3 32 *
sahilmgandhi 18:6a4db94011d3 33 * @param format printf-style format string, followed by variables
sahilmgandhi 18:6a4db94011d3 34 */
sahilmgandhi 18:6a4db94011d3 35 static inline void debug(const char *format, ...) {
sahilmgandhi 18:6a4db94011d3 36 #if DEVICE_STDIO_MESSAGES && !defined(NDEBUG)
sahilmgandhi 18:6a4db94011d3 37 va_list args;
sahilmgandhi 18:6a4db94011d3 38 va_start(args, format);
sahilmgandhi 18:6a4db94011d3 39 vfprintf(stderr, format, args);
sahilmgandhi 18:6a4db94011d3 40 va_end(args);
sahilmgandhi 18:6a4db94011d3 41 #endif
sahilmgandhi 18:6a4db94011d3 42 }
sahilmgandhi 18:6a4db94011d3 43
sahilmgandhi 18:6a4db94011d3 44
sahilmgandhi 18:6a4db94011d3 45 /** Conditionally output a debug message
sahilmgandhi 18:6a4db94011d3 46 *
sahilmgandhi 18:6a4db94011d3 47 * NOTE: If the condition is constant false (== 0) and the compiler optimization
sahilmgandhi 18:6a4db94011d3 48 * level is greater than 0, then the whole function will be compiled away.
sahilmgandhi 18:6a4db94011d3 49 *
sahilmgandhi 18:6a4db94011d3 50 * @param condition output only if condition is true (!= 0)
sahilmgandhi 18:6a4db94011d3 51 * @param format printf-style format string, followed by variables
sahilmgandhi 18:6a4db94011d3 52 */
sahilmgandhi 18:6a4db94011d3 53 static inline void debug_if(int condition, const char *format, ...) {
sahilmgandhi 18:6a4db94011d3 54 #if DEVICE_STDIO_MESSAGES && !defined(NDEBUG)
sahilmgandhi 18:6a4db94011d3 55 if (condition) {
sahilmgandhi 18:6a4db94011d3 56 va_list args;
sahilmgandhi 18:6a4db94011d3 57 va_start(args, format);
sahilmgandhi 18:6a4db94011d3 58 vfprintf(stderr, format, args);
sahilmgandhi 18:6a4db94011d3 59 va_end(args);
sahilmgandhi 18:6a4db94011d3 60 }
sahilmgandhi 18:6a4db94011d3 61 #endif
sahilmgandhi 18:6a4db94011d3 62 }
sahilmgandhi 18:6a4db94011d3 63
sahilmgandhi 18:6a4db94011d3 64
sahilmgandhi 18:6a4db94011d3 65 #ifdef __cplusplus
sahilmgandhi 18:6a4db94011d3 66 }
sahilmgandhi 18:6a4db94011d3 67 #endif
sahilmgandhi 18:6a4db94011d3 68
sahilmgandhi 18:6a4db94011d3 69 #endif
sahilmgandhi 18:6a4db94011d3 70
sahilmgandhi 18:6a4db94011d3 71 /** @}*/