-
Notifications
You must be signed in to change notification settings - Fork 182
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit brings a bunch of small fixes that have been implemented in the official Arduino AVR repo
- Loading branch information
Showing
7 changed files
with
61 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ | |
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
Modified 2012 by Todd Krein ([email protected]) to implement repeated starts | ||
Modified 2017 by Chuck Todd ([email protected]) to correct Unconfigured Slave Mode reboot | ||
*/ | ||
|
||
extern "C" { | ||
|
@@ -60,14 +61,16 @@ void TwoWire::begin(void) | |
txBufferLength = 0; | ||
|
||
twi_init(); | ||
twi_attachSlaveTxEvent(onRequestService); // default callback must exist | ||
twi_attachSlaveRxEvent(onReceiveService); // default callback must exist | ||
} | ||
|
||
void TwoWire::begin(uint8_t address) | ||
{ | ||
twi_setAddress(address); | ||
begin(); | ||
twi_attachSlaveTxEvent(onRequestService); | ||
twi_attachSlaveRxEvent(onReceiveService); | ||
begin(); | ||
twi_setAddress(address); | ||
} | ||
|
||
void TwoWire::begin(int address) | ||
|
@@ -80,9 +83,9 @@ void TwoWire::end(void) | |
twi_disable(); | ||
} | ||
|
||
void TwoWire::setClock(uint32_t frequency) | ||
void TwoWire::setClock(uint32_t clock) | ||
{ | ||
TWBR = ((F_CPU / frequency) - 16) / 2; | ||
twi_setFrequency(clock); | ||
} | ||
|
||
uint8_t TwoWire::requestFrom(uint8_t address, uint8_t quantity, uint32_t iaddress, uint8_t isize, uint8_t sendStop) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ | |
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
Modified 2012 by Todd Krein ([email protected]) to implement repeated starts | ||
Modified 2017 by Chuck Todd ([email protected]) to correct Unconfigured Slave Mode reboot | ||
*/ | ||
|
||
extern "C" { | ||
|
@@ -60,14 +61,16 @@ void TwoWire1::begin(void) | |
txBufferLength = 0; | ||
|
||
twi_init1(); | ||
twi_attachSlaveTxEvent1(onRequestService); // default callback must exist | ||
twi_attachSlaveRxEvent1(onReceiveService); // default callback must exist | ||
} | ||
|
||
void TwoWire1::begin(uint8_t address) | ||
{ | ||
twi_setAddress1(address); | ||
begin(); | ||
twi_attachSlaveTxEvent1(onRequestService); | ||
twi_attachSlaveRxEvent1(onReceiveService); | ||
begin(); | ||
twi_setAddress1(address); | ||
} | ||
|
||
void TwoWire1::begin(int address) | ||
|
@@ -80,9 +83,9 @@ void TwoWire1::end(void) | |
twi_disable1(); | ||
} | ||
|
||
void TwoWire1::setClock(uint32_t frequency) | ||
void TwoWire1::setClock(uint32_t clock) | ||
{ | ||
TWBR1 = ((F_CPU / frequency) - 16) / 2; | ||
twi_setFrequency1(clock); | ||
} | ||
|
||
uint8_t TwoWire1::requestFrom(uint8_t address, uint8_t quantity, uint32_t iaddress, uint8_t isize, uint8_t sendStop) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters