be more specific on fixing arduino i2c speeds
This commit is contained in:
parent
a493f3d7a3
commit
a8b7958a1a
|
|
@ -29,4 +29,4 @@ jobs:
|
||||||
run: bash ci/doxy_gen_and_deploy.sh
|
run: bash ci/doxy_gen_and_deploy.sh
|
||||||
|
|
||||||
- name: Test the code on supported platforms
|
- name: Test the code on supported platforms
|
||||||
run: python3 ci/build_platform.py main_platforms zero feather32u4
|
run: python3 ci/build_platform.py main_platforms zero feather32u4 trinket_5v
|
||||||
|
|
|
||||||
|
|
@ -261,7 +261,7 @@ uint8_t Adafruit_I2CDevice::address(void) { return _addr; }
|
||||||
* Not necessarily that the speed was achieved!
|
* Not necessarily that the speed was achieved!
|
||||||
*/
|
*/
|
||||||
bool Adafruit_I2CDevice::setSpeed(uint32_t desiredclk) {
|
bool Adafruit_I2CDevice::setSpeed(uint32_t desiredclk) {
|
||||||
#if defined(__AVR__) // fix arduino core set clock
|
#if defined(__AVR_ATmega328__) || defined(__AVR_ATmega328P__) // fix arduino core set clock
|
||||||
// calculate TWBR correctly
|
// calculate TWBR correctly
|
||||||
uint8_t prescaler = 1;
|
uint8_t prescaler = 1;
|
||||||
uint32_t atwbr = ((F_CPU / desiredclk) - 16) / 2;
|
uint32_t atwbr = ((F_CPU / desiredclk) - 16) / 2;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue