Skip to content

Commit

Permalink
libraries/psoc: Begin function.
Browse files Browse the repository at this point in the history
Signed-off-by: IFX-Anusha <[email protected]>
  • Loading branch information
IFX-Anusha committed Jan 17, 2025
1 parent 6e265eb commit fed15c6
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
15 changes: 12 additions & 3 deletions libraries/Wire/Wire.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,21 @@ TwoWire::TwoWire() {
// Empty constructor
}

void TwoWire::begin() {
void TwoWire::_begin() {
// Empty implementation
}

void TwoWire::begin(uint8_t) {
// Empty implementation
void TwoWire::begin() {
end();
is_master = true;
_begin();
}

void TwoWire::begin(uint8_t address) {
end();
is_master = false;
slave_address = address;
_begin();
}

void TwoWire::end() {
Expand Down
10 changes: 10 additions & 0 deletions libraries/Wire/Wire.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,16 @@ class TwoWire : public arduino::HardwareI2C
void onReceive(void(*)(int));
void onRequest(void(*)(void));

private:

bool is_master;
cyhal_gpio_t sda_pin;
cyhal_gpio_t scl_pin;
cyhal_i2c_t i2c_obj;
uint16_t slave_address;
uint32_t actualfreq;


}

#endif

0 comments on commit fed15c6

Please sign in to comment.