diff --git a/common/app/app.c b/common/app/app.c index 7b77c00..f2eba65 100644 --- a/common/app/app.c +++ b/common/app/app.c @@ -29,6 +29,10 @@ int pixy_frame_test(); //app event loop void app_process() { + + system_process(); //Let the system handle it's pending events + + //Note: The only way to detect that pixy has been disconnected is if a command fails. There's no pixy_is_connected method yet :'( if(!pixy_connected) { //Pixy not connected diff --git a/common/lowlevel/ll_system.h b/common/lowlevel/ll_system.h index b845260..941851c 100644 --- a/common/lowlevel/ll_system.h +++ b/common/lowlevel/ll_system.h @@ -3,4 +3,4 @@ bool ll_system_init(); void ll_system_delay(uint32_t msec); - +void ll_system_process(); diff --git a/common/system/system.c b/common/system/system.c index 6cb0887..af02005 100644 --- a/common/system/system.c +++ b/common/system/system.c @@ -6,10 +6,10 @@ bool system_init() { return ll_system_init(); } - - void system_delay(uint32_t msec) { ll_system_delay(msec); } - +void system_process() { + ll_system_process(); +} diff --git a/common/system/system.h b/common/system/system.h index 9513dd2..3f5b62f 100644 --- a/common/system/system.h +++ b/common/system/system.h @@ -3,3 +3,4 @@ bool system_init(); void system_delay(uint32_t msec); +void system_process(); diff --git a/discovery/src/ll_system.c b/discovery/src/ll_system.c index db5307e..7e79037 100644 --- a/discovery/src/ll_system.c +++ b/discovery/src/ll_system.c @@ -55,6 +55,12 @@ bool ll_system_init(void) return true; } +void ll_system_process() { + USBH_Process(&USB_OTG_Core, &USB_Host); +} + + + void ll_system_delay(uint32_t msec) { USB_OTG_BSP_mDelay(msec); } diff --git a/discovery/src/main.c b/discovery/src/main.c index 4b6880d..4429e45 100644 --- a/discovery/src/main.c +++ b/discovery/src/main.c @@ -1,23 +1,11 @@ #include "app.h" - - -#include "usb_hcd_int.h" -#include "usbh_usr.h" -#include "usbh_core.h" -#include "usbh_msc_core.h" - - -extern USB_OTG_CORE_HANDLE USB_OTG_Core; -extern USBH_HOST USB_Host; - int main(void) { app_init(); while (1) { - USBH_Process(&USB_OTG_Core, &USB_Host); app_process(); } diff --git a/discovery/src/usbh_msc_core.c b/discovery/src/usbh_msc_core.c index a985091..28d99e6 100644 --- a/discovery/src/usbh_msc_core.c +++ b/discovery/src/usbh_msc_core.c @@ -181,7 +181,6 @@ int USBH_LL_open() { } - //moved to common cnt_int=0; while(cnt_int #include -//#include "pixy.h" - USBH_Usr_cb_TypeDef USR_Callbacks = @@ -55,9 +53,9 @@ void USBH_USR_DeviceAttached(void) serial_ok=false; - STM_EVAL_LEDOff(LED5); - STM_EVAL_LEDOff(LED3); - STM_EVAL_LEDOn(LED4); + STM_EVAL_LEDOff(LED5); + STM_EVAL_LEDOff(LED3); + STM_EVAL_LEDOn(LED4); } /** @@ -144,7 +142,6 @@ void USBH_USR_Configuration_DescAvailable(USBH_CfgDesc_TypeDef * cfgDesc, void USBH_USR_Manufacturer_String(void *ManufacturerString) { manufacturer_ok = strcmp((char*)ManufacturerString,"Charmed Labs") == 0; - /* callback for Manufacturer String */ } /** @@ -155,7 +152,6 @@ void USBH_USR_Manufacturer_String(void *ManufacturerString) void USBH_USR_Product_String(void *ProductString) { product_ok = strcmp((char*)ProductString,"Pixy") == 0; - /* callback for Product String */ } /** @@ -166,7 +162,6 @@ void USBH_USR_Product_String(void *ProductString) void USBH_USR_SerialNum_String(void *SerialNumString) { serial_ok = strcmp((char*)SerialNumString,"DEMO 0.0") == 0; - /* callback for SerialNum_String */ } /** @@ -220,26 +215,8 @@ void USBH_USR_OverCurrentDetected (void) * @param None * @retval Staus */ - -/*int colorind; -const uint32_t colors [] = {0xFF0000, 0x00FF00,0x0000FF,0xFFFF00,0x00FFFF,0xFF00FF,0xFFFFFF,0x000000}; -const int num_colors = sizeof(colors)/sizeof(uint32_t); -*/ - int USBH_USR_MSC_Application(void) { - -/* if(colorind==0) { - pixy_led_set_max_current(5); - } - - int32_t response; - int return_value; - return_value = pixy_command("led_set", INT32(colors[colorind++]), END_OUT_ARGS, &response, END_IN_ARGS); - colorind%=num_colors; - USB_OTG_BSP_mDelay(500); -*/ - return 0; } @@ -254,10 +231,3 @@ void USBH_USR_DeInit(void) } -/** - * @} - */ - - - -/******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ diff --git a/doc/docu.odt b/doc/docu.odt index bde0c51..d1598e4 100644 Binary files a/doc/docu.odt and b/doc/docu.odt differ diff --git a/emulator/qt/ll_system.cpp b/emulator/qt/ll_system.cpp index 861131b..ed684c1 100644 --- a/emulator/qt/ll_system.cpp +++ b/emulator/qt/ll_system.cpp @@ -1,4 +1,6 @@ #include +#include + extern "C" { #include "ll_system.h" } @@ -11,3 +13,7 @@ void ll_system_delay(uint32_t msec) { QThread::msleep(msec); } +void ll_system_process() { + QApplication::processEvents(); +} + diff --git a/emulator/qt/main.cpp b/emulator/qt/main.cpp index b3b8f97..dc67c83 100644 --- a/emulator/qt/main.cpp +++ b/emulator/qt/main.cpp @@ -10,7 +10,6 @@ extern "C" { void app_loop() { while(!QApplication::closingDown()) { app_process(); - QApplication::processEvents(); } }