Coder Social home page Coder Social logo

soft-i2c's Introduction

Soft I2C For STM32 using HAL

That is Edited version of Original version for stm32

usage:

define GPIO in i2c_sw.h:

#define   GPIO_SW_I2C1_SCL			GPIOB
#define   GPIO_SW_I2C1_SDA			GPIOB
#define   GPIO_SW_I2C1_SCL_PIN		GPIO_PIN_13
#define   GPIO_SW_I2C1_SDA_PIN		GPIO_PIN_14

That example is for stm32f103 , for use other micro replace #include "stm32f1xx_hal_gpio.h" in i2c_sw.h.

This library has the ability to activate more than 10 software I2C , which have been commented in this library, but by default only one of them has been activated.

Example:

#include "i2c_sw.h"

int main()
{
    SW_I2C_initial();
    i2c_port_initial(SW_I2C1);
    
    while(1)
    {
        //Write DATA to Reg at Reg_Addr from I2C_Add Device connected to SW_I2C1
        SW_I2C_WriteControl_8Bit(SW_I2C1,I2C_Add,Reg_Addr,DATA);
        //Read DATA at Reg_Add from I2C_Add Device connected to SW_I2C1
        DATA=SW_I2C_ReadControl_8Bit(SW_I2C1,I2C_Add,Reg_Add);
    }
    
}

soft-i2c's People

Contributors

liyanboy74 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.