• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ LCD_ErrLog函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中LCD_ErrLog函数的典型用法代码示例。如果您正苦于以下问题:C++ LCD_ErrLog函数的具体用法?C++ LCD_ErrLog怎么用?C++ LCD_ErrLog使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了LCD_ErrLog函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: USBH_HID_USR_OverCurrentDetected

/**
* @brief  USBH_HID_USR_OverCurrentDetected
*         Device Overcurrent detection event
* @param  None
* @retval None
*/
void USBH_HID_USR_OverCurrentDetected (void)
{
  LCD_ErrLog (">Port1:Overcurrent detected.\n");
  
}
开发者ID:Ghanyy,项目名称:PTM-STM32F4,代码行数:11,代码来源:usbh_hid_usr.c


示例2: USBH_MSC_InterfaceInit

/**
  * @brief  USBH_MSC_InterfaceInit 
  *         Interface initialization for MSC class.
  * @param  pdev: Selected device
  * @param  hdev: Selected device property
  * @retval USBH_Status : Status of class request handled.
  */
static USBH_Status USBH_MSC_InterfaceInit ( USB_OTG_CORE_HANDLE *pdev, 
                                        void *phost)
{	 
  USBH_HOST *pphost = phost;
  
  if((pphost->device_prop.Itf_Desc[0].bInterfaceClass == MSC_CLASS) && \
     (pphost->device_prop.Itf_Desc[0].bInterfaceProtocol == MSC_PROTOCOL))
  {
    if(pphost->device_prop.Ep_Desc[0][0].bEndpointAddress & 0x80)
    {
      MSC_Machine.MSBulkInEp = (pphost->device_prop.Ep_Desc[0][0].bEndpointAddress);
      MSC_Machine.MSBulkInEpSize  = pphost->device_prop.Ep_Desc[0][0].wMaxPacketSize;
    }
    else
    {
      MSC_Machine.MSBulkOutEp = (pphost->device_prop.Ep_Desc[0][0].bEndpointAddress);
      MSC_Machine.MSBulkOutEpSize  = pphost->device_prop.Ep_Desc[0] [0].wMaxPacketSize;      
    }
    
    if(pphost->device_prop.Ep_Desc[0][1].bEndpointAddress & 0x80)
    {
      MSC_Machine.MSBulkInEp = (pphost->device_prop.Ep_Desc[0][1].bEndpointAddress);
      MSC_Machine.MSBulkInEpSize  = pphost->device_prop.Ep_Desc[0][1].wMaxPacketSize;      
    }
    else
    {
      MSC_Machine.MSBulkOutEp = (pphost->device_prop.Ep_Desc[0][1].bEndpointAddress);
      MSC_Machine.MSBulkOutEpSize  = pphost->device_prop.Ep_Desc[0][1].wMaxPacketSize;      
    }
    
    MSC_Machine.hc_num_out = USBH_Alloc_Channel(pdev, 
                                                MSC_Machine.MSBulkOutEp);
    MSC_Machine.hc_num_in = USBH_Alloc_Channel(pdev,
                                                MSC_Machine.MSBulkInEp);  
    
    /* Open the new channels */
    USBH_Open_Channel  (pdev,
                        MSC_Machine.hc_num_out,
                        pphost->device_prop.address,
                        pphost->device_prop.speed,
                        EP_TYPE_BULK,
                        MSC_Machine.MSBulkOutEpSize);  
    
    USBH_Open_Channel  (pdev,
                        MSC_Machine.hc_num_in,
                        pphost->device_prop.address,
                        pphost->device_prop.speed,
                        EP_TYPE_BULK,
                        MSC_Machine.MSBulkInEpSize);    
    
  }
  
  else
  {
    if (pphost->device_prop.Itf_Desc[0].bInterfaceClass == USB_HUB)
    {
      LCD_ErrLog("Hub is not supported.\n");
    }
    
    else if (pphost->device_prop.Itf_Desc[0].bInterfaceClass == USB_CDCC)
    {
      LCD_ErrLog("Communications and CDC Control device is not supported.\n");
    }
    
    else if (pphost->device_prop.Itf_Desc[0].bInterfaceClass == USB_HID)
    {
      LCD_ErrLog("HID device is not supported.\n");
    }
    
    else if (pphost->device_prop.Itf_Desc[0].bInterfaceClass == USB_PRINTER)
    {
      LCD_ErrLog("Printer device is not supported.\n");
    }
    
    else if (pphost->device_prop.Itf_Desc[0].bInterfaceClass == USB_SMARTCARD)
    {
      LCD_ErrLog("Smart Card device is not supported.\n");
    }
    
    
    else if (pphost->device_prop.Itf_Desc[0].bInterfaceClass == USB_VIDEO)
    {
      LCD_ErrLog("Video device  is not supported.\n");
    }
    
    
    else if (pphost->device_prop.Itf_Desc[0].bInterfaceClass == USB_AVD)
    {
      LCD_ErrLog("Audio/Video Devices is not supported.\n");
    }
    
    else
    {
//.........这里部分代码省略.........
开发者ID:mpthompson,项目名称:stm32_f4_firmware,代码行数:101,代码来源:usbh_msc_core.c


示例3: USBH_HID_USR_DeviceDisconnected

/**
* @brief  USBH_DisconnectEvent
*         Device disconnect event
* @param  None
* @retval None
*/
void USBH_HID_USR_DeviceDisconnected (void)
{
  LCD_ErrLog((void *)MSG_HID_DEV_DISCONNECTED);
  USBFS_EnumDone= 0;
}
开发者ID:Ghanyy,项目名称:PTM-STM32F4,代码行数:11,代码来源:usbh_hid_usr.c


示例4: AUDIO_MenuProcess

/**
  * @brief  Manages AUDIO Menu Process.
  * @param  None
  * @retval None
  */
void AUDIO_MenuProcess(void)
{
  AUDIO_ErrorTypeDef  status;
  TS_StateTypeDef  TS_State;
  Point PlaybackLogoPoints[] = {{TOUCH_PLAYBACK_XMIN, TOUCH_PLAYBACK_YMIN},
                                {TOUCH_PLAYBACK_XMAX, (TOUCH_PLAYBACK_YMIN+TOUCH_PLAYBACK_YMAX)/2},
                                {TOUCH_PLAYBACK_XMIN, TOUCH_PLAYBACK_YMAX}};
  
  if(appli_state == APPLICATION_READY)
  { 
    switch(AudioDemo.state)
    {
    case AUDIO_DEMO_IDLE:
      if(AUDIO_ShowWavFiles() > 0)
      {
        LCD_ErrLog("There is no WAV file on the USB Key.\n");         
        AUDIO_ChangeSelectMode(AUDIO_SELECT_MENU); 
        AudioDemo.state = AUDIO_DEMO_IDLE;
      }
      else
      {
        AudioDemo.state = AUDIO_DEMO_WAIT;
      }
      
      BSP_LCD_SetFont(&LCD_LOG_HEADER_FONT);
      BSP_LCD_ClearStringLine(13);     /* Clear touch screen buttons dedicated zone */
      BSP_LCD_ClearStringLine(14);
      BSP_LCD_ClearStringLine(15);
      BSP_LCD_SetTextColor(LCD_COLOR_CYAN);
      BSP_LCD_FillPolygon(PlaybackLogoPoints, 3);                 /* Playback sign */
      BSP_LCD_FillCircle((TOUCH_RECORD_XMAX+TOUCH_RECORD_XMIN)/2, /* Record circle */
                         (TOUCH_RECORD_YMAX+TOUCH_RECORD_YMIN)/2,
                         (TOUCH_RECORD_XMAX-TOUCH_RECORD_XMIN)/2);
      BSP_LCD_SetTextColor(LCD_COLOR_GREEN);
      BSP_LCD_SetFont(&LCD_LOG_TEXT_FONT);
      BSP_LCD_DisplayStringAtLine(15, (uint8_t *)"Use touch screen to enter playback or record menu");
      break;    
      
    case AUDIO_DEMO_WAIT:

      BSP_TS_GetState(&TS_State);
      if(TS_State.touchDetected == 1)
      {
        if ((TS_State.touchX[0] > TOUCH_RECORD_XMIN) && (TS_State.touchX[0] < TOUCH_RECORD_XMAX) &&
            (TS_State.touchY[0] > TOUCH_RECORD_YMIN) && (TS_State.touchY[0] < TOUCH_RECORD_YMAX))
        {
          AudioDemo.state = AUDIO_DEMO_IN;
        }
        else if ((TS_State.touchX[0] > TOUCH_PLAYBACK_XMIN) && (TS_State.touchX[0] < TOUCH_PLAYBACK_XMAX) &&
                 (TS_State.touchY[0] > TOUCH_PLAYBACK_YMIN) && (TS_State.touchY[0] < TOUCH_PLAYBACK_YMAX))
        {
          AudioDemo.state = AUDIO_DEMO_PLAYBACK;
        }
        else
        {
          AudioDemo.state = AUDIO_DEMO_EXPLORE;
        }

        /* Wait for touch released */
        do
        {
          BSP_TS_GetState(&TS_State);
        }while(TS_State.touchDetected > 0);
      }
      break;
      
    case AUDIO_DEMO_EXPLORE: 
      if(appli_state == APPLICATION_READY)
      {
        if(AUDIO_ShowWavFiles() > 0)
        {
          LCD_ErrLog("There is no WAV file on the USB Key.\n");         
          AUDIO_ChangeSelectMode(AUDIO_SELECT_MENU); 
          AudioDemo.state = AUDIO_DEMO_IDLE;
        }
        else
        {
          AudioDemo.state = AUDIO_DEMO_WAIT;
        }
      }
      else
      {
        AudioDemo.state = AUDIO_DEMO_WAIT;
      }
      break;
      
    case AUDIO_DEMO_PLAYBACK:
      if(appli_state == APPLICATION_READY)
      {
        if(AudioState == AUDIO_STATE_IDLE)
        {
          /* Start Playing */
          AudioState = AUDIO_STATE_INIT;

          /* Clear the LCD */
//.........这里部分代码省略.........
开发者ID:acrepina,项目名称:STM32F7_serverWEB,代码行数:101,代码来源:menu.c


示例5: DUAL_MenuProcess

/**
  * @brief  Manages DUAL Menu Process.
  * @param  None
  * @retval None
  */
void DUAL_MenuProcess(void)
{
  switch(demo.state)
  {
  case DEMO_IDLE:
    Demo_SelectItem(DEMO_main_menu, 0); 
    LCD_UsrLog("Select an operation to continue.\n");
    demo.state = DEMO_WAIT;
    demo.select = 0;
    break;    
  case DEMO_WAIT:
    
    if(demo.select != prev_select)
    {
      prev_select = demo.select;
      Demo_SelectItem(DEMO_main_menu, demo.select & 0x7F);
      
      /* Handle select item */
      if(demo.select & 0x80)
      {
        demo.select &= 0x7F;
        
        switch(demo.select)
        {
        case 0:
          demo.state = DEMO_MSC_START;  
          break;
          
        case 1:
          demo.state = DEMO_HID_START;  
          break;
          
        case 2:
          demo.state = DEMO_MSC_REENUMERATE;
          break;
          
        case 3:
          demo.state = DEMO_HID_REENUMERATE;
          break;
          
        default:
          break;
        }
      }
    }
    break;
    
  case DEMO_MSC_START:
    if(Appli_HS_state == APPLICATION_HS_READY) 
    {
      /* If HS device connected*/
      demo.state = DEMO_MSC; 
      demo.msc_state = APPLI_MSC_IDLE;
    }
    else
    {
      LCD_ErrLog("No Mass storage device connected.\n");
      demo.state = DEMO_WAIT; 
    }
    break;
    
  case DEMO_HID_START:
    if(Appli_FS_state == APPLICATION_FS_READY)
    {
      /*if FS device connected*/
      demo.state = DEMO_HID; 
      demo.hid_state = APPLI_HID_IDLE;
    }
    else
    {
      LCD_ErrLog("No HID device connected.\n");
      demo.state = DEMO_WAIT; 
    }
    break;
    
  case DEMO_MSC: 
    MSC_MenuProcess();
    break;
    
  case DEMO_HID:
    HID_MenuProcess();
    break;
    
  case DEMO_MSC_REENUMERATE: /* Re-Enumeration MSC */
    LCD_DbgLog("Starting Enumeration MSC...."); 
    LCD_DbgLog("\n");
    USBH_ReEnumerate(&hUSBHost_HS); 
    demo.state = DEMO_WAIT;
    break;
    
  case DEMO_HID_REENUMERATE: /* Re-Enumeration HID */
    LCD_DbgLog("Starting Enumeration HID...."); 
    LCD_DbgLog("\n");
    USBH_ReEnumerate(&hUSBHost_FS); 
    demo.state = DEMO_WAIT;
//.........这里部分代码省略.........
开发者ID:EarnestHein89,项目名称:STM32Cube_FW_F4,代码行数:101,代码来源:dual_menu.c


示例6: AUDIO_MenuProcess

/**
  * @brief  Manages AUDIO Menu Process.
  * @param  None
  * @retval None
  */
void AUDIO_MenuProcess(void)
{
  uint32_t ITstatus = 0;
  AUDIO_ErrorTypeDef  status;
  
  if(appli_state == APPLICATION_READY)
  { 
    switch(AudioDemo.state)
    {
    case AUDIO_DEMO_IDLE:
      AUDIO_SelectItem(AUDIO_main_menu, 0); 
      if((AUDIO_ShowWavFiles() > 0) && (state == 0))
      {
        LCD_ErrLog("There is no WAV file on the USB Key.\n");         
        AUDIO_ChangeSelectMode(AUDIO_SELECT_MENU); 
        AudioDemo.state = AUDIO_DEMO_IDLE;
        state = 1;
      }
      else
      {
        AudioDemo.state = AUDIO_DEMO_WAIT;
      }
      
      AudioDemo.select = 0;
      BSP_LCD_SetTextColor(LCD_COLOR_GREEN);
      BSP_LCD_DisplayStringAtLine(15, (uint8_t *)"Use [Joystick Left/Right] to scroll up/down");
      BSP_LCD_DisplayStringAtLine(16, (uint8_t *)"Use [Joystick Up/Down] to scroll Audio Playback and Record menu");
      break;    
      
    case AUDIO_DEMO_WAIT:
      if(AudioDemo.select != PrevSelect)
      {
        PrevSelect = AudioDemo.select;
        AUDIO_SelectItem(AUDIO_main_menu, AudioDemo.select & 0x7F);
        
        /* Handle select item */
        if(AudioDemo.select & 0x80)
        {
          
          switch(AudioDemo.select & 0x7F)
          {
          case 0:
            AudioDemo.state = AUDIO_DEMO_EXPLORE;  
            break;
            
          case 1:         
            /* Display HMI messages */
            BSP_LCD_SetTextColor(LCD_COLOR_GREEN);          
            BSP_LCD_DisplayStringAtLine(14 ,(uint8_t *)"                                                               ");
            BSP_LCD_DisplayStringAtLine(15 ,(uint8_t *)"                                                               ");
            BSP_LCD_DisplayStringAtLine(16 ,(uint8_t *)"Use [User Key] To Stop and return from player/recorder         ");
            BSP_LCD_SetTextColor(LCD_COLOR_WHITE); 
            
            /* Set PLAYBACK state and start playing 1st file */ 
            AudioState = AUDIO_STATE_IDLE;
            AudioDemo.state = AUDIO_DEMO_PLAYBACK;
            AUDIO_ChangeSelectMode(AUDIO_PLAYBACK_CONTROL);           
            break;
            
          case 2:
            /* Display HMI messages */
            BSP_LCD_SetTextColor(LCD_COLOR_GREEN);          
            BSP_LCD_DisplayStringAtLine(14 ,(uint8_t *)"                                                               ");
            BSP_LCD_DisplayStringAtLine(15 ,(uint8_t *)"                                                               ");
            BSP_LCD_DisplayStringAtLine(16 ,(uint8_t *)"Use [User Key] To Stop and return from player/recorder         ");
            BSP_LCD_SetTextColor(LCD_COLOR_WHITE); 
            
            /* Set PLAYBACK state and start playing 1st file */ 
            AudioState = AUDIO_STATE_IDLE;
            AudioDemo.state = AUDIO_DEMO_IN;  
            AUDIO_ChangeSelectMode(AUDIO_PLAYBACK_CONTROL); 
            break;
            
          default:
            break;
          }
        }
      }
      break;
      
    case AUDIO_DEMO_EXPLORE: 
      if(appli_state == APPLICATION_READY)
      {
        if(AUDIO_ShowWavFiles() > 0)
        {
          LCD_ErrLog("There is no WAV file on the USB Key.\n");         
          AUDIO_ChangeSelectMode(AUDIO_SELECT_MENU); 
          AudioDemo.state = AUDIO_DEMO_IDLE;
        }
        else
        {
          AudioDemo.state = AUDIO_DEMO_WAIT;
        }
      }
      else
//.........这里部分代码省略.........
开发者ID:451506709,项目名称:automated_machine,代码行数:101,代码来源:menu.c


示例7: RTC_Config


//.........这里部分代码省略.........

  /* Wait till LSE is ready */  
  while(RCC_GetFlagStatus(RCC_FLAG_LSERDY) == RESET)
  {
  }

  /* Select the RTC Clock Source */
  RCC_RTCCLKConfig(RCC_RTCCLKSource_LSE);
 /* ck_spre(1Hz) = RTCCLK(LSE) /(uwAsynchPrediv + 1)*(uwSynchPrediv + 1)*/
  uwSynchPrediv = 0xFF;
  uwAsynchPrediv = 0x7F;

#else
  #error Please select the RTC Clock source inside the main.c file
#endif /* RTC_CLOCK_SOURCE_LSI */
  
  /* Enable the RTC Clock */
  RCC_RTCCLKCmd(ENABLE);

  /* Wait for RTC APB registers synchronisation */
  RTC_WaitForSynchro();

  /* Write to the first RTC Backup Data Register */
  RTC_WriteBackupRegister(RTC_BKP_DR0, FIRST_DATA);

  /* Display the new RCC BDCR and RTC TAFCR Registers */
  LCD_UsrLog ("RTC Reconfig \n");
  LCD_UsrLog ("RCC BDCR = 0x%x\n", RCC->BDCR);
  LCD_UsrLog ("RTC TAFCR = 0x%x\n", RTC->TAFCR); 

  /* Set the Time */
  RTC_TimeStructure.RTC_Hours   = 0x08;
  RTC_TimeStructure.RTC_Minutes = 0x00;
  RTC_TimeStructure.RTC_Seconds = 0x00;

  /* Set the Date */
  RTC_DateStructure.RTC_Month = RTC_Month_January;
  RTC_DateStructure.RTC_Date = 0x11;  
  RTC_DateStructure.RTC_Year = 0x13; 
  RTC_DateStructure.RTC_WeekDay = RTC_Weekday_Friday; 

  /* Calendar Configuration */
  RTC_InitStructure.RTC_AsynchPrediv = uwAsynchPrediv;
  RTC_InitStructure.RTC_SynchPrediv =  uwSynchPrediv;
  RTC_InitStructure.RTC_HourFormat = RTC_HourFormat_24;
  RTC_Init(&RTC_InitStructure);
  
  /* Set Current Time and Date */
  RTC_SetTime(RTC_Format_BCD, &RTC_TimeStructure);  
  RTC_SetDate(RTC_Format_BCD, &RTC_DateStructure); 

  /* Configure the RTC Wakeup Clock source and Counter (Wakeup event each 1 second) */
  RTC_WakeUpClockConfig(RTC_WakeUpClock_RTCCLK_Div16);
  RTC_SetWakeUpCounter(0x7FF);
  
  /* Enable the Wakeup Interrupt */
  RTC_ITConfig(RTC_IT_WUT, ENABLE);

  /* Enable Wakeup Counter */
  RTC_WakeUpCmd(ENABLE); 

/*  Backup SRAM ***************************************************************/
  /* Enable BKPRAM Clock */
  RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_BKPSRAM, ENABLE);

  /* Write to Backup SRAM with 32-Bit Data */
  for (uwIndex = 0x0; uwIndex < 0x1000; uwIndex += 4)
  {
    *(__IO uint32_t *) (BKPSRAM_BASE + uwIndex) = uwIndex;
  }
  /* Check the written Data */
  for (uwIndex = 0x0; uwIndex < 0x1000; uwIndex += 4)
  {
    if ((*(__IO uint32_t *) (BKPSRAM_BASE + uwIndex)) != uwIndex)
    {
      uwErrorIndex++;
    }
  }

  if(uwErrorIndex)
  {
    LCD_ErrLog ("BKP SRAM Number of errors = %d\n", uwErrorIndex);
  }
  else
  {
    LCD_UsrLog ("BKP SRAM write OK \n");
  }

  /* Enable the Backup SRAM low power Regulator to retain it's content in VBAT mode */
  PWR_BackupRegulatorCmd(ENABLE);

  /* Wait until the Backup SRAM low power Regulator is ready */
  while(PWR_GetFlagStatus(PWR_FLAG_BRR) == RESET)
  {
  }

/* RTC Backup Data Registers **************************************************/
  /* Write to RTC Backup Data Registers */
  WriteToBackupReg(FIRST_DATA);
}
开发者ID:Exchizz,项目名称:Bachelor,代码行数:101,代码来源:main.c


示例8: USBH_USR_DeviceNotSupported

/**
* @brief  USBH_USR_DeviceNotSupported
*         Device is not supported
* @param  None
* @retval None
*/
void USBH_USR_DeviceNotSupported(void)
{
  LCD_ErrLog ("> Device not supported."); 
}  
开发者ID:iGaryGu,项目名称:Painter,代码行数:10,代码来源:usbh_usr.c


示例9: USBH_USR_MSC_Application

/**
* @brief  USBH_USR_MSC_Application 
*         Demo application for mass storage
* @param  None
* @retval Staus
*/
int USBH_USR_MSC_Application(void)
{
  FRESULT res;
  uint8_t writeTextBuff[] = "BIG_MANTA FS/HS STM32 Connectivity line Host Demo application using FAT_FS   ";
  uint16_t bytesWritten, bytesToWrite;
  
  /* Set LCD Layer size and pixel format */
  LTDC_LayerPixelFormat(LTDC_Layer2, LTDC_Pixelformat_RGB565); 
  LTDC_LayerSize(LTDC_Layer2, 240, 320);
  /* LTDC reload configuration */  
  LTDC_ReloadConfig(LTDC_IMReload);
  
  switch(USBH_USR_ApplicationState)
  {
  case USH_USR_FS_INIT: 
    
    /* Initialises the File System*/
    if ( f_mount( 0, &fatfs ) != FR_OK ) 
    {
      /* efs initialisation fails*/
      LCD_ErrLog("> Cannot initialize File System.\n");
      return(-1);
    }
    LCD_UsrLog("> File System initialized.\n");
    LCD_UsrLog("> Disk capacity : %d Bytes\n", USBH_MSC_Param.MSCapacity * \
      USBH_MSC_Param.MSPageLength); 
    
    if(USBH_MSC_Param.MSWriteProtect == DISK_WRITE_PROTECTED)
    {
      LCD_ErrLog((void *)MSG_WR_PROTECT);
    }
    
    USBH_USR_ApplicationState = USH_USR_FS_READLIST;
    break;
    
  case USH_USR_FS_READLIST:
    
    LCD_UsrLog((void *)MSG_ROOT_CONT);
    Explore_Disk("0:/", 1);
    line_idx = 0;   
    USBH_USR_ApplicationState = USH_USR_FS_WRITEFILE;
    
    break;
    
  case USH_USR_FS_WRITEFILE:
    
    /*Key B3 in polling*/
    while((HCD_IsDeviceConnected(&USB_OTG_Core)) && \
      (STM_EVAL_PBGetState (BUTTON_USER) != RESET))          
    {
      Toggle_Leds();
    }
    /* Writes a text file, STM32.TXT in the disk*/
    LCD_UsrLog("> Writing File to disk flash ...\n");
    if(USBH_MSC_Param.MSWriteProtect == DISK_WRITE_PROTECTED)
    {
      
      LCD_ErrLog ( "> Disk flash is write protected \n");
      USBH_USR_ApplicationState = USH_USR_FS_DRAW;
      break;
    }
    
    /* Register work area for logical drives */
    f_mount(0, &fatfs);
    
    if(f_open(&file, "0:STM32.TXT",FA_CREATE_ALWAYS | FA_WRITE) == FR_OK)
    { 
      /* Write buffer to file */
      bytesToWrite = sizeof(writeTextBuff); 
      res= f_write (&file, writeTextBuff, bytesToWrite, (void *)&bytesWritten);   
      
      if((bytesWritten == 0) || (res != FR_OK)) /*EOF or Error*/
      {
        LCD_ErrLog("> STM32.TXT CANNOT be writen.\n");
      }
      else
      {
        LCD_UsrLog("> 'STM32.TXT' file created\n");
      }
      
      /*close file and filesystem*/
      f_close(&file);
      f_mount(0, NULL); 
    }
    
    else
    {
      LCD_UsrLog ("> STM32.TXT created in the disk\n");
    }

    USBH_USR_ApplicationState = USH_USR_FS_DRAW; 
    
    LCD_SetTextColor(Green);
    LCD_DisplayStringLine(LCD_LINE_15,"To start Image slide show           ");
//.........这里部分代码省略.........
开发者ID:iGaryGu,项目名称:Painter,代码行数:101,代码来源:usbh_usr.c


示例10: IAP_tftp_recv_callback

/**
  * @brief  Processes traffic received on UDP port 69
  * @param  args: pointer on tftp_connection arguments
  * @param  upcb: pointer on udp_pcb structure
  * @param  pbuf: pointer on packet buffer
  * @param  addr: pointer on the receive IP address
  * @param  port: receive port number
  * @retval None
  */
static void IAP_tftp_recv_callback(void *arg, struct udp_pcb *upcb, struct pbuf *pkt_buf,
                        struct ip_addr *addr, u16_t port)
{
  tftp_opcode op;
  struct udp_pcb *upcb_tftp_data;
  err_t err;

#ifdef USE_LCD
  uint32_t i;
  char filename[40],message[40], *ptr;
#endif

  /* create new UDP PCB structure */
  upcb_tftp_data = udp_new();
  if (!upcb_tftp_data)
  {
    /* Error creating PCB. Out of Memory  */
#ifdef USE_LCD
    LCD_ErrLog("Can not create pcb \n");
#endif
    return;
  }

  /* bind to port 0 to receive next available free port */
  /* NOTE:  This is how TFTP works.  There is a UDP PCB for the standard port
  * 69 which al transactions begin communication on, however, _all_ subsequent
  * transactions for a given "stream" occur on another port  */
  err = udp_bind(upcb_tftp_data, IP_ADDR_ANY, 0);
  if (err != ERR_OK)
  {
    /* Unable to bind to port */
#ifdef USE_LCD
    LCD_ErrLog("Can not create pcb \n");
#endif
    return;
  }

  op = IAP_tftp_decode_op(pkt_buf->payload);
  if (op != TFTP_WRQ)
  {
    /* remove PCB */
#ifdef USE_LCD
    LCD_ErrLog("Bad TFTP opcode \n");
#endif
    udp_remove(upcb_tftp_data);
  }
  else
  {
    
#ifdef USE_LCD
    ptr = pkt_buf->payload;
    ptr = ptr +2;
    /*extract file name info */
    i= 0;
    while (*(ptr+i)!=0x0)
    {
      i++;
    }
    strncpy(filename, ptr, i+1);

    LCD_UsrLog("IAP using TFTP \n");
    sprintf(message, "File: %s",filename);
    LCD_UsrLog("%s\n", message);
    LCD_UsrLog("  State: Erasing...\n");
#endif
     
    /* Start the TFTP write mode*/
    IAP_tftp_process_write(upcb_tftp_data, addr, port);
  }
  pbuf_free(pkt_buf);
}
开发者ID:acrepina,项目名称:STM32F7_serverWEB,代码行数:80,代码来源:tftpserver.c


示例11: USBH_USR_UnrecoveredError

/**
* @brief  USBH_USR_UnrecoveredError
* @param  None
* @retval None
*/
void USBH_USR_UnrecoveredError (void)
{
  
  /* Set default screen color*/ 
  LCD_ErrLog((void *)MSG_UNREC_ERROR); 
}
开发者ID:iGaryGu,项目名称:Painter,代码行数:11,代码来源:usbh_usr.c


示例12: IAP_wrq_recv_callback

/**
  * @brief  Processes data transfers after a TFTP write request
  * @param  _args: used as pointer on TFTP connection args
  * @param  upcb: pointer on udp_pcb structure
  * @param  pkt_buf: pointer on a pbuf stucture
  * @param  ip_addr: pointer on the receive IP_address structure
  * @param  port: receive port address
  * @retval None
  */
static void IAP_wrq_recv_callback(void *_args, struct udp_pcb *upcb, struct pbuf *pkt_buf, struct ip_addr *addr, u16_t port)
{
  tftp_connection_args *args = (tftp_connection_args *)_args;
  uint32_t data_buffer[128];
  uint16_t count=0;

#ifdef USE_LCD
  char message[40];
#endif

  if (pkt_buf->len != pkt_buf->tot_len)
  {
#ifdef USE_LCD
    LCD_ErrLog("Invalid data length\n");
#endif
    return;
  }

  /* Does this packet have any valid data to write? */
  if ((pkt_buf->len > TFTP_DATA_PKT_HDR_LEN) &&
      (IAP_tftp_extract_block(pkt_buf->payload) == (args->block + 1)))
  {
    /* copy packet payload to data_buffer */
    pbuf_copy_partial(pkt_buf, data_buffer, pkt_buf->len - TFTP_DATA_PKT_HDR_LEN,
                      TFTP_DATA_PKT_HDR_LEN);
    
    total_count += pkt_buf->len - TFTP_DATA_PKT_HDR_LEN; 
    
    count = (pkt_buf->len - TFTP_DATA_PKT_HDR_LEN)/4;
    if (((pkt_buf->len - TFTP_DATA_PKT_HDR_LEN)%4)!=0) 
    count++;
     
    /* Write received data in Flash */
    FLASH_If_Write(&Flash_Write_Address, data_buffer ,count);
       
    /* update our block number to match the block number just received */
    args->block++;
    /* update total bytes  */
    (args->tot_bytes) += (pkt_buf->len - TFTP_DATA_PKT_HDR_LEN);

    /* This is a valid pkt but it has no data.  This would occur if the file being
       written is an exact multiple of 512 bytes.  In this case, the args->block
       value must still be updated, but we can skip everything else.    */
  }
  else if (IAP_tftp_extract_block(pkt_buf->payload) == (args->block + 1))
  {
    /* update our block number to match the block number just received  */
    args->block++;
  }
  
  /* Send the appropriate ACK pkt*/
  IAP_tftp_send_ack_packet(upcb, addr, port, args->block);   

  /* If the last write returned less than the maximum TFTP data pkt length,
   * then we've received the whole file and so we can quit (this is how TFTP
   * signals the EndTransferof a transfer!)
   */
  if (pkt_buf->len < TFTP_DATA_PKT_LEN_MAX)
  {
    IAP_tftp_cleanup_wr(upcb, args);
    pbuf_free(pkt_buf);
    
#ifdef USE_LCD
    sprintf(message, "%d bytes ",(int)total_count);
    LCD_UsrLog("Tot bytes Received:, %s\n", message);
    LCD_UsrLog("  State: Prog Finished \n");
    LCD_UsrLog("Reset the board \n");
#endif
  }
  else
  {
    pbuf_free(pkt_buf);
    return;
  }
}
开发者ID:acrepina,项目名称:STM32F7_serverWEB,代码行数:84,代码来源:tftpserver.c


示例13: HID_MenuProcess

/**
  * @brief  Manages HID Menu Process.
  * @param  None
  * @retval None
  */
void HID_MenuProcess(void)
{
  switch(hid_demo.state)
  {
  case HID_DEMO_IDLE:
    BSP_LCD_SetTextColor(LCD_COLOR_GREEN);
    BSP_LCD_DisplayStringAtLine(17, (uint8_t *)"Use [Buttons Left/Right] to scroll up/down       ");
    BSP_LCD_DisplayStringAtLine(18, (uint8_t *)"Use [Joystick Up/Down] to scroll HID menu        ");
    BSP_LCD_DisplayStringAtLine(19, (uint8_t *)"                                                                                                          ");
    BSP_LCD_SetTextColor(LCD_COLOR_WHITE);
    HID_SelectItem(DEMO_HID_menu, 0); 
    hid_demo.state = HID_DEMO_WAIT;
    hid_demo.select = 0;
    break;        
    
  case HID_DEMO_WAIT:
    if(hid_demo.select != prev_select)
    {
      prev_select = hid_demo.select;        
      
      HID_SelectItem(DEMO_HID_menu, hid_demo.select & 0x7F); 
      /* Handle select item */
      if(hid_demo.select & 0x80)
      {
        hid_demo.select &= 0x7F;
        switch(hid_demo.select)
        {
        case 0:
          hid_demo.state = HID_DEMO_START;  
          break;
          
        case 1:
          hid_demo.state = HID_DEMO_REENUMERATE;  
          break;
          
        default:
          break;
        }
      }
    }
    break; 
    
  case HID_DEMO_START:
    if(Appli_state == APPLICATION_HID)
    {
      if(USBH_HID_GetDeviceType(&hUSBHost) == HID_KEYBOARD)
      {
        hid_demo.keyboard_state = HID_KEYBOARD_IDLE; 
        hid_demo.state = HID_DEMO_KEYBOARD;
      }
      else if(USBH_HID_GetDeviceType(&hUSBHost) == HID_MOUSE)
      {
        hid_demo.mouse_state = HID_MOUSE_IDLE;  
        hid_demo.state = HID_DEMO_MOUSE;        
      }
    }
    else
    {
      LCD_ErrLog("No supported HID device!\n");
      hid_demo.state = HID_DEMO_WAIT;
    }

    break;
    
  case HID_DEMO_REENUMERATE:
    /* Force HID Device to re-enumerate */
    USBH_ReEnumerate(&hUSBHost); 
    hid_demo.state = HID_DEMO_WAIT;
    break;

  case HID_DEMO_MOUSE:
    if( Appli_state == APPLICATION_HID)
    {
      HID_MouseMenuProcess();
      USBH_MouseDemo(&hUSBHost);
    }
    break; 
    
  case HID_DEMO_KEYBOARD:
    if( Appli_state == APPLICATION_HID)  
    {    
      HID_KeyboardMenuProcess();
      USBH_KeybdDemo(&hUSBHost);
    }   
    break;
    
  default:
    break;
  }
}
开发者ID:RadMie,项目名称:STM32F7DiscoveryBase,代码行数:95,代码来源:hid_menu.c


示例14: MSC_MenuProcess

/**
  * @brief  Manages MSC Menu Process.
  * @param  None
  * @retval None
  */
void MSC_MenuProcess(void)
{
  switch(msc_demo.state)
  {
  case MSC_DEMO_START:
    if(Appli_state == APPLICATION_READY)
    {
      BSP_LCD_SetTextColor(LCD_COLOR_GREEN);
      BSP_LCD_DisplayStringAtLine(19, (uint8_t *)"Press User button to start read and write operations");
      
      /* Wait for User Input */
      while((BSP_PB_GetState(BUTTON_WAKEUP) != SET) && (Appli_state != APPLICATION_DISCONNECT))
      {
      }
      msc_demo.state = MSC_DEMO_FILE_OPERATIONS;
      
      /* Prevent debounce effect for user key */
      HAL_Delay(400);
      
      BSP_LCD_ClearStringLine(19);
    }
    break;
    
  case MSC_DEMO_FILE_OPERATIONS:
    /* Read and Write File Here */
    if(Appli_state == APPLICATION_READY)
    {
      MSC_File_Operations();
      
      BSP_LCD_SetTextColor(LCD_COLOR_GREEN);
      BSP_LCD_DisplayStringAtLine(19, (uint8_t *)"Press User button to display disk content");
      
      /* Wait for User Input */
      while((BSP_PB_GetState(BUTTON_WAKEUP) != SET) && (Appli_state != APPLICATION_DISCONNECT))
      {
      }
      msc_demo.state = MSC_DEMO_EXPLORER;
      
      /* Prevent debounce effect for user key */
      HAL_Delay(400);
      
      BSP_LCD_ClearStringLine(19);
    }
    break; 
    
  case MSC_DEMO_EXPLORER:
    /* Display disk content */
    if(Appli_state == APPLICATION_READY)
    {
      Explore_Disk("0:/", 1);
      msc_demo.state = MSC_DEMO_START;
      
      /* Prevent debounce effect for user key */
      HAL_Delay(400);
    }
    break;
    
  default:
    break;
  }
  
  if(Appli_state == APPLICATION_DISCONNECT)
  {
    Appli_state = APPLICATION_IDLE;
    LCD_LOG_ClearTextZone();
    LCD_ErrLog("MSC device disconnected!\n");
    msc_demo.state = MSC_DEMO_START;
    msc_demo.select = 0;
  }
}
开发者ID:Lembed,项目名称:STM32CubeF4-mirrors,代码行数:75,代码来源:menu.c


示例15: CDC_MenuProcess


//.........这里部分代码省略.........
  switch(CdcDemo.state)
  {
  case CDC_DEMO_IDLE:
    CDC_SelectItem(CDC_main_menu, 0); 
    CdcDemo.state = CDC_DEMO_WAIT;
    CdcDemo.select = 0;
    break;    
    
  case CDC_DEMO_WAIT:
    if(CdcDemo.select != PrevSelect)
    {
      PrevSelect = CdcDemo.select;
      CDC_SelectItem(CDC_main_menu, CdcDemo.select & 0x7F);
      
      /* Handle select item */
      if(CdcDemo.select & 0x80)
      {
        switch(CdcDemo.select & 0x7F)
        {
        case 0:
          CdcDemo.state = CDC_DEMO_SEND;
          CdcDemo.Send_state = CDC_SEND_IDLE;
          break;
          
        case 1:
          CdcDemo.state = CDC_DEMO_RECEIVE; 
          CdcDemo.Receive_state = CDC_RECEIVE_IDLE;   
          break;
          
        case 2:
          CdcDemo.state = CDC_DEMO_CONFIGURATION;  
          CdcDemo.Configuration_state = CDC_CONFIGURATION_IDLE; 
          break;
          
        case 3:
          CdcDemo.state = CDC_DEMO_REENUMERATE;  
          break;
          
        default:
          break;
        }
      }
    }
    break;
    
  case CDC_DEMO_SEND: 
    if(Appli_state == APPLICATION_READY)
    {    
      CDC_Handle_Send_Menu();
    }
    else
    {
      CdcDemo.state = CDC_DEMO_WAIT;
    }  
    break; 
    
  case CDC_DEMO_RECEIVE:
    if(Appli_state == APPLICATION_READY)
    {    
      CDC_Handle_Receive_Menu();
    }    
    else
    {
      CdcDemo.state = CDC_DEMO_WAIT;
    }
    break; 
    
  case CDC_DEMO_CONFIGURATION:
    if(Appli_state == APPLICATION_READY)
    {
      CDC_Handle_Configuration_Menu();
    }
    else
    {
      CdcDemo.state = CDC_DEMO_WAIT;
    }
    break;
    
  case CDC_DEMO_REENUMERATE:
    /* Force Device to re-enumerate */
    USBH_ReEnumerate(&hUSBHost); 
    CdcDemo.state = CDC_DEMO_WAIT;
    break;
    
  default:
    break;
  } 
  
  CdcDemo.select &= 0x7F;
  
  if(Appli_state == APPLICATION_DISCONNECT)
  {
    Appli_state = APPLICATION_IDLE; 
    LCD_LOG_ClearTextZone();
    LCD_ErrLog("CDC device disconnected!\n");
    CDC_ChangeSelectMode(CDC_SELECT_MENU);
    CdcDemo.state = CDC_DEMO_IDLE;
    CdcDemo.select = 0;    
  } 
} 
开发者ID:acrepina,项目名称:STM32F7_serverWEB,代码行数:101,代码来源:menu.c


示例16: MSC_File_Operations

/**
  * @brief  Files operations: Read/Write and compare
  * @param  None
  * @retval None
  */
void MSC_File_Operations(void)
{
  uint16_t bytesread;
  
  /* Register the file system object to the FatFs module */
  if(f_mount(&USBH_fatfs, "", 0) != FR_OK)
  {
    LCD_ErrLog("Cannot Initialize FatFs! \n");
  }
  else
  {
    LCD_UsrLog("INFO : FatFs Initialized \n");
    
    if(f_open(&MyFile, "0:USBHost.txt",FA_CREATE_ALWAYS | FA_WRITE) != FR_OK) 
    {
      LCD_ErrLog("Cannot Open 'USBHost.txt' file \n");
    }
    else
    {
      LCD_UsrLog("INFO : 'USBHost.txt' opened for write  \n");
      res= f_write (&MyFile, wtext, sizeof(wtext), (void *)&bytesWritten); 
      f_close(&MyFile);
      
      if((bytesWritten == 0) || (res != FR_OK)) /*EOF or Error*/
      {
        LCD_ErrLog("Cannot Write on the  'USBHost.txt' file \n");
      }
      else
      {
        if(f_open(&MyFile, "0:USBHost.txt", FA_READ) != FR_OK) 
        {
          LCD_ErrLog("Cannot Open 'USBHost.txt' file for read.\n"); 
        }
        else
        {
          LCD_UsrLog("INFO : Text written on the 'USBHost.txt' file \n");
          
          res = f_read(&MyFile, rtext, sizeof(rtext), (void *)&bytesread);
          
          if((bytesread == 0) || (res != FR_OK)) /*EOF or Error*/
          {
            LCD_ErrLog("Cannot Read from the  'USBHost.txt' file \n"); 
          }
          else
          {
            LCD_UsrLog("Read Text : \n"); 
            LCD_DbgLog((char *)rtext); 
            LCD_DbgLog("\n"); 
          }
          f_close(&MyFile);
        }
        /* Compare read data with the expected data */
        if((bytesread == bytesWritten))
        {
          LCD_UsrLog("INFO : FatFs data compare SUCCES");
          LCD_UsrLog("\n"); 
        }
        else
        {
          LCD_ErrLog("FatFs data compare ERROR");
          LCD_ErrLog("\n"); 
        }
      }
    }
  }
}
开发者ID:pierreroth64,项目名称:STM32Cube_FW_F4,代码行数:71,代码来源:file_operations.c


示例17: USBH_USR_OverCurrentDetected

/**
* @brief  USBH_USR_OverCurrentDetected
*         Device Overcurrent detection event
* @param  None
* @retval None
*/
void USBH_USR_OverCurrentDetected (void)
{
   LCD_ErrLog ("Overcurrent detected.\n");
  
}
开发者ID:Seok-Jung,项目名称:STM32F207,代码行数:11,代码来源:usbh_usr.c


示例18: MTP_MenuProcess

/**
  * @brief  Manages MTP Menu Process.
  * @param  None
  * @retval None
  */
void MTP_MenuProcess(void)
{
  switch(mtp_demo.state)
  {
  case MTP_DEMO_IDLE:
    MTP_SelectItem(MTP_main_menu, 0); 
    mtp_demo.state = MTP_DEMO_WAIT;
    mtp_demo.select = 0;
    BSP_LCD_SetTextColor(LCD_COLOR_GREEN);
    BSP_LCD_DisplayStringAtLine(15, (uint8_t *)"Use [Joystick Left/Right] to scroll up/down");
    BSP_LCD_DisplayStringAtLine(16, (uint8_t *)"Use [Joystick Up/Down] to scroll MTP menu");
    break;    
    
  case MTP_DEMO_WAIT:
    
    if(mtp_demo.select != prev_select)
    {
      prev_select = mtp_demo.select;
      MTP_SelectItem(MTP_main_menu, mtp_demo.select & 0x7F);
      
      /* Handle select item */
      if(mtp_demo.select & 0x80)
      {
        
        switch(mtp_demo.select & 0x7F)
        {
        case 0:
          mtp_demo.state = MTP_DEMO_EXPLORE;  
          break;
        
        case 1:         
          /* Display HMI messages */
          BSP_LCD_SetTextColor(LCD_COLOR_GREEN);          
          BSP_LCD_DisplayStringAtLine(14, (uint8_t *)"                                             ");
          BSP_LCD_DisplayStringAtLine(15, (uint8_t *)"                                             ");          
          BSP_LCD_DisplayStringAtLine(16, (uint8_t *)"Use [User Key] To Stop and return from player");
          BSP_LCD_SetTextColor(LCD_COLOR_WHITE); 
          
          /* Set PLAYBACK state and start playing 1st file */ 
          audio_state = AUDIO_STATE_IDLE;
          mtp_demo.state = MTP_DEMO_PLAYBACK;
          MTP_ChangeSelectMode(MTP_PLAYBACK_CONTROL);           
          break;
        
        case 2:
          mtp_demo.state = MTP_REENUMERATE;  
          break;
        
        default:
          break;
        }
      }
    }
    break;
    
  case MTP_DEMO_EXPLORE:  
    if(Appli_state == APPLICATION_READY)
    {
      if(MTP_Init() == 0)
      {
        if(MTP_ExploreWavFile() > 0)
        {
          LCD_ErrLog("There is no WAV file on the microSD.\n" );         
          MTP_ChangeSelectMode(MTP_SELECT_MENU); 
          mtp_demo.state = MTP_DEMO_IDLE;
        }
        else
        {
          mtp_demo.state = MTP_DEMO_WAIT;
        }
      }
    }
    else
    {
      mtp_demo.state = MTP_DEMO_WAIT;
    }
    break; 
    
  case MTP_DEMO_PLAYBACK:
    if(Appli_state == APPLICATION_READY)
    {
      if(MTP_Init() == 0)
      {
        if(audio_state == AUDIO_STATE_IDLE)
        {
          /* Start Playing */
          audio_state = AUDIO_STATE_INIT;
          if(AUDIO_Start(0) == AUDIO_ERROR_IO)
          {
            MTP_ChangeSelectMode(MTP_SELECT_MENU); 
             mtp_demo.state = MTP_DEMO_IDLE;
          }
          else
          {
            BSP_LCD_SetTextColor(LCD_COLOR_YELLOW); 
//.........这里部分代码省略.........
开发者ID:chsigi,项目名称:blindschleiche,代码行数:101,代码来源:menu.c


示例19: HID_MenuProcess

/**
  * @brief  Manages HID Menu Process.
  * @param  None
  * @retval None
  */
void HID_MenuProcess(void)
{
  switch(hid_demo.state)
  {    
  case HID_DEMO_START:
    if(Appli_state == APPLICATION_READY)
    {
      if(USBH_HID_GetDeviceType(&hUSBHost) == HID_KEYBOARD)
      {
        hid_demo.keyboard_state = HID_KEYBOARD_IDLE; 
        hid_demo.state = HID_DEMO_KEYBOARD;
        
        BSP_LCD_SetTextColor(LCD_COLOR_GREEN);
        BSP_LCD_DisplayStringAtLine(19, (uint8_t *)"Press User button to start");
        
        /* Wait for User Input */
        while((BSP_PB_GetState(BUTTON_WAKEUP) != SET) && (Appli_state != APPLICATION_DISCONNECT))
        {
        }
        BSP_LCD_ClearStringLine(19);
        
        HID_KeyboardMenuProcess();
      }
      else if(USBH_HID_GetDeviceType(&hUSBHost) == HID_MOUSE)
      {
        hid_demo.mouse_state = HID_MOUSE_IDLE;  
        hid_demo.state = HID_DEMO_MOUSE;
        
        BSP_LCD_SetTextColor(LCD_COLOR_GREEN);
        BSP_LCD_DisplayStringAtLine(19, (uint8_t *)"Press User button to start");
        
        /* Wait for User Input */
        while((BSP_PB_GetState(BUTTON_WAKEUP) != SET) && (Appli_state != APPLICATION_DISCONNECT))
        {
        }
        BSP_LCD_ClearStringLine(19);
        
        HID_MouseMenuProcess();
      }
      else
      {
        LCD_ErrLog("No supported HID device!\n");
        hid_demo.state = HID_DEM 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ LCD_GetYSize函数代码示例发布时间:2022-05-30
下一篇:
C++ LCD_DisplayString函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap