SHA1 / SHA256 and HMAC-SHA1 / HMAC-SHA256 Hash library
SHA1 / SHA256 and HMAC-SHA1 / HMACSHA256 Hash library
printf.h
1 /*
2  Copyright (C) 2011 J. Coliz <maniacbug@ymail.com>
3 
4  This program is free software; you can redistribute it and/or
5  modify it under the terms of the GNU General Public License
6  version 2 as published by the Free Software Foundation.
7  */
8  /* Galileo support from spaniakos <spaniakos@gmail.com> */
9 
17 #ifndef __PRINTF_H__
18 #define __PRINTF_H__
19 
20 #if defined (ARDUINO) && !defined (__arm__) && !defined(__ARDUINO_X86__)
21 
22 int serial_putc( char c, FILE * )
23 {
24  Serial.write( c );
25 
26  return c;
27 }
28 
29 void printf_begin(void)
30 {
31  fdevopen( &serial_putc, 0 );
32 }
33 
34 #elif defined (__arm__)
35 
36 void printf_begin(void){}
37 
38 #elif defined(__ARDUINO_X86__)
39 int serial_putc( char c, FILE * )
40 {
41  Serial.write( c );
42 
43  return c;
44 }
45 
46 void printf_begin(void)
47 {
48  //JESUS - For reddirect stdout to /dev/ttyGS0 (Serial Monitor port)
49  stdout = freopen("/dev/ttyGS0","w",stdout);
50  delay(500);
51  printf("redirecting to Serial...");
52 
53  //JESUS -----------------------------------------------------------
54 }
55 #else
56 #error This example is only for use on Arduino.
57 #endif // ARDUINO
58 
59 #endif // __PRINTF_H__