From 9a150dbd9044ebdc1f31eb8520ce402ca9ba483a Mon Sep 17 00:00:00 2001 From: William Miceli Date: Mon, 7 Jun 2021 18:36:29 -0400 Subject: [PATCH] Finished three more functions --- Telem_Debug/Debug_UART-USB/usci.c | 15 +++++++++++++++ Telem_Debug/Debug_UART-USB/usci.h | 6 ++++++ 2 files changed, 21 insertions(+) diff --git a/Telem_Debug/Debug_UART-USB/usci.c b/Telem_Debug/Debug_UART-USB/usci.c index 190e901..6f15ec5 100644 --- a/Telem_Debug/Debug_UART-USB/usci.c +++ b/Telem_Debug/Debug_UART-USB/usci.c @@ -61,6 +61,21 @@ void usci_A2_disable(void){ UCA2CTL1 |= UCSWRST; // Software Reset Enable - Set high, disabling the USCI module } +void usci_A2_enableInterrupt(void){ + UCA2IE |= (UCTXIE | UCRXIE); // Enable transmit and receive interrupts +} + +void usci_A2_disableInterrupt(void){ + UCA2IE &= ~(UCTXIE | UCRXIE); // Disable transmit and receive interrupts +} + +void usci_A2_transmitChar(char charToTransmit){ + while((UCA2IFG & UCTXIFG) == 0){ // If the USCI module is not yet ready for the next value to transmit, wait indefinitely + _NOP(); // Processor will do nothing until loop exits; should be converted to interrupt in the future + } + UCA2TXBUF = charToTransmit; // When USCI module signals that it is ready, the next character value is moved into the transmit buffer +} + /*************************************************************************/ diff --git a/Telem_Debug/Debug_UART-USB/usci.h b/Telem_Debug/Debug_UART-USB/usci.h index 803c13c..6ce09a8 100644 --- a/Telem_Debug/Debug_UART-USB/usci.h +++ b/Telem_Debug/Debug_UART-USB/usci.h @@ -36,6 +36,12 @@ void usci_A2_enable(void); void usci_A2_disable(void); +void usci_A2_enableInterrupt(void); + +void usci_A2_disableInterrupt(void); + +void usci_A2_transmitChar(char charToTransmit); + void usci_A3_init(void); void usci_B0_init(void);