Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
traxanos committed Mar 19, 2024
1 parent 1e27d0c commit 53d736c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
11 changes: 5 additions & 6 deletions src/rp2040_arduino_platform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,6 @@ void RP2040ArduinoPlatform::setupUart()
if (uartDmaChannel == -1)
{
// configure uart0
println("----------------");
println(_rxPin);
println(_txPin);
gpio_set_function(_rxPin, GPIO_FUNC_UART);
gpio_set_function(_txPin, GPIO_FUNC_UART);
uart_init(KNX_DMA_UART, 19200);
Expand All @@ -202,9 +199,10 @@ void RP2040ArduinoPlatform::setupUart()
dma_channel_set_write_addr(uartDmaChannel, uartDmaBuffer, false);
dma_channel_set_trans_count(uartDmaChannel, uartDmaTransferCount, false);
dma_channel_set_config(uartDmaChannel, &dmaConfig, true);
dma_channel_set_irq0_enabled(uartDmaChannel, true);
irq_set_exclusive_handler(DMA_IRQ_0, uartDmaRestart);
irq_set_enabled(DMA_IRQ_0, true);
dma_channel_set_irq1_enabled(uartDmaChannel, true);
// irq_add_shared_handler(KNX_DMA_IRQ, uartDmaRestart, PICO_SHARED_IRQ_HANDLER_HIGHEST_ORDER_PRIORITY);
irq_set_exclusive_handler(KNX_DMA_IRQ, uartDmaRestart);
irq_set_enabled(KNX_DMA_IRQ, true);
}
#else
SerialUART* serial = dynamic_cast<SerialUART*>(_knxSerial);
Expand Down Expand Up @@ -242,6 +240,7 @@ int RP2040ArduinoPlatform::uartAvailable()
if (test < -1)
{
println("FATAL");
println(test);
println(uartDmaTransferCount);
println(tc);
println(uartDmaReadCount);
Expand Down
16 changes: 11 additions & 5 deletions src/rp2040_arduino_platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,20 @@

#endif

#if USE_KNX_DMA_UART == 0
#define KNX_DMA_UART uart0
#define KNX_DMA_UART_IRQ UART0_IRQ
#define KNX_DMA_UART_DREQ DREQ_UART0_RX
#elif USE_KNX_DMA_UART == 1
#if USE_KNX_DMA_UART == 1
#define KNX_DMA_UART uart1
#define KNX_DMA_UART_IRQ UART1_IRQ
#define KNX_DMA_UART_DREQ DREQ_UART1_RX
#else
#define KNX_DMA_UART uart0
#define KNX_DMA_UART_IRQ UART0_IRQ
#define KNX_DMA_UART_DREQ DREQ_UART0_RX
#endif

#if USE_KNX_DMA_IRQ == 1
#define KNX_DMA_IRQ DMA_IRQ_1
#else
#define KNX_DMA_IRQ DMA_IRQ_0
#endif


Expand Down

0 comments on commit 53d736c

Please sign in to comment.