3      Copyright (C) Dean Camera, 2010. 
   5   dean [at] fourwalledcubicle [dot] com 
   6       www.fourwalledcubicle.com 
  10   Copyright 2010  Dean Camera (dean [at] fourwalledcubicle [dot] com) 
  12   Permission to use, copy, modify, distribute, and sell this  
  13   software and its documentation for any purpose is hereby granted 
  14   without fee, provided that the above copyright notice appear in  
  15   all copies and that both that the copyright notice and this 
  16   permission notice and warranty disclaimer appear in supporting  
  17   documentation, and that the name of the author not be used in  
  18   advertising or publicity pertaining to distribution of the  
  19   software without specific, written prior permission. 
  21   The author disclaim all warranties with regard to this 
  22   software, including all implied warranties of merchantability 
  23   and fitness.  In no event shall the author be liable for any 
  24   special, indirect or consequential damages or any damages 
  25   whatsoever resulting from loss of use, data or profits, whether 
  26   in an action of contract, negligence or other tortious action, 
  27   arising out of or in connection with the use or performance of 
  32  *  \brief Standard avr-libc character stream driver for the USART. 
  34  *  Serial stream driver for the USART subsystem on supported USB AVRs. This makes use of the functions in the 
  35  *  regular USART driver (see \ref Group_Serial), but allows the avr-libc standard stream functions (printf, 
  36  *  puts, etc.) to work with the 
  40 /** \ingroup Group_PeripheralDrivers 
  41  *  @defgroup Group_SerialStream Serial Stream Driver - LUFA/Drivers/Peripheral/SerialStream.h 
  43  *  \section Sec_Dependencies Module Source Dependencies 
  44  *  The following files must be built with any user project that uses this module: 
  45  *    - LUFA/Drivers/Peripheral/SerialStream.c 
  47  *  \section Module Description 
  48  *  Serial stream driver for the USART subsystem on supported USB AVRs. This makes use of the functions in the 
  49  *  regular USART driver (see \ref Group_Serial), but allows the avr-libc standard stream functions (printf, 
  50  *  puts, etc.) to work with the 
  56 #ifndef __SERIAL_STREAM_H__ 
  57 #define __SERIAL_STREAM_H__ 
  65         /* Enable C linkage for C++ Compilers: */ 
  66                 #if defined(__cplusplus) 
  70         /* Private Interface - For use in library only: */       
  71         #if !defined(__DOXYGEN__) 
  72                 /* External Variables: */ 
  73                         extern FILE USARTStream
; 
  75                 /* Function Prototypes: */ 
  76                 #if defined(__INCLUDE_FROM_SERIALSTREAM_C) 
  77                         static int SerialStream_TxByte(char DataByte
, FILE *Stream
) ATTR_NON_NULL_PTR_ARG(2); 
  78                         static int SerialStream_RxByte(FILE *Stream
) ATTR_NON_NULL_PTR_ARG(1); 
  82         /* Public Interface - May be used in end-application: */ 
  83                 /* Inline Functions: */ 
  84                         /** Initializes the serial stream (and regular USART driver) so that both the stream and regular 
  85                          *  USART driver functions can be used. Must be called before any stream or regular USART functions. 
  87                          *  \param[in] BaudRate     Baud rate to configure the USART to. 
  88                          *  \param[in] DoubleSpeed  Enables double speed mode when set, halving the sample time to double the baud rate. 
  90                         static inline void SerialStream_Init(const uint32_t BaudRate
, const bool DoubleSpeed
) 
  92                                 Serial_Init(BaudRate
, DoubleSpeed
); 
  94                                 stdout 
= &USARTStream
; 
  98                         /** Turns off the serial stream (and regular USART driver), disabling and returning used hardware to 
  99                          *  their default configuration. 
 101                         static inline void SerialStream_ShutDown(void) 
 106         /* Disable C linkage for C++ Compilers: */ 
 107                 #if defined(__cplusplus)