| PDL for FM0+ Version1.0 Peripheral Driverl Library for FM0+

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

C:/pdl_v10/library/utility/at24cxx/i2c_at24cxx.h
Go to the documentation of this file.

    00001 /*******************************************************************************
    00002 * Copyright (C) 2013 Spansion LLC. All Rights Reserved.
    00003 *
    00004 * This software is owned and published by:
    00005 * Spansion LLC, 915 DeGuigne Dr. Sunnyvale, CA  94088-3453 ("Spansion").
    00006 *
    00007 * BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
    00008 * BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
    00009 *
    00010 * This software contains source code for use with Spansion
    00011 * components. This software is licensed by Spansion to be adapted only
    00012 * for use in systems utilizing Spansion components. Spansion shall not be
    00013 * responsible for misuse or illegal use of this software for devices not
    00014 * supported herein.  Spansion is providing this software "AS IS" and will
    00015 * not be responsible for issues arising from incorrect user implementation
    00016 * of the software.
    00017 *
    00018 * SPANSION MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
    00019 * REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
    00020 * ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
    00021 * WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
    00022 * WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
    00023 * WARRANTY OF NONINFRINGEMENT.
    00024 * SPANSION SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
    00025 * NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
    00026 * LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
    00027 * LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
    00028 * INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
    00029 * INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
    00030 * SAVINGS OR PROFITS,
    00031 * EVEN IF SPANSION HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
    00032 * YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
    00033 * INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
    00034 * FROM, THE SOFTWARE.
    00035 *
    00036 * This software may be replicated in part or whole for the licensed use,
    00037 * with the restriction that this Disclaimer and Copyright notice must be
    00038 * included with each copy of this software, whether used in part or whole,
    00039 * at all times.
    00040 */
    00041 /******************************************************************************/
    00066 #ifndef _I2C_AT24CXX_H_
    00067 #define _I2C_PAT24CXX_H_
    00068
    00069 /******************************************************************************/
    00070 /* Include files                                                              */
    00071 /******************************************************************************/
    00072 #include "pdl_user.h"
    00073 #include "at24cxx_config.h"
    00074 #include "mfs\mfs.h"
    00075 #include "gpio\gpio.h"
    00076
    00077 #if (PDL_UTILITY_ENABLE_I2C_POLLING_AT24CXX == PDL_ON) || \
    00078     (PDL_UTILITY_ENABLE_I2C_INT_AT24CXX == PDL_ON)
    00079
    00111
    00112 /******************************************************************************
    00113  * Global definitions
    00114  ******************************************************************************/
    00116 #define AT24CXX_7BIT_DEVICE_ADDR        (0x50u)
    00117
    00119 #if (PDL_EEPROM_DEVICE == PDL_AT24C01) || \
    00120     (PDL_EEPROM_DEVICE == PDL_AT24C02)
    00121 #define AT24CXX_PAGE_SIZE                      8
    00122 #elif (PDL_EEPROM_DEVICE == PDL_AT24C04) || \
    00123       (PDL_EEPROM_DEVICE == PDL_AT24C08) || \
    00124       (PDL_EEPROM_DEVICE == PDL_AT24C16)
    00125 #define AT24CXX_PAGE_SIZE                      16
    00126 #elif (PDL_EEPROM_DEVICE == PDL_AT24C32) || \
    00127       (PDL_EEPROM_DEVICE == PDL_AT24C64)
    00128 #define AT24CXX_PAGE_SIZE                      32
    00129 #endif
    00130
    00132 #if (PDL_EEPROM_DEVICE == PDL_AT24C01) || \
    00133     (PDL_EEPROM_DEVICE == PDL_AT24C02) || \
    00134     (PDL_EEPROM_DEVICE == PDL_AT24C04) || \
    00135     (PDL_EEPROM_DEVICE == PDL_AT24C08) || \
    00136     (PDL_EEPROM_DEVICE == PDL_AT24C16)
    00137 #define AT24CXX_ADDR_LENGTH                    1
    00138 #else
    00139 #define AT24CXX_ADDR_LENGTH                    2
    00140 #endif
    00141
    00143 #define InitI2cIo(void)  {SetPinFunc_SOT1_1();SetPinFunc_SCK1_1();}
    00144
    00146 #define EE_I2C_CH        &I2C1
    00147
    00148 /*---------------------------------------------------------------------------*/
    00149 /* function prototypes                                                       */
    00150 /*---------------------------------------------------------------------------*/
    00151 #ifdef __cplusplus
    00152 extern "C" {
    00153 #endif
    00154 en_result_t At24cxx_Init(void);
    00155 en_result_t At24cxx_ByteWrite(uint8_t u8DevAddr, uint16_t u16Addr, uint8_t u8Data);
    00156 en_result_t At24cxx_PageWrite(uint8_t u8DevAddr, uint16_t u16PageAddr, uint8_t* pu8Data, uint8_t u8Size);
    00157 en_result_t At24cxx_CurrentAddrRead(uint8_t u8DevAddr, uint8_t* pu8CurData);
    00158 en_result_t At24cxx_RandomRead(uint8_t u8DevAddr, uint16_t u16Addr, uint8_t* pu8Data);
    00159 en_result_t At24cxx_SequentialRead(uint8_t u8DevAddr, uint8_t* pu8Data, uint8_t u8Size);
    00160 void At24cxx_Delayms(uint32_t u32Cnt);
    00161 #ifdef __cplusplus
    00162 }
    00163 #endif
    00164
    00166
    00167 #endif // #if (PDL_UTILITY_ENABLE_I2C_POLLING_AT24CXX == PDL_ON)
    00168
    00169 #endif //  _I2C_AT24CXX_H_
    00170
    00171 /******************************************************************************/
    00172 /* EOF (not truncated)                                                        */
    00173 /******************************************************************************/