Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@AbhishekGS-MW
Copy link

To make sure that I2C read write operations does not get stuck in an infinite loop, a timeout has been added.

@MCUdude
Copy link

MCUdude commented Feb 12, 2019

You should use ISR, not SIGNAL.

You also need to replace tabs with spaces

// wait for read operation to complete
twi_timeout(1);
while(TWI_MRX == twi_state){
if (twi_timeout(0)) break;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (twi_timeout(0)) break;
if (twi_timeout(0)) break;

twi_timeout(1);
while(TWI_READY != twi_state){
if (twi_timeout(0))
{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please follow the formatting style of the rest of the code in the file and attach this brace to the if statement.

while(TWI_READY != twi_state){
if (twi_timeout(0))
{
return 32;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return 32;
return 32;

if (twi_timeout(0))
{
return 32;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
}
}

}
else
// send start condition
// send start condition
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// send start condition
// send start condition

twi_timer_count=0;
// reinitialize the hardware
twi_init();
return 1;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return 1;
return 1;

// reinitialize the hardware
twi_init();
return 1;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
}
}

twi_init();
return 1;
}
return 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return 0;
return 0;

@@ -0,0 +1,512 @@
This file includes license information for arduino avr core. The code has been forked
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this file from the PR.

@@ -0,0 +1,8 @@

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this file from the PR.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants