Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
minimal-esp32c3-samples
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
Projekt Telematik SS23 QEMU
minimal-esp32c3-samples
Commits
deb91e5e
Commit
deb91e5e
authored
1 year ago
by
Jakob
Browse files
Options
Downloads
Patches
Plain Diff
feat: Starting transition
parent
5dab0c5b
No related branches found
No related tags found
1 merge request
!1
copied and adapted example from mdk, added init and config uart
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/uart-transmit/esp32-c3-uart-interface.c
+12
-3
12 additions, 3 deletions
src/uart-transmit/esp32-c3-uart-interface.c
src/uart-transmit/esp32-c3-uart-interface.h
+1
-1
1 addition, 1 deletion
src/uart-transmit/esp32-c3-uart-interface.h
with
13 additions
and
4 deletions
src/uart-transmit/esp32-c3-uart-interface.c
+
12
−
3
View file @
deb91e5e
#include
"esp32-c3-uart-interface.h"
static
void
clearBits
(
volatile
uint32_t
*
registerAddress
,
uint32_t
bitPositions
,
uint32_t
numBits
)
{
uint32_t
mask
=
(
uint32_t
)(
1
<<
numBits
)
-
1
;
// Create a mask with the specified number of bits set to 1
mask
<<=
bitPositions
;
// Shift the mask to the correct bit positions
*
registerAddress
&=
~
mask
;
// Clear the bits in the register using bitwise AND with the inverse of the mask
uint32_t
mask
=
(
uint32_t
)(
1
<<
numBits
)
-
1
;
mask
<<=
bitPositions
;
*
registerAddress
&=
~
mask
;
}
static
void
setBit
(
volatile
uint32_t
*
registerAddress
,
uint32_t
bitPositions
)
{
uint32_t
mask
=
(
uint32_t
)(
1
<<
bitPositions
);
*
registerAddress
|=
~
mask
;
}
static
void
init_uart_enable_clk
(){
...
...
@@ -151,7 +156,11 @@ void enable_uart_transmitter(){
set_65_to_rd_byte
();
// clear UART_TXFIFO_EMPTY_INT interrupt by setting UART_TXFIFO_EMPTY_INT_CLR;
setBit
(
C3_UART_INT_CLR_REG_UART0
,
1
)
// enable UART_TXFIFO_EMPTY_INT interrupt by setting UART_TXFIFO_EMPTY_INT_ENA;
setBit
(
C3_UART_INT_ENA_REG_UART0
,
1
)
// detect UART_TXFIFO_EMPTY_INT and wait for the completion of data transmission.
}
...
...
This diff is collapsed.
Click to expand it.
src/uart-transmit/esp32-c3-uart-interface.h
+
1
−
1
View file @
deb91e5e
...
...
@@ -19,7 +19,7 @@
#define C3_UART_INT_CLR_REG_UART0 ((volatile uint32_t *)C3_BASE_OFFSET_UART_CONTROLLER_0+0x0010)
#define C3_UART_INT_CLR_REG_UART1 ((volatile uint32_t *)C3_BASE_OFFSET_UART_CONTROLLER_1+0x0010)
// UART_TXFIFO_EMPTY_INT_CLR
// UART_TXFIFO_EMPTY_INT_CLR
is on 1
#define C3_SYSTEM_PERIP_CLK_EN0_REG ((volatile uint32_t *)C3_BASE_OFFSET_SYSTEM_REGISTERS+0x0010)
// SYSTEM_UART_MEM_CLK_EN is on 24
...
...
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