From 02a989c26bf0c9aee229a4343897534e82f4efd1 Mon Sep 17 00:00:00 2001 From: lottaviano Date: Thu, 9 Jul 2009 08:56:56 +0000 Subject: [PATCH] doc: Add example for KFileFifo git-svn-id: https://src.develer.com/svnoss/bertos/trunk@2752 38d2e660-2303-0410-9eaa-f027e97ec537 --- bertos/struct/kfile_fifo.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) 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 */ -- 2.25.1