Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
MSP430FR5994 BOOSTXL-CC1120-90 Library
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Energy-Driven Computing
MSP430FR5994 BOOSTXL-CC1120-90 Library
Commits
37482675
Commit
37482675
authored
5 years ago
by
Edward Longman
Browse files
Options
Downloads
Patches
Plain Diff
Modify F5 to port it to FR5x
parent
7bf44ad8
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
source/lib/uart_drv/uart_drv.c
+98
-11
98 additions, 11 deletions
source/lib/uart_drv/uart_drv.c
with
98 additions
and
11 deletions
source/lib/uart_drv/uart_drv.c
+
98
−
11
View file @
37482675
...
...
@@ -181,10 +181,10 @@ void uart_drv_toggle_echo(void) {
#if (UART_SER_INTF == F5_UART_INTF_USCIA0)
/**************************************************************************
* @brief Initializes the serial communications peripheral and GPIO ports
*
* @brief Initializes the serial communications peripheral and GPIO ports
*
* @param none
*
*
* @return none
**************************************************************************/
void
hal_uart_init
(
void
)
...
...
@@ -235,9 +235,9 @@ void hal_uart_init(void)
/***************************************************************************
* @brief Disables the serial communications peripheral and clears the GPIO
* settings, reset the interupts.
*
*
* @param none
*
*
* @return none
**************************************************************************/
void
hal_uart_deinit
(
void
)
...
...
@@ -253,9 +253,9 @@ void hal_uart_deinit(void)
/**************************************************************************
* @brief void hal_uart_start_tx(void)
*
*
* @param Start the TX ISR, it will automatically stop when FIFO is empty
*
*
* @return none
**************************************************************************/
void
hal_uart_start_tx
(
void
)
...
...
@@ -460,7 +460,13 @@ void hal_uart_init(void)
rx_end_of_str
=
NO_END_OF_LINE_DETECTED
;
rx_str_length
=
0
;
<<<<<<<
Updated
upstream
UART_PORT_SEL
|=
UART_PIN_RXD
+
UART_PIN_TXD
;
=======
//Due to 3 peripherals per port there are more select bits.
UART_PORT_SEL0
|=
UART_PIN_RXD
+
UART_PIN_TXD
;
UART_PORT_SEL1
&=
~
(
UART_PIN_RXD
+
UART_PIN_TXD
);
>>>>>>>
Stashed
changes
UART_PORT_DIR
|=
UART_PIN_TXD
;
UART_PORT_DIR
&=
~
UART_PIN_RXD
;
...
...
@@ -487,7 +493,12 @@ void hal_uart_init(void)
UCA1BR0
=
138
;
// 115200 bits per second
UCA1BR1
=
0
;
<<<<<<<
Updated
upstream
UCA1MCTL
=
UCBRS2
+
UCBRS1
+
UCBRS0
;
// Modulation UCBRSx = 7
=======
//Slight different modulation options in FR5994
UCA0MCTLW
=
UCBRS2
+
UCBRS1
+
UCBRS0
;
>>>>>>>
Stashed
changes
UCA1CTL1
&=
~
UCSWRST
;
UCA1IE
|=
UCRXIE
;
// Enable USCI_A0 RX interrupt
...
...
@@ -508,11 +519,18 @@ void hal_uart_deinit(void)
UCA1IE
&=
~
UCRXIE
;
UCA1IE
&=
~
UCTXIE
;
UCA1CTL1
=
UCSWRST
;
//Reset State
<<<<<<<
Updated
upstream
UART_PORT_SEL
&=
~
(
UART_PIN_RXD
+
UART_PIN_TXD
);
=======
//Due to 3 peripherals per port there are more select bits.
UART_PORT_SEL0
&=
~
(
UART_PIN_RXD
+
UART_PIN_TXD
);
UART_PORT_SEL1
&=
~
(
UART_PIN_RXD
+
UART_PIN_TXD
);
>>>>>>>
Stashed
changes
UART_PORT_DIR
|=
UART_PIN_TXD
;
UART_PORT_DIR
|=
UART_PIN_RXD
;
UART_PORT_OUT
&=
~
(
UART_PIN_TXD
+
UART_PIN_RXD
);
}
<<<<<<<
Updated
upstream
/**************************************************************************
* @brief void hal_uart_start_tx(void)
...
...
@@ -580,6 +598,75 @@ void __attribute__ ((interrupt(USCI_A1_VECTOR))) USCI_A1_ISR (void)
#elif UART_SER_INTF == F2_UART_INTF_USCIA0 // Interface to UART
/**************************************************************************
=======
/**************************************************************************
* @brief void hal_uart_start_tx(void)
*
* @param Start the TX ISR, it will automatically stop when FIFO is empty
*
* @return none
**************************************************************************/
void
hal_uart_start_tx
(
void
)
{
if
(
isr_state
==
TX_ISR_OFF
)
{
ENTER_CRITICAL_SECTION
(
isr_flag
);
isr_state
=
TX_ISR_ON
;
UCA1IE
|=
UCTXIE
;
UCA1TXBUF
=
circ_buf_get_data
(
&
uart_tx_buf
);
LEAVE_CRITICAL_SECTION
(
isr_flag
);
}
}
// Echo back RXed character, confirm TX buffer is ready first
#if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
#pragma vector=USCI_A1_VECTOR
__interrupt
void
USCI_A1_ISR
(
void
)
#elif defined(__GNUC__)
void
__attribute__
((
interrupt
(
USCI_A1_VECTOR
)))
USCI_A1_ISR
(
void
)
#else
#error Compiler not supported!
#endif
{
char
tmp_uart_data
;
switch
(
__even_in_range
(
UCA1IV
,
4
))
{
case
UCIV__NONE
:
break
;
// Vector 0 - no interrupt
case
UCIV__UCRXIFG
:
// Vector 2 - RXIFG
tmp_uart_data
=
UCA1RXBUF
;
circ_buf_put_data
(
&
uart_rx_buf
,
tmp_uart_data
);
if
(
uart_state
==
UART_ECHO_ON
)
{
uart_put_char
(
tmp_uart_data
);
}
// if its a "return" then activate main-loop
if
(
tmp_uart_data
==
13
)
{
rx_end_of_str
=
END_OF_LINE_DETECTED
;
rx_str_length
=
uart_rx_buf
.
size_of_buffer
-
circ_buf_remainder
(
&
uart_rx_buf
);
__bic_SR_register_on_exit
(
LPM3_bits
);
}
break
;
case
UCIV__UCTXCFG
:
// check if there is more data to send
if
(
circ_buf_remainder
(
&
uart_tx_buf
)
<
uart_tx_buf
.
size_of_buffer
)
{
UCA1TXBUF
=
circ_buf_get_data
(
&
uart_tx_buf
);
}
else
{
isr_state
=
TX_ISR_OFF
;
UCA1IE
&=
~
UCTXIE
;
// Disable USCI_A0 TX interrupt
}
break
;
// Vector 4 - TXIFG
default:
break
;
}
}
#elif UART_SER_INTF == F2_UART_INTF_USCIA0 // Interface to UART
/**************************************************************************
>>>>>>> Stashed changes
* @brief Initializes the serial communications peripheral and GPIO ports
* to communicate with the TUSB3410.
*
...
...
@@ -618,9 +705,9 @@ void hal_uart_init(void)
/***************************************************************************
* @brief Disables the serial communications peripheral and clears the GPIO
* settings, reset the interupts.
*
*
* @param none
*
*
* @return none
**************************************************************************/
void
hal_uart_deinit
(
void
)
...
...
@@ -636,9 +723,9 @@ void hal_uart_deinit(void)
/**************************************************************************
* @brief void hal_uart_start_tx(void)
*
*
* @param Start the TX ISR, it will automatically stop when FIFO is empty
*
*
* @return none
**************************************************************************/
void
hal_uart_start_tx
(
void
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment