| 1 | uint16_t EEPROM_power_protocol EEMEM;
 | 
| 2 | uint16_t EEPROM_power_address EEMEM;
 | 
| 3 | uint16_t EEPROM_power_command EEMEM;
 | 
| 4 | 
 | 
| 5 | uint16_t EEPROM_lower_protocol EEMEM;
 | 
| 6 | uint16_t EEPROM_lower_address EEMEM;
 | 
| 7 | uint16_t EEPROM_lower_command EEMEM;
 | 
| 8 | 
 | 
| 9 | uint16_t EEPROM_higher_protocol EEMEM;
 | 
| 10 | uint16_t EEPROM_higher_address EEMEM;
 | 
| 11 | uint16_t EEPROM_higher_command EEMEM;
 | 
| 12 | 
 | 
| 13 | //Ferbedinung Config
 | 
| 14 | uint16_t power_protocol;
 | 
| 15 | uint16_t power_address;
 | 
| 16 | uint16_t power_command;
 | 
| 17 | 
 | 
| 18 | uint16_t lower_protocol;
 | 
| 19 | uint16_t lower_address;
 | 
| 20 | uint16_t lower_command;
 | 
| 21 | 
 | 
| 22 | uint16_t higher_protocol;
 | 
| 23 | uint16_t higher_address;
 | 
| 24 | uint16_t higher_command;
 | 
| 25 | 
 | 
| 26 | void check_config (void)
 | 
| 27 | {
 | 
| 28 |     if (power_protocol == 0xFFFF || power_address == 0xFFFF || power_command == 0xFFFF ||//Wenn nur einer davon nicht gesetzt ist müssen alle neu gesetzt werden
 | 
| 29 |         lower_protocol == 0xFFFF || lower_address == 0xFFFF || lower_command == 0xFFFF ||
 | 
| 30 |         higher_protocol == 0xFFFF || higher_address == 0xFFFF || higher_command == 0xFFFF)
 | 
| 31 |     {
 | 
| 32 |         uint8_t i=0;
 | 
| 33 |         do 
 | 
| 34 |         {
 | 
| 35 |             if (irmp_get_data (&irmp_data))
 | 
| 36 |             {
 | 
| 37 |                 if (!(irmp_data.flags & IRMP_FLAG_REPETITION))
 | 
| 38 |                 {
 | 
| 39 |                     if (i==0)
 | 
| 40 |                     {
 | 
| 41 |                         power_protocol = irmp_data.protocol;
 | 
| 42 |                         power_address = irmp_data.address;
 | 
| 43 |                         power_command = irmp_data.command;
 | 
| 44 |                     }
 | 
| 45 |                     
 | 
| 46 |                     else if (i==1)
 | 
| 47 |                     {
 | 
| 48 |                         higher_protocol = irmp_data.protocol;
 | 
| 49 |                         higher_address = irmp_data.address;
 | 
| 50 |                         higher_command = irmp_data.command;
 | 
| 51 |                     }
 | 
| 52 |                     
 | 
| 53 |                     else if (i==2)
 | 
| 54 |                     {
 | 
| 55 |                         lower_protocol = irmp_data.protocol;
 | 
| 56 |                         lower_address = irmp_data.address;
 | 
| 57 |                         lower_command = irmp_data.command;
 | 
| 58 |                     }
 | 
| 59 |                     i++; 
 | 
| 60 |                 }
 | 
| 61 |             }
 | 
| 62 |         } while    (power_protocol == 0xFFFF || power_address == 0xFFFF || power_command == 0xFFFF ||
 | 
| 63 |                     lower_protocol == 0xFFFF || lower_address == 0xFFFF || lower_command == 0xFFFF ||
 | 
| 64 |                     higher_protocol == 0xFFFF || higher_address == 0xFFFF || higher_command == 0xFFFF);
 | 
| 65 |         
 | 
| 66 |         set_fb_config();
 | 
| 67 |     } 
 | 
| 68 | }
 | 
| 69 | 
 | 
| 70 | void get_fb_config (void)
 | 
| 71 | {
 | 
| 72 |     power_protocol = eeprom_read_word (&EEPROM_power_protocol);
 | 
| 73 |     power_address = eeprom_read_word (&EEPROM_power_address);
 | 
| 74 |     power_command = eeprom_read_word (&EEPROM_power_command);
 | 
| 75 | 
 | 
| 76 |     lower_protocol = eeprom_read_word (&EEPROM_lower_protocol);
 | 
| 77 |     lower_address = eeprom_read_word (&EEPROM_lower_address);
 | 
| 78 |     lower_command = eeprom_read_word (&EEPROM_lower_command);
 | 
| 79 | 
 | 
| 80 |     higher_protocol = eeprom_read_word (&EEPROM_higher_protocol);
 | 
| 81 |     higher_address = eeprom_read_word (&EEPROM_higher_address);
 | 
| 82 |     higher_command = eeprom_read_word (&EEPROM_higher_command);
 | 
| 83 | }
 | 
| 84 | 
 | 
| 85 | void set_fb_config (void)
 | 
| 86 | {
 | 
| 87 |     eeprom_write_word (&EEPROM_power_protocol, power_protocol);
 | 
| 88 |     eeprom_write_word (&EEPROM_power_address, power_address);
 | 
| 89 |     eeprom_write_word (&EEPROM_power_command, power_command);
 | 
| 90 | 
 | 
| 91 |     eeprom_write_word (&EEPROM_lower_protocol, lower_protocol);
 | 
| 92 |     eeprom_write_word (&EEPROM_lower_address, lower_address);
 | 
| 93 |     eeprom_write_word (&EEPROM_lower_command, lower_command);
 | 
| 94 | 
 | 
| 95 |     eeprom_write_word (&EEPROM_higher_protocol, higher_protocol);
 | 
| 96 |     eeprom_write_word (&EEPROM_higher_address, higher_address);
 | 
| 97 |     eeprom_write_word (&EEPROM_higher_command, higher_command);
 | 
| 98 | }
 |