Optimized High Speed NRF24L01+ Driver Class Documenation  V1.0
TMRh20 2014 - Optimized Fork of NRF24L01+ Driver
printf.h
Go to the documentation of this file.
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__
#define delay(milisec)