Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: NNN50_CE_Test_UDP NNN50_linux_firmware NNN50_SoftAP_HelloWorld NNN50_BLEWIFISensor ... more
nmi2c.h
00001 /** 00002 * 00003 * \file 00004 * 00005 * \brief This module contains NMC1000 I2C protocol bus APIs implementation. 00006 * 00007 * Copyright (c) 2016 Atmel Corporation. All rights reserved. 00008 * 00009 * \asf_license_start 00010 * 00011 * \page License 00012 * 00013 * Redistribution and use in source and binary forms, with or without 00014 * modification, are permitted provided that the following conditions are met: 00015 * 00016 * 1. Redistributions of source code must retain the above copyright notice, 00017 * this list of conditions and the following disclaimer. 00018 * 00019 * 2. Redistributions in binary form must reproduce the above copyright notice, 00020 * this list of conditions and the following disclaimer in the documentation 00021 * and/or other materials provided with the distribution. 00022 * 00023 * 3. The name of Atmel may not be used to endorse or promote products derived 00024 * from this software without specific prior written permission. 00025 * 00026 * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED 00027 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 00028 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE 00029 * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR 00030 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00031 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 00032 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 00033 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 00034 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 00035 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00036 * POSSIBILITY OF SUCH DAMAGE. 00037 * 00038 * \asf_license_stop 00039 * 00040 */ 00041 00042 #ifndef _NMI2C_H_ 00043 #define _NMI2C_H_ 00044 00045 #include "common/include/nm_common.h" 00046 00047 /** 00048 * @fn nm_i2c_read_reg 00049 * @brief Read register 00050 * @param [in] u32Addr 00051 * Register address 00052 * @return Register value 00053 */ 00054 uint32 nm_i2c_read_reg(uint32 u32Addr); 00055 00056 /** 00057 * @fn nm_i2c_read_reg_with_ret 00058 * @brief Read register with error code return 00059 * @param [in] u32Addr 00060 * Register address 00061 * @param [out] pu32RetVal 00062 * Pointer to u32 variable used to return the read value 00063 * @return ZERO in case of success and M2M_ERR_BUS_FAIL in case of failure 00064 */ 00065 sint8 nm_i2c_read_reg_with_ret(uint32 u32Addr, uint32* pu32RetVal); 00066 00067 /** 00068 * @fn nm_i2c_write_reg 00069 * @brief write register 00070 * @param [in] u32Addr 00071 * Register address 00072 * @param [in] u32Val 00073 * Value to be written to the register 00074 * @return ZERO in case of success and M2M_ERR_BUS_FAIL in case of failure 00075 */ 00076 sint8 nm_i2c_write_reg(uint32 u32Addr, uint32 u32Val); 00077 00078 /** 00079 * @fn nm_i2c_read_block 00080 * @brief Read block of data 00081 * @param [in] u32Addr 00082 * Start address 00083 * @param [out] puBuf 00084 * Pointer to a buffer used to return the read data 00085 * @param [in] u16Sz 00086 * Number of bytes to read. The buffer size must be >= u16Sz 00087 * @return ZERO in case of success and M2M_ERR_BUS_FAIL in case of failure 00088 */ 00089 sint8 nm_i2c_read_block(uint32 u32Addr, uint8 *puBuf, uint16 u16Sz); 00090 00091 /** 00092 * @fn nm_i2c_write_block 00093 * @brief Write block of data 00094 * @param [in] u32Addr 00095 * Start address 00096 * @param [in] puBuf 00097 * Pointer to the buffer holding the data to be written 00098 * @param [in] u16Sz 00099 * Number of bytes to write. The buffer size must be >= u16Sz 00100 * @return ZERO in case of success and M2M_ERR_BUS_FAIL in case of failure 00101 */ 00102 sint8 nm_i2c_write_block(uint32 u32Addr, uint8 *puBuf, uint16 u16Sz); 00103 00104 #endif /* _NMI2C_H_ */ 00105
Generated on Wed Jul 13 2022 16:32:37 by
1.7.2