Libraries and Example of mbed parallel bus using I2C port expanders
Dependencies: HDSP253X mbed PCF8574_Bus
Dbg.cpp@7:8680b8b718c8, 2015-01-25 (annotated)
- Committer:
- wim
- Date:
- Sun Jan 25 17:52:55 2015 +0000
- Revision:
- 7:8680b8b718c8
- Parent:
- 2:1dab1089c332
Test of PCF8574 Bus interface to control HDSP253X Smart Alphanumeric LED matrix display.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
wim |
2:1dab1089c332 | 1 | |
wim |
2:1dab1089c332 | 2 | /* |
wim |
2:1dab1089c332 | 3 | Copyright (c) 2010 Donatien Garnier (donatiengar [at] gmail [dot] com) |
wim |
2:1dab1089c332 | 4 | |
wim |
2:1dab1089c332 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy |
wim |
2:1dab1089c332 | 6 | of this software and associated documentation files (the "Software"), to deal |
wim |
2:1dab1089c332 | 7 | in the Software without restriction, including without limitation the rights |
wim |
2:1dab1089c332 | 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
wim |
2:1dab1089c332 | 9 | copies of the Software, and to permit persons to whom the Software is |
wim |
2:1dab1089c332 | 10 | furnished to do so, subject to the following conditions: |
wim |
2:1dab1089c332 | 11 | |
wim |
2:1dab1089c332 | 12 | The above copyright notice and this permission notice shall be included in |
wim |
2:1dab1089c332 | 13 | all copies or substantial portions of the Software. |
wim |
2:1dab1089c332 | 14 | |
wim |
2:1dab1089c332 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
wim |
2:1dab1089c332 | 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
wim |
2:1dab1089c332 | 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
wim |
2:1dab1089c332 | 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
wim |
2:1dab1089c332 | 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
wim |
2:1dab1089c332 | 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
wim |
2:1dab1089c332 | 21 | THE SOFTWARE. |
wim |
2:1dab1089c332 | 22 | */ |
wim |
2:1dab1089c332 | 23 | |
wim |
2:1dab1089c332 | 24 | #define __DEBUG |
wim |
2:1dab1089c332 | 25 | #include "Dbg.h" |
wim |
2:1dab1089c332 | 26 | #include "mbed.h" |
wim |
2:1dab1089c332 | 27 | #include <cstdarg> |
wim |
2:1dab1089c332 | 28 | |
wim |
2:1dab1089c332 | 29 | void DebugStream::debug(const char* format, ...) |
wim |
2:1dab1089c332 | 30 | { |
wim |
2:1dab1089c332 | 31 | va_list argp; |
wim |
2:1dab1089c332 | 32 | |
wim |
2:1dab1089c332 | 33 | va_start(argp, format); |
wim |
2:1dab1089c332 | 34 | vprintf(format, argp); |
wim |
2:1dab1089c332 | 35 | va_end(argp); |
wim |
2:1dab1089c332 | 36 | } |
wim |
2:1dab1089c332 | 37 | |
wim |
2:1dab1089c332 | 38 | void DebugStream::release() |
wim |
2:1dab1089c332 | 39 | { |
wim |
2:1dab1089c332 | 40 | |
wim |
2:1dab1089c332 | 41 | } |
wim |
2:1dab1089c332 | 42 | |
wim |
2:1dab1089c332 | 43 | void DebugStream::breakPoint(const char* file, int line) |
wim |
2:1dab1089c332 | 44 | { |
wim |
2:1dab1089c332 | 45 | printf("\r\nBREAK in %s at line %d\r\n", file, line); |
wim |
2:1dab1089c332 | 46 | fflush(stdout); |
wim |
2:1dab1089c332 | 47 | getchar(); |
wim |
2:1dab1089c332 | 48 | fflush(stdin); |
wim |
2:1dab1089c332 | 49 | } |
wim |
2:1dab1089c332 | 50 | |
wim |
2:1dab1089c332 | 51 | /* |
wim |
2:1dab1089c332 | 52 | int snprintf(char *str, int size, const char *format, ...) |
wim |
2:1dab1089c332 | 53 | { |
wim |
2:1dab1089c332 | 54 | va_list argp; |
wim |
2:1dab1089c332 | 55 | |
wim |
2:1dab1089c332 | 56 | va_start(argp, format); |
wim |
2:1dab1089c332 | 57 | vsprintf(str, format, argp); |
wim |
2:1dab1089c332 | 58 | va_end(argp); |
wim |
2:1dab1089c332 | 59 | |
wim |
2:1dab1089c332 | 60 | return strlen(str); |
wim |
2:1dab1089c332 | 61 | } |
wim |
2:1dab1089c332 | 62 | */ |