Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
stm32_libraries
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
humanoides
tools
stm32_libraries
Commits
3d3856c0
Commit
3d3856c0
authored
4 years ago
by
Sergi Hernandez
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' of
ssh://gitlab.iri.upc.edu:2202/humanoides/tools/stm32_libraries
parents
16a876a9
c078fa11
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
f4/usart/src/usart4.c
+5
-5
5 additions, 5 deletions
f4/usart/src/usart4.c
l0/usart/include/usart1.h
+1
-0
1 addition, 0 deletions
l0/usart/include/usart1.h
l0/usart/src/usart1.c
+6
-0
6 additions, 0 deletions
l0/usart/src/usart1.c
with
12 additions
and
5 deletions
f4/usart/src/usart4.c
+
5
−
5
View file @
3d3856c0
...
@@ -111,7 +111,7 @@ void UART_DMA_TX_IRQHandler(void)
...
@@ -111,7 +111,7 @@ void UART_DMA_TX_IRQHandler(void)
__HAL_DMA_DISABLE_IT
(
Uart4Handle
.
hdmatx
,
DMA_IT_TC
);
__HAL_DMA_DISABLE_IT
(
Uart4Handle
.
hdmatx
,
DMA_IT_TC
);
/* Clear the transfer complete flag */
/* Clear the transfer complete flag */
__HAL_DMA_CLEAR_FLAG
(
Uart4Handle
.
hdmatx
,
__HAL_DMA_GET_TC_FLAG_INDEX
(
Uart4Handle
.
hdmatx
));
__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
);
HAL_DMA_Abort
(
Uart4Handle
.
hdmatx
);
// call the user function
// call the user function
comm_do_dma_send
(
usart4_comm_dev
);
comm_do_dma_send
(
usart4_comm_dev
);
...
@@ -149,7 +149,7 @@ void UART_DMA_RX_IRQHandler(void)
...
@@ -149,7 +149,7 @@ void UART_DMA_RX_IRQHandler(void)
__HAL_DMA_DISABLE_IT
(
Uart4Handle
.
hdmarx
,
DMA_IT_TC
);
__HAL_DMA_DISABLE_IT
(
Uart4Handle
.
hdmarx
,
DMA_IT_TC
);
/* Clear the transfer complete flag */
/* Clear the transfer complete flag */
__HAL_DMA_CLEAR_FLAG
(
Uart4Handle
.
hdmarx
,
__HAL_DMA_GET_TC_FLAG_INDEX
(
Uart4Handle
.
hdmarx
));
__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
);
HAL_DMA_Abort
(
Uart4Handle
.
hdmarx
);
// call the user function
// call the user function
comm_do_dma_receive
(
usart4_comm_dev
);
comm_do_dma_receive
(
usart4_comm_dev
);
...
@@ -325,7 +325,7 @@ unsigned char usart4_send_dma(unsigned char *data,unsigned short int length)
...
@@ -325,7 +325,7 @@ unsigned char usart4_send_dma(unsigned char *data,unsigned short int length)
__HAL_UART_CLEAR_FLAG
(
&
Uart4Handle
,
UART_FLAG_TC
);
__HAL_UART_CLEAR_FLAG
(
&
Uart4Handle
,
UART_FLAG_TC
);
/* Enable the DMA transfer for transmit request by setting the DMAT bit
/* Enable the DMA transfer for transmit request by setting the DMAT bit
in the UART CR3 register */
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
;
return
0x00
;
}
}
...
@@ -333,14 +333,14 @@ unsigned char usart4_send_dma(unsigned char *data,unsigned short int length)
...
@@ -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
)
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
);
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
;
return
0x00
;
}
}
unsigned
char
usart4_cancel_receive_dma
(
void
)
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
);
HAL_DMA_Abort
(
Uart4Handle
.
hdmarx
);
return
0x00
;
return
0x00
;
...
...
This diff is collapsed.
Click to expand it.
l0/usart/include/usart1.h
+
1
−
0
View file @
3d3856c0
...
@@ -9,6 +9,7 @@
...
@@ -9,6 +9,7 @@
void
usart1_init
(
TComm
*
comm_dev
,
UART_InitTypeDef
*
conf
,
UART_AdvFeatureInitTypeDef
*
adv_conf
,
TUSART_IRQ_Priorities
*
priorities
);
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_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_priorities
(
TComm
*
comm_dev
,
TUSART_IRQ_Priorities
*
priorities
);
void
usart1_set_baudrate
(
TComm
*
comm_dev
,
unsigned
int
baudrate
);
/* IRQ functions */
/* IRQ functions */
unsigned
char
usart1_send_irq
(
unsigned
char
first_byte
);
unsigned
char
usart1_send_irq
(
unsigned
char
first_byte
);
unsigned
char
usart1_enable_tx_irq
(
void
);
unsigned
char
usart1_enable_tx_irq
(
void
);
...
...
This diff is collapsed.
Click to expand it.
l0/usart/src/usart1.c
+
6
−
0
View file @
3d3856c0
...
@@ -281,6 +281,12 @@ void usart1_set_priorities(TComm *comm_dev,TUSART_IRQ_Priorities *priorities)
...
@@ -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 */
/* IRQ functions */
unsigned
char
usart1_send_irq
(
unsigned
char
first_byte
)
unsigned
char
usart1_send_irq
(
unsigned
char
first_byte
)
{
{
...
...
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