Skip to content

Commit

Permalink
[wiring] Allow creating parameterless Wire instance
Browse files Browse the repository at this point in the history
  • Loading branch information
kuba2k2 committed Dec 12, 2023
1 parent 1ed395b commit cf3f23e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cores/beken-72xx/arduino/libraries/Wire/Wire.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ bool TwoWire::setClock(uint32_t frequency) {
if (!this->data)
return false;

uint32_t maxFrequency = 409600;
uint32_t maxFrequency = 400000;
if (frequency > maxFrequency) {
LT_WM(I2C, "Clock freq too high! %lu < %lu", frequency, maxFrequency);
frequency = maxFrequency;
Expand Down
4 changes: 3 additions & 1 deletion cores/common/arduino/libraries/api/Wire/Wire.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ enum TwoWireResult {

class TwoWire : public Stream {
private:
uint8_t port{0}; //!< port number, family-specific
int port{-1}; //!< port number, family-specific
bool fixedPort{false}; //!< whether port is not changeable
pin_size_t sda{PIN_INVALID}; //!< SDA pin number of this instance
pin_size_t scl{PIN_INVALID}; //!< SCL pin number of this instance
Expand Down Expand Up @@ -65,6 +65,8 @@ class TwoWire : public Stream {

TwoWire(pin_size_t sda, pin_size_t scl) : sda(sda), scl(scl) {}

TwoWire() {}

~TwoWire();

bool begin(pin_size_t sda, pin_size_t scl, uint32_t frequency = 0);
Expand Down

0 comments on commit cf3f23e

Please sign in to comment.