Skip to content
Snippets Groups Projects
Commit deb91e5e authored by Jakob's avatar Jakob
Browse files

feat: Starting transition

parent 5dab0c5b
No related branches found
No related tags found
1 merge request!1copied and adapted example from mdk, added init and config uart
#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.
}
......
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment