mirror of
https://github.com/SMFSW/cI2C
synced 2024-12-03 14:45:43 +01:00
v1.3: Added Travis CI support and removed doxygen version anchors in sources
This commit is contained in:
parent
63be41402d
commit
4fcef282b6
4
.gitignore
vendored
Normal file → Executable file
4
.gitignore
vendored
Normal file → Executable file
@ -27,3 +27,7 @@
|
||||
*.exe
|
||||
*.out
|
||||
*.app
|
||||
|
||||
#Doxygen
|
||||
doxygen_sqlite3.db
|
||||
doxy
|
25
.travis.yml
Executable file
25
.travis.yml
Executable file
@ -0,0 +1,25 @@
|
||||
language: c
|
||||
sudo: false
|
||||
|
||||
# Blacklist
|
||||
branches:
|
||||
except:
|
||||
- gh-pages
|
||||
|
||||
env:
|
||||
global:
|
||||
- PRETTYNAME="cI2C: Arduino Hardware I2C for AVR (in plain c)"
|
||||
- GH_REPO_NAME: cI2C
|
||||
- GH_REPO_REF: github.com/SMFSW/cI2C.git
|
||||
# - DOXYFILE: $TRAVIS_BUILD_DIR/Doxyfile
|
||||
|
||||
before_install:
|
||||
- source <(curl -SLs https://raw.githubusercontent.com/SMFSW/travis-ci-arduino/master/install.sh)
|
||||
|
||||
script:
|
||||
- build_avr_platforms
|
||||
|
||||
# Generate and deploy documentation
|
||||
after_success:
|
||||
- source <(curl -SLs https://raw.githubusercontent.com/SMFSW/travis-ci-arduino/master/library_check.sh)
|
||||
- source <(curl -SLs https://raw.githubusercontent.com/SMFSW/travis-ci-arduino/master/doxy_gen_and_deploy.sh)
|
14
Clean.bat
Executable file
14
Clean.bat
Executable file
@ -0,0 +1,14 @@
|
||||
@ECHO off
|
||||
ECHO #***************************************************************
|
||||
ECHO # File : clean.bat
|
||||
ECHO #
|
||||
ECHO # Command lines script: Clearing output, temporary and log files
|
||||
ECHO #***************************************************************
|
||||
|
||||
|
||||
@ECHO on
|
||||
|
||||
::del *.o /s
|
||||
del cI2C.chm
|
||||
del /f /q /s workdir\
|
||||
rmdir workdir
|
2
Doxyfile
2
Doxyfile
@ -38,7 +38,7 @@ PROJECT_NAME = "Arduino Hardware I2C for AVR MCUs (plain c)"
|
||||
# could be handy for archiving the generated documentation or if some version
|
||||
# control system is used.
|
||||
|
||||
PROJECT_NUMBER = 1.2
|
||||
PROJECT_NUMBER = 1.3
|
||||
|
||||
# Using the PROJECT_BRIEF tag one can provide an optional one line description
|
||||
# for a project that appears at the top of each page and should give viewer a
|
||||
|
97
README.md
97
README.md
@ -1,10 +1,12 @@
|
||||
# cI2C
|
||||
# cI2C [![Build Status](https://travis-ci.org/SMFSW/cI2C.svg?branch=master)](https://travis-ci.org/SMFSW/cI2C)
|
||||
|
||||
Arduino Hardware I2C for AVR (plain c)
|
||||
|
||||
Hardware I2C library for AVR MCUs (lib intended for I2C protocols development in c, for easier ports to other MCUs)
|
||||
|
||||
## Library choice:
|
||||
* cI2C library implements I2C bus for AVR tagets (Uno, Nano, Mega...)
|
||||
## Library choice
|
||||
|
||||
* cI2C library implements I2C bus for AVR targets (Uno, Nano, Mega...)
|
||||
* you may prefer this one when:
|
||||
* working on AVR targets
|
||||
* interrupts are not needed
|
||||
@ -16,64 +18,71 @@ Hardware I2C library for AVR MCUs (lib intended for I2C protocols development in
|
||||
No refactoring is required when switching between **cI2C** & **WireWrapper** libs;
|
||||
Both libs share same Typedefs, Functions & Parameters.
|
||||
|
||||
## Notes:
|
||||
## Notes
|
||||
|
||||
* cI2C is written in plain c (intentionally)
|
||||
* cI2C does not use any interrupt (yet, but soon will have to)
|
||||
* cI2C is designed to act as bus Master (Slave mode will be considered in future releases)
|
||||
* cI2C is set to work on AVR targets only
|
||||
* for other targets, you may use **WireWrapper** instead (will be using Wire)
|
||||
|
||||
## Usage:
|
||||
## Usage
|
||||
|
||||
This library is intended to be able to work with multiple slaves connected on the same I2C bus.
|
||||
Thus, the I2C bus and Slaves are defined separately.
|
||||
|
||||
* On one hand, I2C bus has to be initialised with appropriate speed:
|
||||
* use I2C_init(speed): speed can be choosen from I2C_SPEED enum for convenience, or passing an integer as parameter
|
||||
* On the other hand, Slave(s) have to be defined and initialised too:
|
||||
* use I2C_SLAVE typedef to declare slaves structs
|
||||
* use I2C_slave_init(pSlave, addr, regsize)
|
||||
* **pSlave** is a pointer to the slave struct to initialise
|
||||
* **addr** is the slave I2C address (don't shift addr, lib takes care of that)
|
||||
* **regsize** is the width of internal slave registers (to be choosen from I2C_INT_SIZE)
|
||||
* On one hand, I2C bus has to be initialized with appropriate speed:
|
||||
* use `I2C_init(speed)`: speed can be chosen from `I2C_SPEED` enum for convenience, or passing an integer as parameter
|
||||
* On the other hand, Slave(s) have to be defined and initialized too:
|
||||
* use `I2C_SLAVE` typedef to declare slaves structs
|
||||
* use `I2C_slave_init(pSlave, addr, regsize)`
|
||||
* `pSlave`: pointer to the slave struct to initialize
|
||||
* `addr`: slave I2C address (don't shift addr, lib takes care of that)
|
||||
* `regsize`: width of internal slave registers (to be chosen from `I2C_INT_SIZE`)
|
||||
* in case you need to use custom R/W procedures for a particular slave:
|
||||
* use I2C_slave_set_rw_func(pSlave, pFunc, rw)
|
||||
* **pSlave** is a pointer to the slave declaration to initialise
|
||||
* **pFunc** is a pointer to the Read or Write bypass function
|
||||
* **rw** can be choosen from I2C_RW enum (wr=0, rd=1)
|
||||
* use `I2C_slave_set_rw_func(pSlave, pFunc, rw)`
|
||||
* `pSlave`: pointer to the slave declaration to initialize
|
||||
* `pFunc`: pointer to the Read or Write bypass function
|
||||
* `rw`: can be chosen from `I2C_RW` enum (wr=0, rd=1)
|
||||
|
||||
After all inits are done, the lib can basically be used this way:
|
||||
* I2C_read(pSlave, regaddr, pData, bytes)
|
||||
* **pSlave** is a pointer to the slave struct to read from
|
||||
* **regaddr** is the start address to read from
|
||||
* **pData** is a pointer to the place where datas read will be stored
|
||||
* **bytes** number of bytes to read from slave
|
||||
* returns true if read is ok, false otherwise
|
||||
* I2C_write(pSlave, regaddr, pData, bytes)
|
||||
* **pSlave** is a pointer to the slave struct to write to
|
||||
* **regaddr** is the start address to write to
|
||||
* **pData** is a pointer to the block of datas to write to slave
|
||||
* **bytes** number of bytes to write to slave
|
||||
* returns true if write is ok, false otherwise
|
||||
* `I2C_read(pSlave, regaddr, pData, bytes)`
|
||||
* `pSlave`: pointer to the slave struct to read from
|
||||
* `regaddr`: start address to read from
|
||||
* `pData`: pointer to the place where datas read will be stored
|
||||
* `bytes`: number of bytes to read from slave
|
||||
* returns `true` if read is ok, `false` otherwise
|
||||
* `I2C_write(pSlave, regaddr, pData, bytes)`
|
||||
* `pSlave`: pointer to the slave struct to write to
|
||||
* `regaddr`: start address to write to
|
||||
* `pData`: pointer to the block of datas to write to slave
|
||||
* `bytes`: number of bytes to write to slave
|
||||
* returns `true` if write is ok, `false` otherwise
|
||||
|
||||
## Examples included
|
||||
|
||||
## Examples included:
|
||||
following examples should work with any I2C EEPROM/FRAM with address 0x50
|
||||
(yet function to get Chip ID are device dependant (and will probably only work on FUJITSU devices))
|
||||
* ci2c_master_write.ino: Write some bytes to FRAM and compare them with what's read afterwards
|
||||
* ci2c_master_read.ino: Read some bytes in FRAM
|
||||
* ci2c_advanced.ino: Redirecting slave write & read functions (to custom functions following typedef)
|
||||
(yet function to get Chip ID are device dependent (and will probably only work on FUJITSU devices))
|
||||
* [ci2c_master_write.ino](examples/ci2c_master_write/ci2c_master_write.ino): Write some bytes to FRAM and compare them with what's read afterwards
|
||||
* [ci2c_master_read.ino](examples/ci2c_master_read/ci2c_master_read.ino): Read some bytes in FRAM
|
||||
* [ci2c_advanced.ino](examples/ci2c_advanced/ci2c_advanced.ino): Redirecting slave write & read functions (to custom functions following typedef)
|
||||
|
||||
Doxygen doc can be generated for the library using doxyfile
|
||||
## Documentation
|
||||
|
||||
## Links:
|
||||
Feel free to share your thoughts @ xgarmanboziax@gmail.com about:
|
||||
* issues encountered
|
||||
* optimisations
|
||||
* improvements & new functionalities
|
||||
Doxygen doc can be generated using "Doxyfile".
|
||||
|
||||
See [generated documentation](https://smfsw.github.io/cI2C/)
|
||||
|
||||
## Release Notes
|
||||
|
||||
See [release notes](https://github.com/SMFSW/cI2C/ReleaseNotes.md)
|
||||
|
||||
## See also
|
||||
|
||||
**cI2C**
|
||||
- https://github.com/SMFSW/cI2C
|
||||
- https://bitbucket.org/SMFSW/ci2c
|
||||
* [cI2C github](https://github.com/SMFSW/cI2C) - C implementation of this library
|
||||
* [cI2C bitbucket](https://bitbucket.org/SMFSW/ci2c) - C implementation of this library
|
||||
|
||||
**WireWrapper**
|
||||
- https://github.com/SMFSW/WireWrapper
|
||||
- https://bitbucket.org/SMFSW/wirewrapper
|
||||
* [WireWrapper github](https://github.com/SMFSW/WireWrapper) - Cpp implementation using Wire Wrapper
|
||||
* [WireWrapper bitbucket](https://bitbucket.org/SMFSW/wirewrapper) - Cpp implementation using Wire Wrapper
|
||||
|
@ -1,5 +1,5 @@
|
||||
Arduino Hardware I2C for AVR (plain c)
|
||||
2017-2017 SMFSW
|
||||
2017-2018 SMFSW
|
||||
|
||||
- cI2C is set to work on AVR targets only
|
||||
-> for other targets, you may use WireWrapper instead (will be using Wire)
|
||||
@ -15,6 +15,10 @@ Feel free to share your thoughts @ xgarmanboziax@gmail.com about:
|
||||
------------
|
||||
|
||||
** Actual:
|
||||
v1.3 3 May 2018:
|
||||
- Adding support for unit tests and doxygen documentation generation with Travis CI
|
||||
- Updated README.md
|
||||
|
||||
v1.2 30 Nov 2017:
|
||||
- No internal address transmission when reading/writing to next internal address (make sure not to r/w last 16 address right just after init, otherwise make a dummy of address 0 just before)
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
name=cI2C
|
||||
version=1.2
|
||||
version=1.3
|
||||
author=SMFSW <xgarmanboziax@gmail.com>
|
||||
maintainer=SMFSW <xgarmanboziax@gmail.com>
|
||||
sentence=Arduino Hardware I2C for AVR (in plain c)
|
||||
|
@ -1,6 +1,5 @@
|
||||
/*!\file ci2c.c
|
||||
** \author SMFSW
|
||||
** \version 1.2
|
||||
** \copyright MIT SMFSW (2017)
|
||||
** \brief arduino master i2c in plain c code
|
||||
** \warning Don't access (r/w) last 16b internal address byte alone right after init, this would lead to hazardous result (in such case, make a dummy read of addr 0 before)
|
||||
|
@ -1,6 +1,5 @@
|
||||
/*!\file ci2c.h
|
||||
** \author SMFSW
|
||||
** \version 1.2
|
||||
** \copyright MIT SMFSW (2017)
|
||||
** \brief arduino i2c in plain c declarations
|
||||
** \warning Don't access (r/w) last 16b internal address byte alone right after init, this would lead to hazardous result (in such case, make a dummy read of addr 0 before)
|
||||
|
Loading…
Reference in New Issue
Block a user