This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class TEA5767N { | |
| private: | |
| //... | |
| byte transmission_data[5]; | |
| byte reception_data[5]; | |
| //... | |
| public: | |
| //... | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| TEA5767N::TEA5767N() { | |
| Wire.begin(); | |
| initializeTransmissionData(); | |
| } | |
| void TEA5767N::initializeTransmissionData() { | |
| transmission_data[FIRST_DATA] = 0; | |
| transmission_data[SECOND_DATA] = 0; | |
| transmission_data[THIRD_DATA] = 0xB0; | |
| transmission_data[FOURTH_DATA] = 0x10; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void TEA5767N::mute() { | |
| setSoundOff(); | |
| transmitData(); | |
| } | |
| void TEA5767N::setSoundOff() { | |
| transmission_data[FIRST_DATA] |= 0b10000000; | |
| } | |
| void TEA5767N::transmitData() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void TEA5767N::setSoundOn() { | |
| transmission_data[FIRST_DATA] &= 0b01111111; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void TEA5767N::loadFrequency() { | |
| readStatus(); | |
| transmission_data[FIRST_DATA] = (transmission_data[FIRST_DATA] & 0xC0) | (reception_data[FIRST_DATA] & 0x3F); | |
| transmission_data[SECOND_DATA] = reception_data[SECOND_DATA]; | |
| } | |
| void TEA5767N::readStatus() { | |
| Wire.requestFrom (TEA5767_I2C_ADDRESS, 5); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void TEA5767N::selectFrequency(float frequency) { | |
| calculateOptimalHiLoInjection(frequency); | |
| transmitFrequency(frequency); | |
| } | |
| void TEA5767N::calculateOptimalHiLoInjection(float freq) { | |
| byte signalHigh; | |
| byte signalLow; | |
| setHighSideLOInjection(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void TEA5767N::transmitFrequency(float frequency) { | |
| setFrequency(frequency); | |
| transmitData(); | |
| } | |
| void TEA5767N::setFrequency(float _frequency) { | |
| frequency = _frequency; | |
| unsigned int frequencyW; | |
| if (hiInjection) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #define LOW_STOP_LEVEL 1 | |
| #define MID_STOP_LEVEL 2 | |
| #define HIGH_STOP_LEVEL 3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void TEA5767N::setSearchUp() { | |
| transmission_data[THIRD_DATA] |= 0b10000000; | |
| } | |
| void TEA5767N::setSearchDown() { | |
| transmission_data[THIRD_DATA] &= 0b01111111; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void TEA5767N::setSearchLowStopLevel() { | |
| transmission_data[THIRD_DATA] &= 0b10011111; | |
| transmission_data[THIRD_DATA] |= (LOW_STOP_LEVEL << 5); | |
| } | |
| void TEA5767N::setSearchMidStopLevel() { | |
| transmission_data[THIRD_DATA] &= 0b10011111; | |
| transmission_data[THIRD_DATA] |= (MID_STOP_LEVEL << 5); | |
| } |
OlderNewer