Read telemetry data via UART ports

Hello i have been attempting to read UART data from telem 1 of my pixhawk 4 mini. i tried implementing a code similar to yours, but i haven’t managed to make it work . Did you please manage to make it work ? If so can you please provide some advice on what i have to change . Attached is my code , i can’t read any data on the serial terminal .
#include <GCS_MAVLink/GCS.h>
#include <AP_HAL/AP_HAL.h>
#include <stdio.h>
#include <stdio.h>

void setup();
void loop();

const AP_HAL::HAL& hal = AP_HAL::get_HAL();

/* setup UART at 115200 ---------------------------------------- */
static void setup_uart(AP_HAL::UARTDriver *uart, const char *name)
if (uart == NULL)
// that UART doesn’t exist on this platform

void setup(void)
/* Setup UartC ------------- */
hal.scheduler->delay(1000); //Ensure that the uartA can be initialized
setup_uart(hal.serial(1), “SERIAL1”);

//static void test_uart(AP_HAL::UARTDriver *uart, const char *name)
void loop(void)
{ char c = 0;
static char buf[16];
static unsigned int i;

while(hal.serial(1)->available() > 0 && c != '\n' && i < sizeof(buf)){
  c = hal.serial(1)->read();
  buf[i++] = c;
  ::printf("UART %c",c);
  gcs().send_text(MAV_SEVERITY_CRITICAL, "UART1 %c ",  c);