#include #include "include.h" /*#include #include #include #include #include //#include #include #include #include #include */ #include #include "Drivers/USB_Communication/USBCDCD.h" #include "PMR/common/MessageContainer.pb-c.h" #include "Common/Sys_PinOut_Config/Pin.h" #include "Common/Sys_PinOut_Config/Pin_config.h" #include "Common/utilities/idle_task.h" #include "Drivers/ADC_Sampling/ADC.h" #include "Drivers/Peripheral_GPIO/GPIO.h" #include "Drivers/Peripheral_GPIO/GPIO.h" #include "drivers/Heater/Heater.h" #include "Communication/CommunicationTask.h" #include "drivers/twine_graphicslib/graphics_adapter.h" #include #include #include "Sys_PinOut_Config/MCU_MAIN_pinout.h" /* #include "Drivers/SPI_SDCARD/SDSPI.h" #include "Drivers/SPI_SDCARD/SDCardSPI.h" #include "Drivers/Ethernet_Config/EMACCommon.h" #include "Drivers/USBStick_FileSys/USBstick.h" #include "Drivers/USBStick_FileSys/USBMSCHFatFs.h" */ #include "Modules/Control/control.h" #include "Modules/Heaters/Heaters_ex.h" #include "StateMachines/Printing/PrintingSTM.h" extern Semaphore_Handle sdCardSem; #include "drivers/Danser_SSI/SSI_Comm.h" #include "drivers/SPI/SPI_Comm.h" #include "drivers/Uart_Comm/Uart.h" #include "drivers/FPGA/FPGA.h" #include "drivers/I2C_Communication/I2C.h" //#define WATCHDOG //***************************************************************************** // // The system tick rate expressed both as ticks per second and a millisecond // period. // //***************************************************************************** #define TICKS_PER_SECOND 1000 //***************************************************************************** // // Global system tick counter // //***************************************************************************** static volatile uint32_t g_ui32SysTickCount = 0; // Flags used to pass commands from interrupt context to the main loop. static volatile uint32_t g_ui32Flags; //MessageContainer createContainer(MessageType type, char* token, protobuf_c_boolean completed, void* response, size_t (*packPtr)(void*, uint8_t*), size_t (*sizePtr)(void*)); //***************************************************************************** // // Interrupt handler for the system tick counter. // //***************************************************************************** void SysTickHandler(void) { // Update our system time. g_ui32SysTickCount++; } void Init_EVB() { InitPinOutPullUps(); #ifdef Stub_Mode //MOTOR Driver L6470 SPI SPI2_Init(); init_BUSY_Pin(); //Danser_ENC: SSI1_Init(); // Read dancer ENC SSI #endif } int main(void) { // Enable interrupts to the processor. // ROM_IntMasterDisable(); //Set the clock 120MHz uint32_t ui32SysClock = MAP_SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ | SYSCTL_OSC_MAIN | SYSCTL_USE_PLL | SYSCTL_CFG_VCO_480), SYS_CLK_FREQ); // Set the system clock to run at 120MHz from the PLL. // Save the PLL rate used by this application. //SysCtlVCOGet(SYSCTL_XTAL_25MHZ, &ui32PLLRate); // Enable the system tick. ROM_SysTickPeriodSet(ui32SysClock / TICKS_PER_SECOND); ROM_SysTickIntEnable(); ROM_SysTickEnable(); PortFunctionInit(); #ifdef EVALUATION_BOARD Init_EVB(); #endif InitI2C(); //ROM_GPIOPinTypeGPIOOutput(GPIO_PORTN_BASE, GPIO_PIN_1); // Green LED ROM_GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_1, GPIO_PIN_1); //Turn ON FPGA_Init(); //ROM_GPIOPinTypeGPIOOutput(GPIO_PORTQ_BASE, GPIO_PIN_7); // set PQ7 to output (Green LED) //ROM_GPIOPinTypeGPIOOutput(GPIO_PORTQ_BASE, GPIO_PIN_4); // set PQ4 to output (Blue LED) //ROM_GPIOPinTypeGPIOOutput(GPIO_PORTN_BASE, GPIO_PIN_5); // set PN5 to output (RED LED) //ROM_GPIOPinTypeGPIOOutput(GPIO_PORTH_BASE, GPIO_PIN_2); // set PN5 to output (RED LED) //ROM_GPIOPinTypeGPIOOutput(GPIO_PORTH_BASE, GPIO_PIN_3); // set PN5 to output (RED LED) //DeActivateHeater(0); //DeActivateHeater(1); //ROM_IntDisable(INT_ADC0SS0); //FlashFS_Init(); // // Enable lazy stacking for interrupt handlers. This allows floating-point // instructions to be used within interrupt handlers, but at the expense of // extra stack usage. // MAP_FPULazyStackingEnable(); SysCtlUSBPLLEnable(); #ifdef WATCHDOG InitWatchdog(ui32SysClock); #endif CommunicationTaskInit(); utilsInit(ui32SysClock); // init_graphics(ui32SysClock); // clear(); //messageHostInit(); //InitUSBMSCHFatFs(); //---------------------------------------------------------- //Debug_Start_PT00(); // temporary ------------------------------ //----------------------------------------------------------- //EMAC_initEMAC(); ControlInit(); Heaters_Init(); JobInit(); PrintingsInit(); //LoadManual(); //Semaphore_post(sdCardSem); RegisterReceiveCallback(&receive_callback); //StartUSB(ui32SysClock); // Enable interrupts to the processor. // ROM_IntMasterEnable(); IDLE_TASK_package_init(); //ControlStart(); BIOS_start(); return (0); //while(1){}; }