Would someone know more on the topic, attached parts of the Adafruit Si4713 library showing the printing logic.
- Code: Select all | TOGGLE FULL SIZE
void Adafruit_Si4713::setRDSstation(char *s) {
uint8_t i, len = strlen(s);
uint8_t slots = (len + 3) / 4;
for (uint8_t i = 0; i < slots; i++) {
memset(_i2ccommand, ' ', 6); // clear it with ' '
memcpy(_i2ccommand + 2, s, min(4, (int)strlen(s)));
s += 4;
_i2ccommand[6] = 0;
// Serial.print("Set slot #"); Serial.print(i);
// char *slot = (char *)( _i2ccommand+2);
// Serial.print(" to '"); Serial.print(slot); Serial.println("'");
_i2ccommand[0] = SI4710_CMD_TX_RDS_PS;
_i2ccommand[1] = i; // slot #
sendCommand(6);
}
}
void Adafruit_Si4713::setRDSbuffer(char *s) {
uint8_t i, len = strlen(s);
uint8_t slots = (len + 3) / 4;
char slot[5];
for (uint8_t i = 0; i < slots; i++) {
memset(_i2ccommand, ' ', 8); // clear it with ' '
memcpy(_i2ccommand + 4, s, min(4, (int)strlen(s)));
s += 4;
_i2ccommand[8] = 0;
// Serial.print("Set buff #"); Serial.print(i);
// char *slot = (char *)( _i2ccommand+4);
// Serial.print(" to '"); Serial.print(slot); Serial.println("'");
_i2ccommand[0] = SI4710_CMD_TX_RDS_BUFF;
if (i == 0)
_i2ccommand[1] = 0x06;
else
_i2ccommand[1] = 0x04;
_i2ccommand[2] = 0x20;
_i2ccommand[3] = i;
sendCommand(8);
}