diff options
author | Kristian Lauszus <lauszus@gmail.com> | 2014-03-06 17:23:49 +0100 |
---|---|---|
committer | Kristian Lauszus <lauszus@gmail.com> | 2014-03-06 17:23:49 +0100 |
commit | 5216e551a5b90f8744a4a7e18e531da16d1261ad (patch) | |
tree | a8c35e0a9a1c778bfe53990361ca0bea9d695e3f /libraries/Wire/Wire.cpp | |
parent | b59826cbd0712c46e5aa80fdfcd9ddcc07e4cbd2 (diff) |
Enable user to change the I2C clock frequency by calling setClock in the Wire library
Diffstat (limited to 'libraries/Wire/Wire.cpp')
-rw-r--r-- | libraries/Wire/Wire.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/libraries/Wire/Wire.cpp b/libraries/Wire/Wire.cpp index 4e7a17c..553add7 100644 --- a/libraries/Wire/Wire.cpp +++ b/libraries/Wire/Wire.cpp @@ -75,6 +75,11 @@ void TwoWire::begin(int address) begin((uint8_t)address); } +void TwoWire::setClock(uint32_t frequency) +{ + TWBR = ((F_CPU / frequency) - 16) / 2; +} + uint8_t TwoWire::requestFrom(uint8_t address, uint8_t quantity, uint8_t sendStop) { // clamp to buffer length |