2011-03-19 03:32:34 +00:00
|
|
|
/*
|
|
|
|
Copyright (C) 2011 James Coliz, Jr. <maniacbug@ymail.com>
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License
|
|
|
|
version 2 as published by the Free Software Foundation.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @file printf.h
|
|
|
|
*
|
|
|
|
* Setup necessary to direct stdout to the Arduino Serial library, which
|
|
|
|
* enables 'printf'
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __PRINTF_H__
|
|
|
|
#define __PRINTF_H__
|
|
|
|
|
2011-06-28 04:22:39 +00:00
|
|
|
int serial_putc( char c, FILE * )
|
2011-03-19 03:32:34 +00:00
|
|
|
{
|
|
|
|
Serial.write( c );
|
2011-04-24 18:34:05 +00:00
|
|
|
|
|
|
|
return c;
|
2011-03-19 03:32:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void printf_begin(void)
|
|
|
|
{
|
|
|
|
fdevopen( &serial_putc, 0 );
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // __PRINTF_H__
|