Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 3436

SDK • Centralising UART set up.

$
0
0
Hi,

It seems that to change/setup UART IO pins , I need to make changes to source code as well a cmake sturcture.

Code:

target_compile_definitions(pico_proj PRIVATE  PICO_DEFAULT_UART=1  PICO_CLOCK_AJDUST_PERI_CLOCK_WITH_SYS_CLOCK=1  PICO_DEFAULT_UART_TX_PIN=8  PICO_DEFAULT_UART_RX_PIN=9

Code:

 #if (USE_SDK_UART)    #if (TESTBUILD)      #define SERIAL_PORT 1      #define TX_PIN 8  // connects to RX pin on FDTI       #define RX_PIN 9    #else      #define SERIAL_PORT 1      #define TX_PIN 4  // connects to RX pin on FDTI       #define RX_PIN 5    #endif             gpio_set_function(TX_PIN, GPIO_FUNC_UART);      gpio_set_function(RX_PIN, GPIO_FUNC_UART); ...
It seems unstructured having to manually synchronise changes in different parts of the code. Is there a way to get this down to one change (presumably in cmake files) which centralise this to one point in the code ?

TIA.

Statistics: Posted by pie_face — Mon Dec 30, 2024 6:36 am — Replies 1 — Views 63



Viewing all articles
Browse latest Browse all 3436

Trending Articles