Skip to content

msp430: twi: move interrupt handler for USCI_Bx to twi.c - #589

Open
alfh wants to merge 1 commit into
energia:masterfrom
alfh:feature_i2c_usci_b_in_twi
Open

msp430: twi: move interrupt handler for USCI_Bx to twi.c#589
alfh wants to merge 1 commit into
energia:masterfrom
alfh:feature_i2c_usci_b_in_twi

Conversation

@alfh

@alfh alfh commented Mar 29, 2015

Copy link
Copy Markdown

For the USCI module, it shares interrupt vector for
USCI_Ax and USCI_Bx, so the interrupt routine should still
be in usci_isr_handler.

But for USCI_B0 and USCI_B1, the interrupt handler can be
moved to twi.c. This is exactly the same way it is done
for the EUSCI_Bx module, it already has the interrupt
handler in twi.c

For the USCI module, it shares interrupt vector for
USCI_Ax and USCI_Bx, so the interrupt routine should still
be in usci_isr_handler.

But for USCI_B0 and USCI_B1, the interrupt handler can be
moved to twi.c. This is exactly the same way it is done
for the EUSCI_Bx module, it already has the interrupt
handler in twi.c
@alfh

alfh commented Mar 29, 2015

Copy link
Copy Markdown
Author

@spirilis I am a bit unsure about the "stay_asleep" code.
Does it seem correct to define

#if defined(MSP430_HAS_USCI_B0) || defined(MSP430_HAS_USCI_B1) || defined(MSP430_HAS_EUSCI_B0)
static boolean still_asleep; // Used to validate whether a user ISR has issued wakeup() inside LPM3/LPM4 sleep modes.
#endif

in twi.c ?

Also, I do not understand why you have not added the "stay_asleep" code blocks in the interrupt handler for EUSCI_B0, in twi.c.
And likewise for the USI interrupt handler in twi.c.
Any comments ?

Regards
Alf

@spirilis

Copy link
Copy Markdown

I don't have the code in front of me, but with stay_asleep code, ask yourself if there's a potential to run a user-provided callback function in the ISR. If so, the stay_asleep code should be there.

I believe I2C slave callback functions may be a reason for this.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants