Optimized high speed nRF24L01+ driver class documentation v1.4.8
TMRh20 2020 - Optimized fork of the nRF24L01+ driver
Loading...
Searching...
No Matches
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_ARCH_AVR) || defined(__ARDUINO_X86__) || defined(ARDUINO_ARCH_MEGAAVR)
21
22int serial_putc(char c, FILE*)
23{
24 Serial.write(c);
25 return c;
26}
27
28#elif defined(ARDUINO_ARCH_MBED)
29REDIRECT_STDOUT_TO(Serial);
30
31#endif // defined (ARDUINO_ARCH_AVR) || defined (__ARDUINO_X86__) || defined (ARDUINO_ARCH_MBED) || defined (ARDUINO_ARCH_MEGAAVR)
32
33void printf_begin(void)
34{
35#if defined(ARDUINO_ARCH_AVR) || defined(ARDUINO_ARCH_MEGAAVR)
36 fdevopen(&serial_putc, 0);
37
38#elif defined(__ARDUINO_X86__)
39 // For redirect stdout to /dev/ttyGS0 (Serial Monitor port)
40 stdout = freopen("/dev/ttyGS0", "w", stdout);
41 delay(500);
42 printf("Redirecting to Serial...");
43#endif // defined(__ARDUINO_X86__)
44}
45
46#endif // __PRINTF_H__
#define delay(milisec)
void printf_begin(void)
Definition printf.h:33