Update rds.c

This commit is contained in:
Kuba 2024-05-02 18:39:24 +02:00 committed by GitHub
parent 09fd9646d6
commit 23a3dd8e50
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 1 deletions

View File

@ -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;
}