Giter Club home page Giter Club logo

flashair-slibi2c's Introduction

FlashAir-SlibI2C

Lua library for I2C for FlashAir.

Tested equipment

Tested on FlashAir W-04 v4.00.03.

Install

SlibI2C.lua -- Copy to somewhere in Lua's search path.

Usage

command description
res = I2C:setup( frq ) I2C interfase setup
frq: Clock frequency(kHz). 45 or 100 or 189 or 400
res = I2C:print( sadr, str ) I2C print data
sadr: target address (7bit)
str: strings for write
res: Same as return value of fa.i2c()
res = I2C:write( sadr, d1, d2, ... ) I2C write data
sadr: target address (7bit)
d1, d2, ... : data for write
res: Same as return value of fa.i2c()
res, str = I2C:scan( sadr, len ) I2C read string
sadr: target address (7bit)
len: length
res: Same as return value of fa.i2c()
str: strings
res, d1, d2, ... = I2C:read( sadr, len ) I2C read data
sadr: target address (7bit)
len: length
res: Same as return value of fa.i2c()
d1, d2, ... : numbers
ret, tbl = I2C:readt( sadr, len ) I2C read table
sadr: target address (7bit)
len: length
res: Same as return value of fa.i2c()
tbl: table of numbers
res, str = I2C:wscan( sadr, adr, len ) I2C read string after write address
sadr: target address (7bit)
adr: address
len: length
res: Same as return value of fa.i2c()
str: strings
res, d1, d2, ... = I2C:wread( sadr, adr, len ) I2C read data after write adr
sadr: target address (7bit)
adr: address
len: length
res: Same as return value of fa.i2c()
d1, d2, ... : numbers
ret, tbl = I2C:wreadt( sadr, adr, len ) I2C read table after write address
sadr: target address (7bit)
adr: address
len: length
res: Same as return value of fa.i2c()
tbl: table of numbers
res = I2C:setpio( dat ) I2C set pio
dat: write data
res: Same as return value of fa.i2c()
res, data, ctrl = I2C:getpio() I2C get pio
res, data, ctrl: Same as return value of fa.i2c()
res, sadr = I2C:sascan( adrTbl, idAdr, id )

or

res, sadr = I2C:sascan( adrTbl, idAdr, id, tryCount, waitTime )
I2C target address scan
adrTbl: target address table
idAdr: ID address
id: ID data
tryCount: Try count (nil for 5)
waitTime: wait time[ms] (nil for 1)

res: Same as return value of fa.i2c()
sadr: target address or 0xFF at I2C error

Licence

MIT

Author

GitHub/AoiSaya
Twitter ID @La_zlo

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.