/* ################################################################### ** This component module is generated by Processor Expert. Do not modify it. ** Filename : McuI2CSpy.h ** Project : FRDM-K64F_Generator ** Processor : MK64FN1M0VLL12 ** Component : I2CSpy ** Version : Component 01.017, Driver 01.00, CPU db: 3.00.000 ** Compiler : GNU C Compiler ** Date/Time : 2020-08-13, 18:42, # CodeGen: 675 ** Abstract : ** This component implements a utility to inspect devices on the I2C bus. ** Settings : ** Component name : McuI2CSpy ** I2C : McuGenericI2C ** Default Address : 0x0 ** Default Address Size : 1 ** Default Bytes per Line : 8 ** Shell : Enabled ** Shell : McuShell ** Utility : McuUtility ** Contents : ** SetDeviceAddress - uint8_t McuI2CSpy_SetDeviceAddress(uint8_t addr); ** GetDeviceAddress - uint8_t McuI2CSpy_GetDeviceAddress(void); ** SetAddressSize - uint8_t McuI2CSpy_SetAddressSize(uint8_t size); ** SetBytesPerLine - uint8_t McuI2CSpy_SetBytesPerLine(uint8_t nofBytesPerLine); ** ReadRegData - uint8_t McuI2CSpy_ReadRegData(uint32_t addr, uint8_t *data, size_t dataSize); ** WriteRegData - uint8_t McuI2CSpy_WriteRegData(uint32_t addr, uint8_t *data, uint16_t dataSize); ** ParseCommand - uint8_t McuI2CSpy_ParseCommand(const unsigned char *cmd, bool *handled, const... ** Deinit - void McuI2CSpy_Deinit(void); ** Init - uint8_t McuI2CSpy_Init(void); ** ** * Copyright (c) 2013-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 McuI2CSpy.h ** @version 01.00 ** @brief ** This component implements a utility to inspect devices on the I2C bus. */ /*! ** @addtogroup McuI2CSpy_module McuI2CSpy module documentation ** @{ */ #ifndef __McuI2CSpy_H #define __McuI2CSpy_H /* MODULE McuI2CSpy. */ #include "McuLib.h" /* SDK and API used */ #include "McuI2CSpyconfig.h" /* configuration */ /* Include inherited components */ #include "McuGenericI2C.h" #include "McuLib.h" #include "McuShell.h" #include "McuUtility.h" #define McuI2CSpy_PARSE_COMMAND_ENABLED 1 /* set to 1 if method ParseCommand() is present, 0 otherwise */ uint8_t McuI2CSpy_Init(void); /* ** =================================================================== ** Method : Init (component I2CSpy) ** ** Description : ** Initialization method ** Parameters : None ** Returns : ** --- - Error code ** =================================================================== */ void McuI2CSpy_Deinit(void); /* ** =================================================================== ** Method : Deinit (component I2CSpy) ** ** Description : ** Deinitialization method ** Parameters : None ** Returns : Nothing ** =================================================================== */ uint8_t McuI2CSpy_SetDeviceAddress(uint8_t addr); /* ** =================================================================== ** Method : SetDeviceAddress (component I2CSpy) ** ** Description : ** Sets the I2C Device address to be used ** Parameters : ** NAME - DESCRIPTION ** addr - I2C 7bit address ** Returns : ** --- - Error code ** =================================================================== */ uint8_t McuI2CSpy_SetAddressSize(uint8_t size); /* ** =================================================================== ** Method : SetAddressSize (component I2CSpy) ** ** Description : ** Specifies the address size of the I2C device memory ** Parameters : ** NAME - DESCRIPTION ** size - Either 1 (8bit), 2 (16bit), 3 (24bit), ** or 4 (32bit) ** Returns : ** --- - Error code ** =================================================================== */ uint8_t McuI2CSpy_SetBytesPerLine(uint8_t nofBytesPerLine); /* ** =================================================================== ** Method : SetBytesPerLine (component I2CSpy) ** ** Description : ** Sets the number of bytes per line for the Dump shell command ** Parameters : ** NAME - DESCRIPTION ** nofBytesPerLine - Number of bytes ** per line ** Returns : ** --- - Error code ** =================================================================== */ void McuGenericI2C_OnRequestBus(void); void McuGenericI2C_OnReleaseBus(void); uint8_t McuI2CSpy_ReadRegData(uint32_t addr, uint8_t *data, size_t dataSize); /* ** =================================================================== ** Method : ReadRegData (component I2CSpy) ** ** Description : ** Reads data starting from a register address from the current ** device ** Parameters : ** NAME - DESCRIPTION ** addr - Device address ** * data - Pointer to data buffer where read data ** is stored ** dataSize - size of data buffer in bytes ** Returns : ** --- - Error code ** =================================================================== */ uint8_t McuI2CSpy_WriteRegData(uint32_t addr, uint8_t *data, uint16_t dataSize); /* ** =================================================================== ** Method : WriteRegData (component I2CSpy) ** ** Description : ** Writes data starting from a register address to the current ** device ** Parameters : ** NAME - DESCRIPTION ** addr - Address in device ** * data - Pointer to data to write ** dataSize - Size of data in bytes ** Returns : ** --- - Error code ** =================================================================== */ uint8_t McuI2CSpy_ParseCommand(const unsigned char *cmd, bool *handled, const McuShell_StdIOType *io); /* ** =================================================================== ** Method : ParseCommand (component I2CSpy) ** ** Description : ** Shell Command Line parser ** Parameters : ** NAME - DESCRIPTION ** * cmd - Pointer to command string ** * handled - Pointer to variable which tells if ** the command has been handled or not ** io - Pointer to I/O structure ** Returns : ** --- - Error code ** =================================================================== */ uint8_t McuI2CSpy_GetDeviceAddress(void); /* ** =================================================================== ** Method : GetDeviceAddress (component I2CSpy) ** ** Description : ** Returns the current I2C Device address used ** Parameters : None ** Returns : ** --- - 7bit Device Address ** =================================================================== */ /* END McuI2CSpy. */ #endif /* ifndef __McuI2CSpy_H */ /*! ** @} */