Skip to content

Commit

Permalink
V1.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
felias-fogg committed Dec 15, 2023
1 parent cee265b commit 19f2bd4
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 6 deletions.
8 changes: 6 additions & 2 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
CHANGELOG for FlexWire
V1.1.0
V1.1.1 (15.12.2023)
- Fixed: setClock fixed so that the specified value is always an
upper bound.

V1.1.0
- Added: If running on AVR architecture and AVR_OPTIMZATION is not
set to 0 in the header file, then direct port manipulation is used
to work on the I2C bus. That allows up to around 200 kHz bus
frequency.
- In this case, the default frequency is around 100 kHz. If you use
setClock, then <= 10000 set something around 10 kHz, <= 30000 sets
a clock of around 30 kHz, <= 200000 set something around 100 kHz,
and anything above will give a bus speed of around 250 kHz. All on
and anything above will give a bus speed of around 150 kHz. All on
16 MHz MCUs.
- If the AVR_OPTIMIZATION is not used, then the bus frequency is
around 50 kHz on 16MHz AVR chip.
Expand Down
1 change: 1 addition & 0 deletions examples/multi_i2c/multi_i2c.ino
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ void setup()
Wire.setPins(sdapin[i], sclpin);
htu.begin();
}
Wire.setClock(90000);
#else
for (uint8_t i=0; i < MAXSENSOR; i++) htu[i].begin(wire[i]);
#endif
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=FlexWire
version=1.1.0
version=1.1.1
author=Bernhard Nebel
maintainer=Bernhard Nebel <nebel@hinterm-ziel.de>
sentence=This library implements the master side of the I2C protocol in a platform independent way.
Expand Down
4 changes: 2 additions & 2 deletions src/FlexWire.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ void FlexWire::setClock(uint32_t Hz) {
uint16_t codeDelay;
_i2cDelay = 1000000UL / Hz ;
#if AVR_OPTIMIZATION
codeDelay = 112000000UL / F_CPU; // us delay by code
codeDelay = 100000000UL / F_CPU; // us delay by code
#else
codeDelay = 288000000UL / F_CPU; // us delay by code
#endif
if (codedelay < _i2cDelay) _i2Delay = (_i2cDelay - codeDelay)/2;
if (codeDelay < _i2cDelay) _i2cDelay = (_i2cDelay - codeDelay + 1)/2;
else _i2cDelay = 0;
#endif
}
Expand Down
2 changes: 1 addition & 1 deletion src/FlexWire.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#ifndef FLEXWIRE_h
#define FLEXWIRE_h
#define FLEXWIRE_VERSION 1.1.0
#define FLEXWIRE_VERSION 1.1.1

// #define AVR_OPTIMIZATION 0 // without optimizations, less code, but much slower (55 kHz)

Expand Down

0 comments on commit 19f2bd4

Please sign in to comment.