From: lottaviano Date: Thu, 9 Jul 2009 08:56:56 +0000 (+0000) Subject: doc: Add example for KFileFifo X-Git-Tag: 2.2.0~216 X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=02a989c26bf0c9aee229a4343897534e82f4efd1;p=bertos.git doc: Add example for KFileFifo git-svn-id: https://src.develer.com/svnoss/bertos/trunk@2752 38d2e660-2303-0410-9eaa-f027e97ec537 --- diff --git a/bertos/struct/kfile_fifo.h b/bertos/struct/kfile_fifo.h index 5d9ba5c2..b5842786 100644 --- a/bertos/struct/kfile_fifo.h +++ b/bertos/struct/kfile_fifo.h @@ -32,6 +32,27 @@ * * \brief KFile interface over a FIFO buffer. * + * Convenient way to push data into a FIFO using the KFile interface. + * For example, it's possible to read from a serial port and put the characters + * into a fifo: + * \code + * // serial reader process + * { + * // other stuff here... + * kfile_read(&ser_port.fd, buffer, sizeof(buffer)); + * kfile_write(&kfifo.fd, buffer, sizeof(buffer)); + * // ... + * } + * + * // controller process + * { + * //... + * kfile_read(&kfifo.fd, buffer2, sizeof(buffer2)); + * // use read data + * } + * \endcode + * + * * \version $Id: cfg_adc.h 2348 2009-02-16 13:43:44Z duplo $ * \author Francesco Sacchi * @@ -65,6 +86,12 @@ INLINE KFileFifo * KFILEFIFO_CAST(KFile *fd) return (KFileFifo *)fd; } +/** + * Initialize KFileFifo struct. + * + * \param kf Interface to initialize. + * \param fifo Fifo buffer to operate on. + */ void kfilefifo_init(KFileFifo *kf, FIFOBuffer *fifo); #endif /* STRUCT_KFILE_FIFO */