Пример #1
0
void Radio::updateAMTuneStatus() {
	int i;
	
	i2c.beginTransmission(SI4735ADR);
	i2c.write(0x42);
	i2c.write(0x00);
	i2c.endTransmission();
	_delay_ms(2);

	i2c.requestFrom(SI4735ADR, 6);
	for(int i = 0; i < 6; i++) {
		switch(i) {
			case 2:
			AMfreq = i2c.read() * 256;
			break;
			case 3:
			AMfreq += i2c.read();
			break;
			case 4:
			AMrssi = i2c.read();
			break;
			default:
			i2c.read();
		}
	}
}
Пример #2
0
void Radio::seekUpFMFreq() {

	i2c.beginTransmission(SI4735ADR);
	i2c.write(0x21);
	i2c.write(0x0C);
	i2c.endTransmission();
	_delay_ms(100);
}
Пример #3
0
void Radio::AMPowerOn() {

	i2c.beginTransmission(SI4735ADR);
	i2c.write(0x01);
	i2c.write(0x11);
	i2c.write(0x05);
	i2c.endTransmission();
	_delay_ms(500);
}
Пример #4
0
void Radio::seekDownAMFreq() {

	i2c.beginTransmission(SI4735ADR);
	i2c.write(0x41);
	i2c.write(0x04);
	i2c.write(0x00);
	i2c.write(0x00);
	i2c.endTransmission();
	_delay_ms(100);
}
Пример #5
0
void Radio::setFMFreq(int freq) {
	char hbyte, lbyte;
	
	hbyte = freq>>8;
	lbyte = freq & 0x00FF;
	i2c.beginTransmission(SI4735ADR);
	i2c.write(0x20);
	i2c.write(0x00);
	i2c.write(hbyte);
	i2c.write(lbyte);
	i2c.endTransmission();
	_delay_ms(100);
}
Пример #6
0
void Radio::updateFMRsqStatus() {
	int i;
	
	i2c.beginTransmission(SI4735ADR);
	i2c.write(0x23);
	i2c.write(0x20);
	i2c.endTransmission();
	_delay_ms(2);

	i2c.requestFrom(SI4735ADR, 6);
	for(int i = 0; i < 6; i++) {
		switch(i) {
			case 4:
			FMrssi = i2c.read();
			break;
			default:
			i2c.read();
		}
	}
}
Пример #7
0
void Radio::setProperty(int prop, int val) {
	char propertyHighByte;
	char propertyLowByte;
	char propertyValueHighByte;
	char propertyValueLowByte;
	
	propertyHighByte = prop>>8;
	propertyLowByte = prop & 0x00FF;
	propertyValueHighByte = val>>8;
	propertyValueLowByte = val & 0x00FF;
	
	i2c.beginTransmission(SI4735ADR);
	i2c.write(0x12);
	i2c.write(0x00);
	i2c.write(propertyHighByte);
	i2c.write(propertyLowByte);
	i2c.write(propertyValueHighByte);
	i2c.write(propertyValueLowByte);
	i2c.endTransmission();
	_delay_ms(20);
}