RDS on Samsung YPR0: Make compatible with RDS changes
si4700_rds_process() should only be called on the rising edge of
RDSR since it now rejects segments out of sequence. Receiving the
same segment multiple times due to rapid polling is of course out
of sequence so do no more processing until RDSR bit cycles to
avoid repeatedly sending the same data instance.
I don't have the tools installed to test compile so there could be
typos. However, I tested on gigabeat-s with YPR0 setup copied over
and it fixed the issue with PS and RT.
Change-Id: Iab511bef64030de8c07d4d22dcf338c8720e2ae2
diff --git a/firmware/target/hosted/samsungypr/radio-ypr.c b/firmware/target/hosted/samsungypr/radio-ypr.c
index af49c4c..4fccf26 100644
--- a/firmware/target/hosted/samsungypr/radio-ypr.c
+++ b/firmware/target/hosted/samsungypr/radio-ypr.c
@@ -88,6 +88,7 @@
/* start up frozen */
int timeout = TIMEOUT_BLOCK;
struct queue_event ev;
+ bool rds_rdy = false;
while (true) {
queue_wait_w_tmo(&rds_queue, &ev, timeout);
@@ -96,10 +97,14 @@
/* power up: timeout after 1 tick, else block indefinitely */
timeout = ev.data ? 1 : TIMEOUT_BLOCK;
break;
- case SYS_TIMEOUT:
+ case SYS_TIMEOUT:;
/* Captures RDS data and processes it */
- if ((si4709_read_reg(STATUSRSSI) & STATUSRSSI_RDSR) >> 8) {
- si4700_rds_process();
+ bool rdsr = si4709_read_reg(STATUSRSSI) & STATUSRSSI_RDSR;
+ if (rdsr != rds_rdy) {
+ rds_rdy = rdsr;
+ if (rdsr) {
+ si4700_rds_process();
+ }
}
break;
}