diff options
| author | Mirta <mirta@twine-s.com> | 2020-12-30 16:39:52 +0200 |
|---|---|---|
| committer | Mirta <mirta@twine-s.com> | 2020-12-30 16:39:52 +0200 |
| commit | 00a491d93733d4625ad329b2ba8237f445364b3f (patch) | |
| tree | 4b24c6fa78d7648f4bb7cefafa464bb0b063fec4 /Software/Embedded_SW/Embedded/Main.c | |
| parent | 124ad4150f80c6846fdee41dbbda9848c105f6e5 (diff) | |
| download | Tango-00a491d9.tar.gz Tango-00a491d9.zip | |
merge
Diffstat (limited to 'Software/Embedded_SW/Embedded/Main.c')
| -rw-r--r-- | Software/Embedded_SW/Embedded/Main.c | 47 |
1 files changed, 29 insertions, 18 deletions
diff --git a/Software/Embedded_SW/Embedded/Main.c b/Software/Embedded_SW/Embedded/Main.c index c1eeff837..9c647e847 100644 --- a/Software/Embedded_SW/Embedded/Main.c +++ b/Software/Embedded_SW/Embedded/Main.c @@ -13,6 +13,7 @@ */ #include <driverlib/sysctl.h> #include "driverlib/eeprom.h" +#include "driverlib/hibernate.h" #include "Drivers/USB_Communication/USBCDCD.h" #include "Drivers/I2C_Communication/I2C.h" @@ -137,21 +138,6 @@ Void MyswitchFxn(Task_Handle prev, Task_Handle next) PrevTask = prev; NextTask = next; } -void updateresetreasonineeprom(int i) -{ -#define Head_Address 40 -#define Max_Address 100 - uint32_t Head; - uint32_t RESC = SysCtlResetCauseGet(); - - EEPROMRead(&Head,Head_Address*4, 4); - if (Head>=Max_Address) Head=0; - Head++; - RESC+=(i*0x1000); - EEPROMProgram(&Head, Head_Address*4, 4); - EEPROMProgram(&RESC, (Head_Address+Head)*4, 4); - -} /* ======== errHook ======== */ Void errHook(Error_Block *eb) { @@ -161,7 +147,7 @@ Void errHook(Error_Block *eb) //char File[50] = "";*/ char message[300]; int len; - updateresetreasonineeprom(InitFailures); + MCU_E2PromUpdateResetReason(InitFailures); //STATUS_GREEN_LED_OFF; ACTIVITY_GREEN_LED_OFF; @@ -183,6 +169,8 @@ Void errHook(Error_Block *eb) { FirstErrorFlag = false; MCU_E2PromProgram(EEPROM_INIT_FAILURE_COUNTER,InitFailures+1); + utilsStoreLocalTime(); + len = usnprintf(message, 300, "\r\nerror task 0x%x %s context prev task 0x%x,%s", PrevTask,Task_Handle_name(PrevTask),NextTask,Task_Handle_name(NextTask)); f_write(LogFileHandle,message,len,&Bytes ); site = Error_getSite(eb); @@ -249,6 +237,8 @@ void Init_EVB() int main(void) { FRESULT Fresult = FR_OK; + time_t time_store = 0; + unsigned char Brd_ID = 0, Assy_ID = 0; // Enable interrupts to the processor. // ROM_IntMasterDisable(); @@ -270,7 +260,7 @@ int main(void) uint32_t Data,i; MCU_E2PromInit(); - updateresetreasonineeprom(0); + MCU_E2PromUpdateResetReason(0); #endif #ifdef EVALUATION_BOARD @@ -316,6 +306,13 @@ int main(void) #endif } + utilsInit(ui32SysClock); + MCU_E2PromRead(EEPROM_LOCAL_TIME,&time_store); + if (time_store) + { + ulocaltime(time_store+5,&LocalTime); + HibernateCalendarSet(&LocalTime); + } OpenLogFile(); Data = MCU_E2PromEmbeddedVersionRead(); memcpy (&Version,&Data,4); @@ -359,6 +356,21 @@ int main(void) I2C_DispRFIDTask_Init();//I2C Task for dispensers & RFID + + Read_HW_Version(&Brd_ID, &Assy_ID); + + +#ifdef USE_UART4_FOR_BTSR + if(Assy_ID > 0) + { + BTSR_Init(); + } + else + { + ReportWithPackageFilter(ThreadFilter,"BTSR - ERROR: Wrong HW Version",__FILE__,__LINE__,(int)Brd_ID,RpError,(int)Assy_ID,0); + } +#endif + #if defined(USE_RFID_LOGIC) || defined(USE_RFID_STUB) //Trigger_RFID_Init(); //Init_IFS();//must be done after FPGA_Init Init_IFS(); @@ -382,7 +394,6 @@ int main(void) #endif CommunicationTaskInit(); - utilsInit(ui32SysClock); #ifndef EVALUATION_BOARD //Turn_the_Blower_On();//Turn on with the Default_Voltage |
