Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
humanoides
tools
stm32_libraries
Commits
3d3856c0
Commit
3d3856c0
authored
Oct 15, 2020
by
Sergi Hernandez
Browse files
Merge branch 'master' of
ssh://gitlab.iri.upc.edu:2202/humanoides/tools/stm32_libraries
parents
16a876a9
c078fa11
Changes
3
Show whitespace changes
Inline
Side-by-side
f4/usart/src/usart4.c
View file @
3d3856c0
...
...
@@ -111,7 +111,7 @@ void UART_DMA_TX_IRQHandler(void)
__HAL_DMA_DISABLE_IT
(
Uart4Handle
.
hdmatx
,
DMA_IT_TC
);
/* Clear the transfer complete flag */
__HAL_DMA_CLEAR_FLAG
(
Uart4Handle
.
hdmatx
,
__HAL_DMA_GET_TC_FLAG_INDEX
(
Uart4Handle
.
hdmatx
));
CLEAR_BIT
(
Uart4Handle
.
Instance
->
CR3
,
(
UART_CR3_DMAT
|
UART_CR3_DMAR
));
CLEAR_BIT
(
Uart4Handle
.
Instance
->
CR3
,
(
U
S
ART_CR3_DMAT
|
U
S
ART_CR3_DMAR
));
HAL_DMA_Abort
(
Uart4Handle
.
hdmatx
);
// call the user function
comm_do_dma_send
(
usart4_comm_dev
);
...
...
@@ -149,7 +149,7 @@ void UART_DMA_RX_IRQHandler(void)
__HAL_DMA_DISABLE_IT
(
Uart4Handle
.
hdmarx
,
DMA_IT_TC
);
/* Clear the transfer complete flag */
__HAL_DMA_CLEAR_FLAG
(
Uart4Handle
.
hdmarx
,
__HAL_DMA_GET_TC_FLAG_INDEX
(
Uart4Handle
.
hdmarx
));
CLEAR_BIT
(
Uart4Handle
.
Instance
->
CR3
,
(
UART_CR3_DMAT
|
UART_CR3_DMAR
));
CLEAR_BIT
(
Uart4Handle
.
Instance
->
CR3
,
(
U
S
ART_CR3_DMAT
|
U
S
ART_CR3_DMAR
));
HAL_DMA_Abort
(
Uart4Handle
.
hdmarx
);
// call the user function
comm_do_dma_receive
(
usart4_comm_dev
);
...
...
@@ -325,7 +325,7 @@ unsigned char usart4_send_dma(unsigned char *data,unsigned short int length)
__HAL_UART_CLEAR_FLAG
(
&
Uart4Handle
,
UART_FLAG_TC
);
/* Enable the DMA transfer for transmit request by setting the DMAT bit
in the UART CR3 register */
SET_BIT
(
Uart4Handle
.
Instance
->
CR3
,
UART_CR3_DMAT
);
SET_BIT
(
Uart4Handle
.
Instance
->
CR3
,
U
S
ART_CR3_DMAT
);
return
0x00
;
}
...
...
@@ -333,14 +333,14 @@ unsigned char usart4_send_dma(unsigned char *data,unsigned short int length)
unsigned
char
usart4_receive_dma
(
unsigned
char
*
data
,
unsigned
short
int
length
)
{
HAL_DMA_Start_IT
(
Uart4Handle
.
hdmarx
,(
uint32_t
)
&
Uart4Handle
.
Instance
->
DR
,(
uint32_t
)
data
,
length
);
SET_BIT
(
Uart4Handle
.
Instance
->
CR3
,
UART_CR3_DMAR
);
SET_BIT
(
Uart4Handle
.
Instance
->
CR3
,
U
S
ART_CR3_DMAR
);
return
0x00
;
}
unsigned
char
usart4_cancel_receive_dma
(
void
)
{
CLEAR_BIT
(
Uart4Handle
.
Instance
->
CR3
,
(
UART_CR3_DMAT
|
UART_CR3_DMAR
));
CLEAR_BIT
(
Uart4Handle
.
Instance
->
CR3
,
(
U
S
ART_CR3_DMAT
|
U
S
ART_CR3_DMAR
));
HAL_DMA_Abort
(
Uart4Handle
.
hdmarx
);
return
0x00
;
...
...
l0/usart/include/usart1.h
View file @
3d3856c0
...
...
@@ -9,6 +9,7 @@
void
usart1_init
(
TComm
*
comm_dev
,
UART_InitTypeDef
*
conf
,
UART_AdvFeatureInitTypeDef
*
adv_conf
,
TUSART_IRQ_Priorities
*
priorities
);
void
usart1_config
(
TComm
*
comm_dev
,
UART_InitTypeDef
*
conf
,
UART_AdvFeatureInitTypeDef
*
adv_conf
);
void
usart1_set_priorities
(
TComm
*
comm_dev
,
TUSART_IRQ_Priorities
*
priorities
);
void
usart1_set_baudrate
(
TComm
*
comm_dev
,
unsigned
int
baudrate
);
/* IRQ functions */
unsigned
char
usart1_send_irq
(
unsigned
char
first_byte
);
unsigned
char
usart1_enable_tx_irq
(
void
);
...
...
l0/usart/src/usart1.c
View file @
3d3856c0
...
...
@@ -281,6 +281,12 @@ void usart1_set_priorities(TComm *comm_dev,TUSART_IRQ_Priorities *priorities)
}
}
void
usart1_set_baudrate
(
TComm
*
comm_dev
,
unsigned
int
baudrate
)
{
UartHandle
.
Init
.
BaudRate
=
baudrate
;
HAL_UART_Init
(
&
UartHandle
);
}
/* IRQ functions */
unsigned
char
usart1_send_irq
(
unsigned
char
first_byte
)
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment