mirror of
https://github.com/arduino/Arduino.git
synced 2025-01-18 07:52:14 +01:00
Merge pull request #1912 from Lauszus/issues440
Enable user to change the I2C clock frequency by calling setClock in the Wire library
This commit is contained in:
commit
49ec540204
@ -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
|
||||
|
@ -49,6 +49,7 @@ class TwoWire : public Stream
|
||||
void begin();
|
||||
void begin(uint8_t);
|
||||
void begin(int);
|
||||
void setClock(uint32_t);
|
||||
void beginTransmission(uint8_t);
|
||||
void beginTransmission(int);
|
||||
uint8_t endTransmission(void);
|
||||
|
@ -11,6 +11,7 @@
|
||||
#######################################
|
||||
|
||||
begin KEYWORD2
|
||||
setClock KEYWORD2
|
||||
beginTransmission KEYWORD2
|
||||
endTransmission KEYWORD2
|
||||
requestFrom KEYWORD2
|
||||
|
Loading…
x
Reference in New Issue
Block a user