Пример #1
0
/**
* @brief  USR_MOUSE_ProcessData
*         Process Mouse data
* @param  data : Mouse data to be displayed
* @retval None
*/
void USR_MOUSE_ProcessData(HID_MOUSE_Data_TypeDef *data)
{
  
  uint8_t idx = 1;   
  static uint8_t b_state[3] = { 0, 0 , 0};
  
  if ((data->x != 0) && (data->y != 0))
  {
    HID_MOUSE_UpdatePosition(data->x , data->y);
  }
  
  for ( idx = 0 ; idx < 3 ; idx ++)
  {
    
    if(data->button & 1 << idx) 
    {
      if(b_state[idx] == 0)
      {
        HID_MOUSE_ButtonPressed (idx);
        b_state[idx] = 1;
      }
    }
    else
    {
      if(b_state[idx] == 1)
      {
        HID_MOUSE_ButtonReleased (idx);
        b_state[idx] = 0;
      }
    }
  }
  
  
}
Пример #2
0
/**
  * @brief  Processes Mouse data.
  * @param  data: Mouse data to be displayed
  * @retval None
  */
void USR_MOUSE_ProcessData(HID_MOUSE_Info_TypeDef *data)
{
  if((data->x != 0) && (data->y != 0))
  {
    HID_MOUSE_UpdatePosition(data->x , data->y);
  } 
} 
Пример #3
0
/**
  * @brief  Manages Mouse Menu Process.  
  * @param  None
  * @retval None
  */
void HID_MouseMenuProcess(void)
{
  if(hid_demo.mouse_state == HID_MOUSE_START)
  {
    LCD_LOG_ClearTextZone();
    BSP_LCD_ClearStringLine(19);
    USBH_HID_MouseInit(&hUSBHost);
    USR_MOUSE_Init();
    HID_MOUSE_UpdatePosition(0,0);
  }
}  
Пример #4
0
/**
  * @brief  Manages Mouse Menu Process.  
  * @param  None
  * @retval None
  */
void HID_MouseMenuProcess(void)
{
  switch(hid_demo.mouse_state)
  {
  case HID_MOUSE_IDLE:
    hid_demo.mouse_state = HID_MOUSE_START;
    HID_SelectItem(DEMO_MOUSE_menu, 0);
    hid_demo.select = 0;
    prev_select = 0;
    break;
    
  case HID_MOUSE_WAIT:
    if(hid_demo.select != prev_select)
    {
      prev_select = hid_demo.select ;
      HID_SelectItem(DEMO_MOUSE_menu, hid_demo.select & 0x7F);
      
      /* Handle select item */
      if(hid_demo.select & 0x80)
      {
        switch(hid_demo.select & 0x7F)
        {
        case 0: 
          hid_demo.mouse_state = HID_MOUSE_START;
          break;
          
        case 1: /* Return */
          LCD_LOG_ClearTextZone();
          hid_demo.state = HID_DEMO_REENUMERATE;
          hid_demo.select = 0;
          break;
          
        default:
          break;
        }
      }
    }
    break; 
    
  case HID_MOUSE_START:
    USBH_HID_MouseInit(&hUSBHost);
    USR_MOUSE_Init();   
    hid_demo.mouse_state = HID_MOUSE_WAIT;
    HID_MOUSE_UpdatePosition(0,0);
    break;    
    
  default:
    break;
  }
  hid_demo.select &= 0x7F;  
}  
Пример #5
0
/**
  * @brief  Manages Mouse Menu Process.  
  * @param  None
  * @retval None
  */
void HID_MouseMenuProcess(void)
{
  switch(demo.mouse_state)
  {
  case HID_MOUSE_IDLE:
    demo.mouse_state = HID_MOUSE_START;
    Demo_SelectItem(DEMO_MOUSE_menu, 0);
    demo.select = 0;
    break;
    
  case HID_MOUSE_WAIT:
    if(demo.select != prev_select)
    {
      prev_select = demo.select;
      Demo_SelectItem(DEMO_MOUSE_menu, demo.select & 0x7F);
      
      /* Handle select item */
      if(demo.select & 0x80)
      {
        demo.select &= 0x7F;
        switch(demo.select)
        {
        case 0: 
          demo.mouse_state = HID_MOUSE_START;
          break;
          
        case 1: /* Return */
          LCD_LOG_ClearTextZone();
          demo.state = DEMO_IDLE;
          LCD_UsrLogY("> HID application closed.\n");
          demo.select = 0;
          break;
          
        default:
          break;
        }
      }
    }
    break; 
    
  case HID_MOUSE_START:
    USR_MOUSE_Init();   
    demo.mouse_state = HID_MOUSE_WAIT;
    HID_MOUSE_UpdatePosition(0,0);
    break;    
    
  default:
    break;
  }
}  
Пример #6
0
/**
* @brief  USR_MOUSE_ProcessData
*         Process Mouse data
* @param  data : Mouse data to be displayed
* @retval None
*/
void USR_MOUSE_ProcessData(HID_MOUSE_Data_TypeDef *data)
{
  
  uint8_t idx = 1;   
  static uint8_t b_state[3] = { 0, 0 , 0};
  char temp[20];

  if(DEMO_HID_ShowData == 0)
  {  
  if ((data->x != 0) && (data->y != 0))
  {
    HID_MOUSE_UpdatePosition(data->x , data->y);
  }
  
  for ( idx = 0 ; idx < 3 ; idx ++)
  {
    
    if(data->button & 1 << idx) 
    {
      if(b_state[idx] == 0)
      {
        HID_MOUSE_ButtonPressed (idx);
        b_state[idx] = 1;
      }
    }
    else
    {
      if(b_state[idx] == 1)
      {
        HID_MOUSE_ButtonReleased (idx);
        b_state[idx] = 0;
      }
    }
  }
  }
  else
  {
    sprintf(temp ,"> %02xh %02xh %02xh %02xh\n" , HID_Machine.buff[0],  
                                         HID_Machine.buff[1],  
                                         HID_Machine.buff[2],  
                                         HID_Machine.buff[3]);
    LCD_DbgLog(temp);
    
  }
  
  
}
Пример #7
0
/**
  * @brief  Init Mouse window.    
  * @param  None
  * @retval None
  */
static void USR_MOUSE_Init(void)
{
  LCD_LOG_ClearTextZone();
  BSP_LCD_SetTextColor(LCD_COLOR_YELLOW);
  BSP_LCD_DisplayStringAtLine(4, (uint8_t *)"USB HID Host Mouse Demo...                     ");  
  BSP_LCD_SetTextColor(LCD_LOG_DEFAULT_COLOR);
  
  /* Display Mouse Window */
  BSP_LCD_DrawRect(MOUSE_WINDOW_X, MOUSE_WINDOW_Y, MOUSE_WINDOW_WIDTH, MOUSE_WINDOW_HEIGHT);
  
  HID_MOUSE_ButtonReleased(0);
  HID_MOUSE_ButtonReleased(1);
  HID_MOUSE_ButtonReleased(2);
  
  BSP_LCD_SetTextColor(LCD_COLOR_GREEN);
  BSP_LCD_SetBackColor(LCD_COLOR_BLACK);
  
  HID_MOUSE_UpdatePosition(0,0);
}
Пример #8
0
/**
* @brief  USR_MOUSE_ProcessData
*         Process Mouse data
* @param  data : Mouse data to be displayed
* @retval None
*/
void USR_MOUSE_ProcessData(HID_MOUSE_Data_TypeDef *data)
{
  
  uint8_t idx = 1;   
  static uint8_t b_state[3] = { 0, 0 , 0};
  
  data_X = data->x;
  data_Y = data->y;

  data_Button = data->button;  
  
  if ((data->x != 0) && (data->y != 0))
  {
    HID_MOUSE_UpdatePosition(data->x , data->y);
    STM_EVAL_LEDToggle(LED_Blue); // added by "STM32"
  }
  
  for ( idx = 0 ; idx < 3 ; idx ++)
  {
    
    if(data->button & 1 << idx) 
    {
      if(b_state[idx] == 0)
      {
        HID_MOUSE_ButtonPressed (idx);
        b_state[idx] = 1;
      }
    }
    else
    {
      if(b_state[idx] == 1)
      {
        HID_MOUSE_ButtonReleased (idx);
        b_state[idx] = 0;
      }
    }
  }
  
  
}