From 23a3dd8e504a6b7e22835e3bf196226d4b749004 Mon Sep 17 00:00:00 2001 From: Kuba <132459354+KubaPro010@users.noreply.github.com> Date: Thu, 2 May 2024 18:39:24 +0200 Subject: [PATCH] Update rds.c --- src/pifmrds/rds.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/pifmrds/rds.c b/src/pifmrds/rds.c index 972478b..afa2e4c 100644 --- a/src/pifmrds/rds.c +++ b/src/pifmrds/rds.c @@ -36,6 +36,7 @@ struct { int tp; int ms; int ab; + int di; char ps[PS_LENGTH]; char rt[RT_LENGTH]; int af[100]; @@ -125,6 +126,7 @@ int get_rds_ct_group(uint16_t *blocks, int enabled) { pattern. 'ps_state' and 'rt_state' keep track of where we are in the PS (0A) sequence or RT (2A) sequence, respectively. */ + void get_rds_group(int *buffer, int stereo, int ct_clock_enabled) { //no idea how to do ptyn and decoder id static int state = 0; static int ps_state = 0; @@ -136,7 +138,7 @@ void get_rds_group(int *buffer, int stereo, int ct_clock_enabled) { //no idea ho if(!get_rds_ct_group(blocks, ct_clock_enabled)) { // CT (clock time) has priority on other group types (when its on) if(state < 4) { blocks[1] = 0x0000 | rds_params.tp << 10 | rds_params.pty << 5 | rds_params.ta << 4 | rds_params.ms << 3 | ps_state; - if((ps_state == 3) && stereo) blocks[1] |= 0x0004; // DI Stereo, someone explain from where the 0004 comes from and what does "bit d0" mean? + if((ps_state == 3) && stereo) blocks[1] |= (rds_params.di << 2); //also yes i did see the bitshift 2 in micro rds, code for stereo is in binary 0001, bit shift 2 is 0100 which is equal to 0x0004 if(rds_params.af[0]) { // AF if(af_state == 0) { blocks[2] = (rds_params.af[0] + 224) << 8 | rds_params.af[1]; @@ -298,3 +300,7 @@ void set_rds_ms(int ms) { void set_rds_ab(int ab) { rds_params.ab = ab; } + +void set_rds_di(int di) { + rds_params.di = di; +}