AVR C Runtime Library - Bugs: bug #41502, TWI Library changes TIMSK2
You are not allowed to post comments on this tracker with your current authentication level.
bug #41502: TWI Library changes TIMSK2
Submitter: | None | ||
Submitted: | Fri 07 Feb 2014 01:01:25 PM UTC | ||
Category: | Library | Severity: | 3 - Normal |
Priority: | 5 - Normal | Item Group: | Header files |
Status: | None | Assigned to: | None |
Percent Complete: | 0% | Originator Email: | -email is unavailable- |
Open/Closed: | Open | Release: | 1.7.1 |
Fixed Release: | None |
Attached Files
file #30480: twi.c added by None (1KiB - application/octet-stream)
file #30481: twi.h added by None (244B - application/octet-stream)
Depends on the following items: None found
Items that depend on this one: None found
Carbon-Copy List
Follow 2 latest changes.
Date | Changed by | Updated Field | Previous Value | => | Replaced by |
---|---|---|---|---|---|
2014-02-07 | None | Attached File | - | Added twi.c, #30480 | |
Attached File | - | Added twi.h, #30481 |
Powered by Savane 3.13-caa5.
Corresponding source code
TWI_Init changes the Timer/Counter Interrupt Mask Register of Timer 2 (TIMSK2) as you can see here:
TWI_Init (void)
{
// Port Setup
DDRC &= ~((1 << PC0)|(1 << PC1));
PORTC |= (1 << PC0)|(1 << PC1);
// Setup TWI Speed to 400kHZ (TWPS = 1)
TWBR = 3;
// Using TIMER2 to detect timeout
TCCR2B = (7 << CS20);
TIMSK2 = (1 << OCIE2A);
OCR2A = 125;
// Interrupts REQUIRED!
sei();
}