mbed library sources

Dependents:   Encrypted my_mbed lklk CyaSSL_DTLS_Cellular ... more

Superseded

This library was superseded by mbed-dev - https://os.mbed.com/users/mbed_official/code/mbed-dev/.

Development branch of the mbed library sources. This library is kept in synch with the latest changes from the mbed SDK and it is not guaranteed to work.

If you are looking for a stable and tested release, please import one of the official mbed library releases:

Import librarymbed

The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Committer:
mbed_official
Date:
Fri Sep 04 09:30:10 2015 +0100
Revision:
619:034e698bc035
Synchronized with git revision 92d1bfad30082571776c810a56fd471d30514ccf

Full URL: https://github.com/mbedmicro/mbed/commit/92d1bfad30082571776c810a56fd471d30514ccf/

Change directory structure and move files.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 619:034e698bc035 1 /* mbed Microcontroller Library
mbed_official 619:034e698bc035 2 *******************************************************************************
mbed_official 619:034e698bc035 3 * Copyright (c) 2015 WIZnet Co.,Ltd. All rights reserved.
mbed_official 619:034e698bc035 4 * All rights reserved.
mbed_official 619:034e698bc035 5 *
mbed_official 619:034e698bc035 6 * Redistribution and use in source and binary forms, with or without
mbed_official 619:034e698bc035 7 * modification, are permitted provided that the following conditions are met:
mbed_official 619:034e698bc035 8 *
mbed_official 619:034e698bc035 9 * 1. Redistributions of source code must retain the above copyright notice,
mbed_official 619:034e698bc035 10 * this list of conditions and the following disclaimer.
mbed_official 619:034e698bc035 11 * 2. Redistributions in binary form must reproduce the above copyright notice,
mbed_official 619:034e698bc035 12 * this list of conditions and the following disclaimer in the documentation
mbed_official 619:034e698bc035 13 * and/or other materials provided with the distribution.
mbed_official 619:034e698bc035 14 * 3. Neither the name of ARM Limited nor the names of its contributors
mbed_official 619:034e698bc035 15 * may be used to endorse or promote products derived from this software
mbed_official 619:034e698bc035 16 * without specific prior written permission.
mbed_official 619:034e698bc035 17 *
mbed_official 619:034e698bc035 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
mbed_official 619:034e698bc035 19 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
mbed_official 619:034e698bc035 20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
mbed_official 619:034e698bc035 21 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
mbed_official 619:034e698bc035 22 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
mbed_official 619:034e698bc035 23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
mbed_official 619:034e698bc035 24 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
mbed_official 619:034e698bc035 25 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
mbed_official 619:034e698bc035 26 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
mbed_official 619:034e698bc035 27 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
mbed_official 619:034e698bc035 28 *******************************************************************************
mbed_official 619:034e698bc035 29 */
mbed_official 619:034e698bc035 30 /*include -------------------------------------*/
mbed_official 619:034e698bc035 31 #ifndef __W7500X_I2C_H
mbed_official 619:034e698bc035 32 #define __W7500X_I2C_H
mbed_official 619:034e698bc035 33
mbed_official 619:034e698bc035 34 #include "W7500x.h"
mbed_official 619:034e698bc035 35
mbed_official 619:034e698bc035 36
mbed_official 619:034e698bc035 37 typedef enum {
mbed_official 619:034e698bc035 38 I2C_PA_5 = 0x05,
mbed_official 619:034e698bc035 39 I2C_PA_6 = 0x06,
mbed_official 619:034e698bc035 40 I2C_PA_9 = 0x09,
mbed_official 619:034e698bc035 41 I2C_PA_10 = 0x0A,
mbed_official 619:034e698bc035 42 I2C_PC_4 = 0x24,
mbed_official 619:034e698bc035 43 I2C_PC_5 = 0x25,
mbed_official 619:034e698bc035 44 I2C_PC_8 = 0x28,
mbed_official 619:034e698bc035 45 // Not connected
mbed_official 619:034e698bc035 46 I2C_NC = (int)0xFFFFFFFF
mbed_official 619:034e698bc035 47 } I2C_PinName;
mbed_official 619:034e698bc035 48
mbed_official 619:034e698bc035 49 typedef struct
mbed_official 619:034e698bc035 50 {
mbed_official 619:034e698bc035 51 I2C_PinName scl;
mbed_official 619:034e698bc035 52 I2C_PinName sda;
mbed_official 619:034e698bc035 53 }I2C_ConfigStruct;
mbed_official 619:034e698bc035 54
mbed_official 619:034e698bc035 55
mbed_official 619:034e698bc035 56 #define I2C_PORT(X) (((uint32_t)(X) >> 4) & 0xF) // port number (0=A, 1=B, 2=C, 3=D)
mbed_official 619:034e698bc035 57 #define I2C_PIN_INDEX(X) (1 << ((uint32_t)(X) & 0xF)) // pin index : flag bit
mbed_official 619:034e698bc035 58
mbed_official 619:034e698bc035 59 uint32_t I2C_Init(I2C_ConfigStruct* conf);
mbed_official 619:034e698bc035 60
mbed_official 619:034e698bc035 61 void I2C_WriteBitSDA(I2C_ConfigStruct* conf, uint8_t data);
mbed_official 619:034e698bc035 62 void I2C_WriteBitSCL(I2C_ConfigStruct* conf, uint8_t data);
mbed_official 619:034e698bc035 63 uint8_t I2C_ReadBitSDA(I2C_ConfigStruct* conf);
mbed_official 619:034e698bc035 64
mbed_official 619:034e698bc035 65 void I2C_SendACK(I2C_ConfigStruct* conf);
mbed_official 619:034e698bc035 66 void I2C_SendNACK(I2C_ConfigStruct* conf);
mbed_official 619:034e698bc035 67
mbed_official 619:034e698bc035 68 uint8_t I2C_WriteByte(I2C_ConfigStruct* conf, uint8_t data);
mbed_official 619:034e698bc035 69 uint8_t I2C_ReadByte(I2C_ConfigStruct* conf);
mbed_official 619:034e698bc035 70
mbed_official 619:034e698bc035 71 void I2C_Start(I2C_ConfigStruct* conf);
mbed_official 619:034e698bc035 72 void I2C_Stop(I2C_ConfigStruct* conf);
mbed_official 619:034e698bc035 73
mbed_official 619:034e698bc035 74 int I2C_Write(I2C_ConfigStruct* conf, uint8_t addr, uint8_t* data, uint32_t len);
mbed_official 619:034e698bc035 75 int I2C_WriteRepeated(I2C_ConfigStruct* conf, uint8_t addr, uint8_t* data, uint32_t len);
mbed_official 619:034e698bc035 76 int I2C_Read(I2C_ConfigStruct* conf, uint8_t addr, uint8_t* data, uint32_t len);
mbed_official 619:034e698bc035 77 int I2C_ReadRepeated(I2C_ConfigStruct* conf, uint8_t addr, uint8_t* data, uint32_t len);
mbed_official 619:034e698bc035 78
mbed_official 619:034e698bc035 79
mbed_official 619:034e698bc035 80 #endif //__W7500X_I2C_H
mbed_official 619:034e698bc035 81