Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

alfh
Copy link

@alfh alfh commented Mar 29, 2015

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
Copy link
Author

alfh commented Mar 29, 2015

@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

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