diff options
Diffstat (limited to 'firmware/drivers')
-rw-r--r-- | firmware/drivers/rds.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/firmware/drivers/rds.c b/firmware/drivers/rds.c index 05b17aba12..73118b4c37 100644 --- a/firmware/drivers/rds.c +++ b/firmware/drivers/rds.c | |||
@@ -25,7 +25,8 @@ | |||
25 | #include "rds.h" | 25 | #include "rds.h" |
26 | 26 | ||
27 | /* programme identification */ | 27 | /* programme identification */ |
28 | static uint16_t pi; | 28 | static uint16_t pi_code; |
29 | static uint16_t pi_last; | ||
29 | /* program service name */ | 30 | /* program service name */ |
30 | static char ps_data[9]; | 31 | static char ps_data[9]; |
31 | static char ps_copy[9]; | 32 | static char ps_copy[9]; |
@@ -69,11 +70,12 @@ void rds_reset(void) | |||
69 | { | 70 | { |
70 | int oldlevel = rds_disable_irq_save(); | 71 | int oldlevel = rds_disable_irq_save(); |
71 | 72 | ||
73 | pi_code = 0; | ||
74 | pi_last = 0; | ||
72 | ps_copy[0] = '\0'; | 75 | ps_copy[0] = '\0'; |
73 | ps_segment = 0; | 76 | ps_segment = 0; |
74 | rt_copy[0] = '\0'; | 77 | rt_copy[0] = '\0'; |
75 | rt_segment = 0; | 78 | rt_segment = 0; |
76 | pi = 0; | ||
77 | 79 | ||
78 | rds_restore_irq(oldlevel); | 80 | rds_restore_irq(oldlevel); |
79 | } | 81 | } |
@@ -180,10 +182,12 @@ bool rds_process(uint16_t data[4]) | |||
180 | { | 182 | { |
181 | int group; | 183 | int group; |
182 | 184 | ||
183 | /* get programme identification */ | 185 | /* process programme identification (PI) code */ |
184 | if (pi == 0) { | 186 | uint16_t pi = data[0]; |
185 | pi = data[0]; | 187 | if (pi == pi_last) { |
188 | pi_code = pi; | ||
186 | } | 189 | } |
190 | pi_last = pi; | ||
187 | 191 | ||
188 | /* handle rds data based on group */ | 192 | /* handle rds data based on group */ |
189 | group = (data[1] >> 11) & 0x1F; | 193 | group = (data[1] >> 11) & 0x1F; |
@@ -210,7 +214,7 @@ bool rds_process(uint16_t data[4]) | |||
210 | /* returns the programme identification code */ | 214 | /* returns the programme identification code */ |
211 | uint16_t rds_get_pi(void) | 215 | uint16_t rds_get_pi(void) |
212 | { | 216 | { |
213 | return pi; | 217 | return pi_code; |
214 | } | 218 | } |
215 | 219 | ||
216 | /* returns the most recent valid programme service name */ | 220 | /* returns the most recent valid programme service name */ |