Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define STM32F10X_CL
- /******************** (C) COPYRIGHT 2011 STMicroelectronics ********************
- * File Name : main.c
- * Author : MCD Application Team
- * Version : V3.3.0
- * Date : 21-March-2011
- * Description : Virtual Com Port Demo main file
- ********************************************************************************
- * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
- * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
- * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
- * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
- * CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
- * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
- *******************************************************************************/
- /* Includes ------------------------------------------------------------------*/
- #ifdef STM32L1XX_MD
- #include "stm32l1xx.h"
- #else
- #include "stm32f10x.h"
- #endif /* STM32L1XX_MD */
- #include "usb_lib.h"
- #include "usb_desc.h"
- #include "hw_config.h"
- #include "usb_pwr.h"
- /* Private typedef -----------------------------------------------------------*/
- /* Private define ------------------------------------------------------------*/
- /* Private macro -------------------------------------------------------------*/
- /* Private variables ---------------------------------------------------------*/
- /* Extern variables ----------------------------------------------------------*/
- /* Private function prototypes -----------------------------------------------*/
- /* Private functions ---------------------------------------------------------*/
- /*******************************************************************************
- * Function Name : main.
- * Description : Main routine.
- * Input : None.
- * Output : None.
- * Return : None.
- *******************************************************************************/
- int main(void)
- {
- char s[]="*********************************\r\n";
- char* buffer_in,*buffer_out[40];
- int len,i,n,lp,count_in=0,count_out;
- volatile int j,k;
- Set_System();
- Set_USBClock();
- USB_Interrupts_Config();
- USB_Init();
- while (bDeviceState != CONFIGURED) ;
- len = strlen(s);
- lp = 0;
- for(j=0;;j++)
- {
- // sioputs("test\r\n");
- /* Write the data to the USB endpoint */
- //n = VIRTUAL_COM_PORT_DATA_SIZE-count_in;
- if( 10 < j ){
- //sioputs("len=");
- //sioputint(len);
- //sioputs("\r\n");
- j=0;
- __disable_irq();
- if( count_in == 0 )
- {
- for(i=0; i<len; i++){
- buffer_in[i] = s[i];
- }
- count_in = len;
- USB_SIL_Write(EP1_IN, buffer_in, count_in);
- //count_in += n;
- }
- __enable_irq();
- //sioputs("end usb_sil_write\r\n");
- }
- if ((count_out != 0) && (bDeviceState == CONFIGURED))
- {
- //USB_To_USART_Send_Data(&buffer_out[0], count_out);
- count_out = 0;
- }
- }
- }
- #ifdef USE_FULL_ASSERT
- /*******************************************************************************
- * Function Name : assert_failed
- * Description : Reports the name of the source file and the source line number
- * where the assert_param error has occurred.
- * Input : - file: pointer to the source file name
- * - line: assert_param error line source number
- * Output : None
- * Return : None
- *******************************************************************************/
- void assert_failed(uint8_t* file, uint32_t line)
- {
- /* User can add his own implementation to report the file name and line number,
- ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
- /* Infinite loop */
- while (1)
- {}
- }
- #endif
- /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
Add Comment
Please, Sign In to add comment