#include #include #include #include #include #include #include #include #include #include #include "inc/hw_memmap.h" #include "inc/hw_types.h" #include "inc/hw_uart.h" #include "MessageContainer.pb-c.h" #include "Stub_Status.h" //#include "drivers/FPGA/FPGA.h" #include "drivers/SPI/SPI_Comm.h" #include "driverlib/ssi.h" /* unsigned long Run_Value = 136902 ; unsigned long Pos_Value; unsigned long Mov_Value ; bool Direction ; unsigned long Time_2_Change_Direction ; bool Display_Tx_ON_LCD; bool Display_Rx_on_LCD; unsigned long Init_MicroStep ; unsigned long Init_Acc; unsigned long Init_Dec; bool TestBool_1; bool TestBool_2; bool TestBool_3; bool TestBool_4; bool TestBool_5; unsigned long TestUint32_1; unsigned long TestUint32_2; unsigned long TestUint32_3; unsigned long TestUint32_4; unsigned long TestUint32_5; unsigned long TestUint32_6; */ extern unsigned long Run_Value ; extern unsigned long Mov_Value ; extern unsigned long Pos_Value; extern bool Direction ; extern unsigned long Time_2_Change_Direction ; extern bool Display_Tx_ON_LCD; extern bool Display_Rx_on_LCD; extern unsigned long Init_MicroStep ; extern unsigned long Init_Acc; extern unsigned long Init_Dec; extern bool TestBool_1; extern bool TestBool_2; extern bool TestBool_3; extern bool TestBool_4; extern bool TestBool_5; extern unsigned long TestUint32_1; extern unsigned long TestUint32_2; extern unsigned long TestUint32_3; extern unsigned long TestUint32_4; extern unsigned long TestUint32_5; extern unsigned long TestUint32_6; void Stub_L6470DriverRequest(MessageContainer* requestContainer) { uint32_t status = PASSED; MessageContainer responseContainer; StubL6470DriverRequest* request = stub_l6470_driver_request__unpack(NULL, requestContainer->data.len, requestContainer->data.data); Run_Value = request->run_value; Mov_Value = request->mov_value; Direction = request->direction; Time_2_Change_Direction = request->time_2_change_direction; Display_Tx_ON_LCD = request->display_tx_on_lcd; Display_Rx_on_LCD = request->display_rx_on_lcd; Init_MicroStep = request->init_microstep; Init_Acc = request->init_acc; Init_Dec = request->init_dec; TestBool_1 = request->testbool_1; TestBool_2 = request->testbool_2; TestBool_3 = request->testbool_3; TestBool_4 = request->testbool_4; TestBool_5 = request->testbool_5; TestUint32_1 = request->testuint32_1; TestUint32_2 = request->testuint32_2; TestUint32_3 = request->testuint32_3; TestUint32_4 = request->testuint32_4; TestUint32_5 = request->testuint32_5; TestUint32_6 = request->testuint32_6; //status = FPGA_ReadVersion((unsigned char)request->fpgaid, &Version, &Year, &Month, &Day); //SPI_Control(INIT); //temp_init_spi2(); StubL6470DriverResponse response = STUB_L6470_DRIVER_RESPONSE__INIT; status_response(status,&response.status, &response.statusword ,&response.has_statusword); //response.run_value = Get_Param(x_SPEED); /* response.mov_value = ; response.day = Day; response.has_day = true; response.month = Month; response.has_month = true; response.year = Year; response.has_year = true; response.ver_num = Version; response.has_ver_num = true; */ responseContainer = createContainer(MESSAGE_TYPE__StubL6470DriverResponse, requestContainer->token, true, &response, &stub_l6470_driver_response__pack, &stub_l6470_driver_response__get_packed_size); //free(request); //------------------------------------------------------------------------------------------- uint8_t* container_buffer = malloc(message_container__get_packed_size(&responseContainer)); size_t container_size = message_container__pack(&responseContainer, container_buffer); free(responseContainer.data.data); SendChars((char*)container_buffer, container_size); //free(container_buffer); //free(requestContainer); stub_l6470_driver_request__free_unpacked(request,NULL); //StartUSB(ui32SysClock); //todo to test the USB comm problem after using 6470 }