info.c 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /*
  2. * =====================================================================================
  3. *
  4. * ________ .__ __ ________ ____ ________
  5. * \_____ \ __ __|__| ____ | | __\______ \ _______ _/_ |/ _____/
  6. * / / \ \| | \ |/ ___\| |/ / | | \_/ __ \ \/ /| / __ \
  7. * / \_/. \ | / \ \___| < | ` \ ___/\ / | \ |__\ \
  8. * \_____\ \_/____/|__|\___ >__|_ \/_______ /\___ >\_/ |___|\_____ /
  9. * \__> \/ \/ \/ \/ \/
  10. *
  11. * www.optixx.org
  12. *
  13. *
  14. * Version: 1.0
  15. * Created: 07/21/2009 03:32:16 PM
  16. * Author: david@optixx.org
  17. *
  18. * =====================================================================================
  19. */
  20. #include <stdlib.h>
  21. #include <stdint.h>
  22. #include <avr/pgmspace.h>
  23. #include "info.h"
  24. #include "uart.h"
  25. #include "config.h"
  26. extern FILE uart_stdout;
  27. #if defined(NO_INFO) && defined(__GNUC__)
  28. #define info(format, args...) ((void)0)
  29. #else
  30. void info(char *format, ...)
  31. {
  32. #ifdef NO_INFO
  33. #else
  34. va_list args;
  35. va_start(args, format);
  36. vprintf(format, args);
  37. va_end(args);
  38. #endif
  39. }
  40. #endif
  41. #ifndef NO_INFO
  42. uint8_t buffer_info[FORMAT_BUFFER_LEN];
  43. #endif
  44. #if defined(NO_INFO) && defined(__GNUC__)
  45. #define info(format, args...) ((void)0)
  46. #else
  47. void info_P(PGM_P format, ...)
  48. {
  49. #ifdef NO_INFO
  50. #else
  51. strlcpy_P((char *) buffer_info, format, FORMAT_BUFFER_LEN);
  52. va_list args;
  53. va_start(args, format);
  54. vprintf((char *) buffer_info, args);
  55. va_end(args);
  56. #endif
  57. }
  58. #endif