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