mirror of
https://github.com/radio95-rnt/rds95.git
synced 2026-02-27 04:43:52 +01:00
you can send additional information via 1A and eon also this update requires a reset of the save
This commit is contained in:
4
doc.md
4
doc.md
@@ -45,6 +45,10 @@ Sets the TA flag and triggers Traffic PS: `TA=0`
|
||||
Sets the DPTY flag: `DPTY=1`
|
||||
*Formerly DI*
|
||||
|
||||
### SLCD
|
||||
|
||||
The 1A group where ECC is sent can also be used to send broadcaster data: `SLCD=FFF`
|
||||
|
||||
### CT
|
||||
|
||||
Toggles the transmission of CT groups: `CT=1`
|
||||
|
||||
@@ -89,6 +89,11 @@ static void handle_dpty(char *arg, RDSModulator* mod, char* output) {
|
||||
strcpy(output, "+\0");
|
||||
}
|
||||
|
||||
static void handle_slcdata(char *arg, RDSModulator* mod, char* output) {
|
||||
mod->enc->data[mod->enc->program].slc_data = strtoul(arg, NULL, 16);
|
||||
strcpy(output, "+\0");
|
||||
}
|
||||
|
||||
static void handle_tp(char *arg, RDSModulator* mod, char* output) {
|
||||
mod->enc->data[mod->enc->program].tp = atoi(arg);
|
||||
strcpy(output, "+\0");
|
||||
@@ -400,6 +405,11 @@ static void handle_eonaf(char *arg, char *pattern, RDSModulator* mod, char* outp
|
||||
strcpy(output, "+\0");
|
||||
}
|
||||
|
||||
static void handle_eondt(char *arg, char *pattern, RDSModulator* mod, char* output) {
|
||||
mod->enc->data[mod->enc->program].eon[atoi(pattern)-1].data = strtoul(arg, NULL, 16);
|
||||
strcpy(output, "+\0");
|
||||
}
|
||||
|
||||
static const command_handler_t commands_eq3[] = {
|
||||
{"PS", handle_ps, 2},
|
||||
{"PI", handle_pi, 2},
|
||||
@@ -424,6 +434,7 @@ static const command_handler_t commands_eq5[] = {
|
||||
{"TEXT", handle_rt1, 4},
|
||||
{"PTYN", handle_ptyn, 4},
|
||||
{"DPTY", handle_dpty, 4},
|
||||
{"SLCD", handle_slcd, 4},
|
||||
};
|
||||
|
||||
static const command_handler_t commands_eq2[] = {
|
||||
@@ -466,6 +477,7 @@ static const pattern_command_handler_t pattern_commands[] = {
|
||||
{"EON", "TA", handle_eonta},
|
||||
{"EON", "TP", handle_eontp},
|
||||
{"EON", "AF", handle_eonaf},
|
||||
{"EON", "DT", handle_eondt}
|
||||
{"UDG", "", handle_udg},
|
||||
};
|
||||
|
||||
|
||||
25
src/rds.c
25
src/rds.c
@@ -298,6 +298,12 @@ static void get_rds_ecc_group(RDSEncoder* enc, RDSGroup *group) {
|
||||
group->c = enc->data[enc->program].ecc;
|
||||
}
|
||||
|
||||
static void get_rds_slcdata_group(RDSEncoder* enc, RDSGroup *group) {
|
||||
group->b |= 1 << 12;
|
||||
group->c = 0x6000;
|
||||
group->c |= enc->data[enc->program].slc_data;
|
||||
}
|
||||
|
||||
static void get_rds_rtplus_group(RDSEncoder* enc, RDSGroup *group) {
|
||||
group->b |= 11 << 12;
|
||||
group->b |= enc->rtpState[enc->program].toggle << 4 | enc->rtpData[enc->program].running << 3;
|
||||
@@ -332,20 +338,22 @@ get_eon:
|
||||
break;
|
||||
case 4:
|
||||
group->c = get_next_af_eon(enc, enc->state[enc->program].eon_index);
|
||||
group->b |= enc->state[enc->program].eon_state;
|
||||
break;
|
||||
case 5: // 13
|
||||
if(eon.pty == 0 && eon.tp == 0) {
|
||||
break;
|
||||
}
|
||||
group->c = eon.pty << 11;
|
||||
if(eon.tp) group->c |= eon.ta;
|
||||
group->b |= 13;
|
||||
break;
|
||||
case 6: // 15
|
||||
group->c = eon.data;
|
||||
group->b |= 15;
|
||||
break;
|
||||
}
|
||||
|
||||
group->d = eon.pi;
|
||||
|
||||
if(enc->state[enc->program].eon_state == 5) {
|
||||
if(enc->state[enc->program].eon_state == 6) {
|
||||
enc->state[enc->program].eon_index++;
|
||||
|
||||
uint8_t i = 0;
|
||||
@@ -421,7 +429,12 @@ static void get_rds_sequence_group(RDSEncoder* enc, RDSGroup *group, char* grp,
|
||||
get_rds_ps_group(enc, group);
|
||||
goto group_coded;
|
||||
case '1':
|
||||
get_rds_ecc_group(enc, group);
|
||||
if(enc->state[enc->program].data_ecc == 0 && enc->data[enc->program].slc_data != 0) {
|
||||
get_rds_slcdata_group(enc, group);
|
||||
} else {
|
||||
get_rds_ecc_group(enc, group);
|
||||
}
|
||||
enc->state[enc->program].data_ecc ^= 1;
|
||||
goto group_coded;
|
||||
case '2':
|
||||
get_rds_rt_group(enc, group);
|
||||
@@ -478,7 +491,7 @@ static uint8_t check_rds_good_group(RDSEncoder* enc, char* grp, uint8_t stream)
|
||||
(void)stream;
|
||||
uint8_t good_group = 0;
|
||||
if(*grp == '0') good_group = 1;
|
||||
if(*grp == '1' && enc->data[enc->program].ecc != 0) good_group = 1;
|
||||
if(*grp == '1' && (enc->data[enc->program].ecc != 0 || enc->data[enc->program].slc_data != 0)) good_group = 1;
|
||||
if(*grp == '2' && (enc->data[enc->program].rt1_enabled || enc->data[enc->program].rt2_enabled)) good_group = 1;
|
||||
if(*grp == 'A' && enc->data[enc->program].ptyn_enabled) good_group = 1;
|
||||
if(*grp == 'E') {
|
||||
|
||||
@@ -48,6 +48,7 @@ typedef struct {
|
||||
uint8_t pty : 5;
|
||||
char ps[8];
|
||||
RDSAFs af;
|
||||
uint16_t data : 16;
|
||||
} RDSEON;
|
||||
typedef struct {
|
||||
uint16_t pi;
|
||||
@@ -56,6 +57,7 @@ typedef struct {
|
||||
char rt1[RT_LENGTH];
|
||||
|
||||
uint8_t ecc;
|
||||
uint16_t slc_data : 12;
|
||||
|
||||
uint8_t ta : 1;
|
||||
uint8_t pty : 5;
|
||||
@@ -138,6 +140,7 @@ typedef struct {
|
||||
|
||||
uint8_t rtp_oda : 1;
|
||||
uint8_t ert_oda : 1;
|
||||
uint8_t data_ecc : 1;
|
||||
uint8_t grp_seq_idx[4];
|
||||
uint8_t udg_idxs[2];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user