next try for eeprom
This commit is contained in:
@@ -152,14 +152,17 @@ uint8_t edid_genChecksum(uint8_t *ediddata)
|
|||||||
return 0xff - bytessum + 1;
|
return 0xff - bytessum + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t edid_readFromDisplayToEEPROM(void)
|
uint8_t edid_readFromDisplay(void)
|
||||||
{
|
{
|
||||||
uint8_t const offset[1] = {0x00};
|
uint8_t const offset[1] = {0x00};
|
||||||
uint8_t displayedid[EDID_BLOCK_LENGTH];
|
uint8_t displayedid[EDID_BLOCK_LENGTH];
|
||||||
|
memset(displayedid, 0, sizeof(displayedid));
|
||||||
|
|
||||||
uint8_t error = 0;
|
uint8_t error = 0;
|
||||||
uint8_t retry = 20;
|
uint8_t retry = 20;
|
||||||
while( retry-- ) {
|
while( retry-- ) {
|
||||||
|
error = 0;
|
||||||
|
|
||||||
TWI_MasterForceIdle(&twimDisplay);
|
TWI_MasterForceIdle(&twimDisplay);
|
||||||
delay_ms(1);
|
delay_ms(1);
|
||||||
|
|
||||||
@@ -191,10 +194,14 @@ uint8_t edid_readFromDisplayToEEPROM(void)
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if( !retry ) {
|
if( error ) {
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( edid_checkData(displayedid) ) {
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
|
|
||||||
/* set EDID Extension Block count / flags to zero */
|
/* set EDID Extension Block count / flags to zero */
|
||||||
displayedid[126] = 0;
|
displayedid[126] = 0;
|
||||||
|
|
||||||
@@ -207,13 +214,19 @@ uint8_t edid_readFromDisplayToEEPROM(void)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint8_t edid_readFromEEPROM(void)
|
||||||
|
{
|
||||||
|
EEPROM_WaitForNVM(),
|
||||||
|
EEPROM_FlushBuffer();
|
||||||
|
EEPROM_DisableMapping();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
memset(edid_data, 0, sizeof(edid_data));
|
memset(edid_data, 0, sizeof(edid_data));
|
||||||
|
|
||||||
PORTB.DIR = (1<<3);
|
|
||||||
PORTE.DIR = (1<<2) | (1<<3);
|
|
||||||
|
|
||||||
edid_initHostTWI();
|
edid_initHostTWI();
|
||||||
edid_initDisplayTWI();
|
edid_initDisplayTWI();
|
||||||
|
|
||||||
@@ -232,7 +245,7 @@ int main(void)
|
|||||||
* Since uC supply == display +5V supply we're waiting 20ms here.
|
* Since uC supply == display +5V supply we're waiting 20ms here.
|
||||||
*/
|
*/
|
||||||
for(;;) {
|
for(;;) {
|
||||||
edid_readFromDisplayToEEPROM();
|
edid_readFromDisplay();
|
||||||
delay_ms(1000);
|
delay_ms(1000);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user