Fix EEPROM is ready
This commit is contained in:
parent
27d8d44d34
commit
7008037de9
@ -79,10 +79,14 @@ typedef struct {
|
|||||||
|
|
||||||
void checkEEpromIsReady(){
|
void checkEEpromIsReady(){
|
||||||
printf("checking eeprom");
|
printf("checking eeprom");
|
||||||
if (eeprom_is_ready()){
|
while(1){
|
||||||
printf("it is");
|
if (eeprom_is_ready()){
|
||||||
}else{
|
break;
|
||||||
printf("its not");
|
printf("it is");
|
||||||
|
}else{
|
||||||
|
;
|
||||||
|
printf("its not");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -107,7 +111,7 @@ config_t ReadStructInEEPROM(){
|
|||||||
config_t readStruct;
|
config_t readStruct;
|
||||||
uint8_t structsize = sizeof(readStruct);
|
uint8_t structsize = sizeof(readStruct);
|
||||||
|
|
||||||
//checkEEpromIsReady();
|
checkEEpromIsReady();
|
||||||
|
|
||||||
eeprom_read_block((void *) &readStruct,(void*) &fanControllerStartAddress, structsize);
|
eeprom_read_block((void *) &readStruct,(void*) &fanControllerStartAddress, structsize);
|
||||||
return readStruct;
|
return readStruct;
|
||||||
@ -115,7 +119,7 @@ config_t ReadStructInEEPROM(){
|
|||||||
|
|
||||||
void WriteFanSpeedInEEPROM(uint8_t fanSpeed){
|
void WriteFanSpeedInEEPROM(uint8_t fanSpeed){
|
||||||
|
|
||||||
//checkEEpromIsReady();
|
checkEEpromIsReady();
|
||||||
|
|
||||||
eeprom_write_byte(currentFanSpeedAddress, fanSpeed);
|
eeprom_write_byte(currentFanSpeedAddress, fanSpeed);
|
||||||
currentFanSpeedAddress++;
|
currentFanSpeedAddress++;
|
||||||
@ -128,7 +132,7 @@ void ReadFanSpeedInfo(){
|
|||||||
uint8_t len = currentFanSpeedAddress - fanSpeedStartAddress;
|
uint8_t len = currentFanSpeedAddress - fanSpeedStartAddress;
|
||||||
uint8_t fanSpeedIterate = 0;
|
uint8_t fanSpeedIterate = 0;
|
||||||
|
|
||||||
//checkEEpromIsReady();
|
checkEEpromIsReady();
|
||||||
|
|
||||||
for (uint8_t i = 0; i <len; i++){
|
for (uint8_t i = 0; i <len; i++){
|
||||||
fanSpeedIterate = eeprom_read_byte(i);
|
fanSpeedIterate = eeprom_read_byte(i);
|
||||||
@ -147,7 +151,7 @@ void main() {
|
|||||||
|
|
||||||
while(1){
|
while(1){
|
||||||
printf("in loop\n");
|
printf("in loop\n");
|
||||||
printf("Write the struct \n");
|
printf("Write the struct \n");
|
||||||
WriteStructInEEPROM(fanController);
|
WriteStructInEEPROM(fanController);
|
||||||
|
|
||||||
printf("Read struct\n");
|
printf("Read struct\n");
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user