Files
2025-05-06 13:07:01 +00:00

306 lines
11 KiB
C

/* ###################################################################
** This component module is generated by Processor Expert. Do not modify it.
** Filename : InputRB1.h
** Project : FRDM-K64F_Generator
** Processor : MK64FN1M0VLL12
** Component : RingBuffer
** Version : Component 01.054, Driver 01.00, CPU db: 3.00.000
** Compiler : GNU C Compiler
** Date/Time : 2020-08-14, 06:24, # CodeGen: 679
** Abstract :
** This component implements a ring buffer for different integer data type.
** Settings :
** Component name : InputRB1
** Buffer Size : 10
** Contents :
** Clear - void InputRB1_Clear(void);
** Put - uint8_t InputRB1_Put(InputRB1_ElementType elem);
** Get - uint8_t InputRB1_Get(InputRB1_ElementType *elemP);
** Peek - uint8_t InputRB1_Peek(InputRB1_BufSizeType index, InputRB1_ElementType *elemP);
** Update - uint8_t InputRB1_Update(InputRB1_BufSizeType index, InputRB1_ElementType...
** Putn - uint8_t InputRB1_Putn(InputRB1_ElementType *elem, InputRB1_BufSizeType nof);
** Getn - uint8_t InputRB1_Getn(InputRB1_ElementType *buf, InputRB1_BufSizeType nof);
** Compare - uint8_t InputRB1_Compare(InputRB1_BufSizeType index, InputRB1_ElementType...
** Delete - uint8_t InputRB1_Delete(void);
** NofElements - InputRB1_BufSizeType InputRB1_NofElements(void);
** NofFreeElements - InputRB1_BufSizeType InputRB1_NofFreeElements(void);
** Deinit - void InputRB1_Deinit(void);
** Init - void InputRB1_Init(void);
**
** * Copyright (c) 2014-2020, Erich Styger
** * Web: https://mcuoneclipse.com
** * SourceForge: https://sourceforge.net/projects/mcuoneclipse
** * Git: https://github.com/ErichStyger/McuOnEclipse_PEx
** * All rights reserved.
** *
** * Redistribution and use in source and binary forms, with or without modification,
** * are permitted provided that the following conditions are met:
** *
** * - Redistributions of source code must retain the above copyright notice, this list
** * of conditions and the following disclaimer.
** *
** * - Redistributions in binary form must reproduce the above copyright notice, this
** * list of conditions and the following disclaimer in the documentation and/or
** * other materials provided with the distribution.
** *
** * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
** * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
** * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
** * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
** * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
** * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
** * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
** * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
** * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
** ###################################################################*/
/*!
** @file InputRB1.h
** @version 01.00
** @brief
** This component implements a ring buffer for different integer data type.
*/
/*!
** @addtogroup InputRB1_module InputRB1 module documentation
** @{
*/
#ifndef __InputRB1_H
#define __InputRB1_H
/* MODULE InputRB1. */
#include "McuLib.h" /* SDK and API used */
#include "InputRB1config.h" /* configuration */
/* Include inherited components */
#include "McuLib.h"
#include "McuCriticalSection.h"
#ifdef __cplusplus
extern "C" {
#endif
#if InputRB1_CONFIG_ELEM_SIZE==1
typedef uint8_t InputRB1_ElementType; /* type of single element */
#elif InputRB1_CONFIG_ELEM_SIZE==2
typedef uint16_t InputRB1_ElementType; /* type of single element */
#elif InputRB1_CONFIG_ELEM_SIZE==4
typedef uint32_t InputRB1_ElementType; /* type of single element */
#else
#error "illegal element type size in properties"
#endif
#if InputRB1_CONFIG_BUF_SIZE<256
typedef uint8_t InputRB1_BufSizeType; /* up to 255 elements (index 0x00..0xff) */
#else
typedef uint16_t InputRB1_BufSizeType; /* more than 255 elements, up to 2^16 */
#endif
uint8_t InputRB1_Put(InputRB1_ElementType elem);
/*
** ===================================================================
** Method : Put (component RingBuffer)
**
** Description :
** Puts a new element into the buffer
** Parameters :
** NAME - DESCRIPTION
** elem - New element to be put into the buffer
** Returns :
** --- - Error code
** ===================================================================
*/
uint8_t InputRB1_Get(InputRB1_ElementType *elemP);
/*
** ===================================================================
** Method : Get (component RingBuffer)
**
** Description :
** Removes an element from the buffer
** Parameters :
** NAME - DESCRIPTION
** * elemP - Pointer to where to store the received
** element
** Returns :
** --- - Error code
** ===================================================================
*/
InputRB1_BufSizeType InputRB1_NofElements(void);
/*
** ===================================================================
** Method : NofElements (component RingBuffer)
**
** Description :
** Returns the actual number of elements in the buffer.
** Parameters : None
** Returns :
** --- - Number of elements in the buffer.
** ===================================================================
*/
void InputRB1_Init(void);
/*
** ===================================================================
** Method : Init (component RingBuffer)
**
** Description :
** Initializes the data structure
** Parameters : None
** Returns : Nothing
** ===================================================================
*/
InputRB1_BufSizeType InputRB1_NofFreeElements(void);
/*
** ===================================================================
** Method : NofFreeElements (component RingBuffer)
**
** Description :
** Returns the actual number of free elements/space in the
** buffer.
** Parameters : None
** Returns :
** --- - Number of elements in the buffer.
** ===================================================================
*/
void InputRB1_Clear(void);
/*
** ===================================================================
** Method : Clear (component RingBuffer)
**
** Description :
** Clear (empty) the ring buffer.
** Parameters : None
** Returns : Nothing
** ===================================================================
*/
uint8_t InputRB1_Peek(InputRB1_BufSizeType index, InputRB1_ElementType *elemP);
/*
** ===================================================================
** Method : Peek (component RingBuffer)
**
** Description :
** Returns an element of the buffer without removiing it.
** Parameters :
** NAME - DESCRIPTION
** index - Index of element. 0 peeks the top
** element, 1 the next, and so on.
** * elemP - Pointer to where to store the received
** element
** Returns :
** --- - Error code
** ===================================================================
*/
#define InputRB1_Deinit() \
/* nothing to deinitialize */
/*
** ===================================================================
** Method : Deinit (component RingBuffer)
**
** Description :
** Driver de-initialization
** Parameters : None
** Returns : Nothing
** ===================================================================
*/
uint8_t InputRB1_Delete(void);
/*
** ===================================================================
** Method : Delete (component RingBuffer)
**
** Description :
** Removes an element from the buffer
** Parameters : None
** Returns :
** --- - Error code
** ===================================================================
*/
uint8_t InputRB1_Putn(InputRB1_ElementType *elem, InputRB1_BufSizeType nof);
/*
** ===================================================================
** Method : Putn (component RingBuffer)
**
** Description :
** Put a number new element into the buffer.
** Parameters :
** NAME - DESCRIPTION
** * elem - Pointer to new elements to be put into
** the buffer
** nof - number of elements
** Returns :
** --- - Error code
** ===================================================================
*/
uint8_t InputRB1_Compare(InputRB1_BufSizeType index, InputRB1_ElementType *elemP, InputRB1_BufSizeType nof);
/*
** ===================================================================
** Method : Compare (component RingBuffer)
**
** Description :
** Compares the elements in the buffer.
** Parameters :
** NAME - DESCRIPTION
** index - Index of element. 0 peeks the top
** element, 1 the next, and so on.
** * elemP - Pointer to elements to compare with
** nof - number of elements to compare
** Returns :
** --- - zero if elements are the same, -1 otherwise
** ===================================================================
*/
uint8_t InputRB1_Getn(InputRB1_ElementType *buf, InputRB1_BufSizeType nof);
/*
** ===================================================================
** Method : Getn (component RingBuffer)
**
** Description :
** Get a number elements into a buffer.
** Parameters :
** NAME - DESCRIPTION
** * buf - Pointer to buffer where to store the
** elements
** nof - number of elements
** Returns :
** --- - Error code
** ===================================================================
*/
uint8_t InputRB1_Update(InputRB1_BufSizeType index, InputRB1_ElementType *elemP);
/*
** ===================================================================
** Method : Update (component RingBuffer)
**
** Description :
** Updates the data of an element.
** Parameters :
** NAME - DESCRIPTION
** index - Index of element. 0 peeks the top
** element, 1 the next, and so on.
** * elemP - Pointer to where to store the received
** element
** Returns :
** --- - Error code
** ===================================================================
*/
/* END InputRB1. */
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif
/* ifndef __InputRB1_H */
/*!
** @}
*/