Skip to content

Commit

Permalink
specified only for megaAVR arch
Browse files Browse the repository at this point in the history
  • Loading branch information
dattasaurabh82 committed Aug 25, 2021
1 parent 9177bc5 commit 8d8d3f9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ sentence=An efficient optimised i2c library for new ATTINY series uCs
paragraph=An efficient and optimised i2c library for new ATTINY series uCs as a replacement for wire library with less footprint
category=Communication
url=https://github.com/dattasaurabh82/
architectures=*
architectures=megaavr
5 changes: 5 additions & 0 deletions src/TinyMegaI2C.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ void TinyMegaI2CMaster::init()
{
pinMode(PIN_WIRE_SDA, INPUT_PULLUP);
pinMode(PIN_WIRE_SCL, INPUT_PULLUP);

// For ATTINY-1607-MFR, Setting SDA SCL pins with DPM would be
// PORTB.PIN0CTRL = PORT_PULLUPEN_bm; // SCL
// PORTB.PIN1CTRL = PORT_PULLUPEN_bm; // SDA

uint32_t baud = ((F_CPU / FREQUENCY) - (((F_CPU * T_RISE) / 1000) / 1000) / 1000 - 10) / 2;
TWI0.MBAUD = (uint8_t)baud;
TWI0.MCTRLA = TWI_ENABLE_bm; // Enable as master, no interrupts
Expand Down

0 comments on commit 8d8d3f9

Please sign in to comment.