Code: Select all
char alignas(uint32_t) out_buffer[16] = "Hello world!";
struct esp32_dma_linked_list dma_linked_list {
.dw0 =
ESP32_DMA_LINKED_LIST_DW0_OWNER |
ESP32_DMA_LINKED_LIST_DW0_EOF |
ESP32_DMA_LINKED_LIST_DW0_LENGTH(12) |
ESP32_DMA_LINKED_LIST_DW0_SIZE(16)
,
.dw1 = out_buffer,
.dw2 = nullptr
};
void setup_uart() {
*ESP32_UART0_FIFO_REG = ESP32_UART_RXFIFO_RD_BYTE('\0');
*ESP32_UART0_CONF0_REG =
ESP32_UART_TICK_REF_ALWAYS_ON |
ESP32_UART_TXFIFO_RST |
ESP32_UART_TXD_BRK |
ESP32_UART_STOP_BIT_NUM(1) |
ESP32_UART_BIT_NUM(3) |
ESP32_UART_PARITY_EN |
ESP32_UART_PARITY
;
*ESP32_UART0_CONF1_REG =
ESP32_UART_TXFIFO_EMPTY_THRHD(96) |
ESP32_UART_RXFIFO_FULL_THRHD(96)
;
set_baud_rate(9600);
*ESP32_UHCI0_CONF0_REG =
ESP32_UHCI_UART0_CE
;
*ESP32_UHCI0_DMA_OUT_LINK_REG =
ESP32_UHCI_OUTLINK_START |
ESP32_UHCI_OUTLINK_ADDR(((uintptr_t) &dma_linked_list) & 0xFFFFF)
;
}
void setup() {
setup_uart();
}
void loop() {
}