feat: SPI DMA
Squashed commit of the following: commit c3e1f696b4fbafb6dd30c6934e4c7c181562e055 Author: kuwoyuki <kuwoyuki@cock.li> Date: Sat Oct 12 20:43:12 2024 +0600 chore: spi dma commit d1e7df60be3e06ed85ce8639516e299085d3c72b Author: kuwoyuki <kuwoyuki@cock.li> Date: Sat Oct 12 15:14:11 2024 +0600 static dummies commit 81682428b471f825e3350e37aa74c373b46d4fef Author: kuwoyuki <kuwoyuki@cock.li> Date: Sat Oct 12 14:45:39 2024 +0600 dma works? commit 150c97a4b566712a502d8a2861a2dc0864324d61 Author: kuwoyuki <kuwoyuki@cock.li> Date: Sat Oct 12 02:07:39 2024 +0600 dma?
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
#include "ch32v003fun.h"
|
||||
|
||||
// Write multiple chars to UART
|
||||
int _write(int fd, const char *buf, int size) {
|
||||
int _write(__attribute__((unused)) int fd, const char *buf, int size) {
|
||||
for (int i = 0; i < size; i++) {
|
||||
while (!(USART2->STATR & USART_FLAG_TC)); // Wait for transmission complete
|
||||
USART2->DATAR = *buf++; // Send character
|
||||
@@ -18,8 +18,8 @@ int putchar(int c) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
void setup_uart(int uart_brr) {
|
||||
// RCC->APB2PCENR |= RCC_APB2Periph_GPIOA; // Enable GPIOA on APB2
|
||||
void init_uart(int uart_brr) {
|
||||
RCC->APB2PCENR |= RCC_APB2Periph_GPIOA; // Enable GPIOA on APB2
|
||||
RCC->APB1PCENR |= RCC_APB1Periph_USART2; // Enable USART2 on APB1
|
||||
|
||||
GPIOA->CFGLR &= ~(0xf << (4 * 2)); // Clear bits for PA2
|
||||
|
||||
Reference in New Issue
Block a user