Esempio n. 1
0
/**
 * @brief  Configure the USB in CDC mode.
 * @retval None
 */
void initUSB_CDC(void) {
    Set_System();
    Set_USBClock();
    USB_Interrupts_Config();
    USB_Init_Dynamic(&Device_Property_CDC, &User_Standard_Requests_CDC);
    // now device state is UNCONNECTED
}
int main(void)
{
	RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);

	GPIOA->CRH &= !(GPIO_CRH_CNF8_0 | GPIO_CRH_CNF8_1);
	GPIOA->CRH = GPIO_CRH_MODE8_1;
	GPIOA->BSRR = GPIO_BSRR_BS8;

	
	Set_System();
	Set_USBClock();

	USB_Interrupts_Config();
	USB_Init();

	while (1)
	{
		packet_buffer_to_rx_fifo();
		rx_fifo_to_tx_fifo();
		tx_fifo_to_packet_buffer();	

		
//			if(GPIO_ReadInputDataBit (GPIOA, GPIO_Pin_8))
//			{
//				GPIO_ResetBits(GPIOA, GPIO_Pin_8);
//			}
//			else
//			{
//				GPIO_SetBits(GPIOA, GPIO_Pin_8);
//			}
	
  }
}
Esempio n. 3
0
/*******************************************************************************
* Function Name  : main.
* Descriptioan    : Main routine.
* Input          : None.
* Output         : None.
* Return         : None.
*******************************************************************************/
int main(void)
{
    int i;

    /* Set the Vector Table base adress at 0x8004000 */
    NVIC_SetVectorTable(NVIC_VectTab_FLASH, 0x4000);
    
    // Disable JTAG not the SWD  
    RCC_APB2PeriphClockCmd( RCC_APB2Periph_AFIO , ENABLE);      
    GPIO_PinRemapConfig(GPIO_Remap_SWJ_JTAGDisable, ENABLE);  
  
    Set_System();
    Set_USBClock();
    USB_Interrupts_Config();
    USB_Init();
    
    for(i = 0; i < 27; i++) TestBuffer[i] = i % 9;  
    
    while (1)
    {
        if (bDeviceState == CONFIGURED)
        {
            //CDC_Send_DATA ((unsigned char*)TestBuffer,27);
            //Delay(0xFFF);         
            CDC_Receive_DATA();
            // Check to see if we have data yet
            if (Receive_length  != 0)
            {
                if (packet_sent == 1)
                CDC_Send_DATA ((unsigned char*)Receive_Buffer,Receive_length);
                Receive_length = 0;
            }
        }
    }
} 
Esempio n. 4
0
File: main.c Progetto: eiva/Quadro
/*******************************************************************************
* Function Name  : main.
* Description    : main routine.
* Input          : None.
* Output         : None.
* Return         : None.
*******************************************************************************/
int main(void)
{
  Set_System();

  USB_Interrupts_Config();

  Set_USBClock();

  USB_Init();

  uint16_t counter = 0;

  while (1)
  {
	  TheReport.SAX = 32768;
	  TheReport.SAY = counter;
	  ++counter;
	  if (bDeviceState == CONFIGURED)
	  {
		  if (PrevXferComplete)
	      {
	          RHIDCheckState();
	      }
	  }
  }
}
Esempio n. 5
0
int main(void)
{
	 /* USART1 config */
	USART1_Config();
	
  LED_GPIO_Config();
  
	/*初始化SD卡*/
	Set_System();
  	
	/*设置USB时钟为48M*/
	Set_USBClock();
 	
	/*配置USB中断(包括SDIO中断)*/
	USB_Interrupts_Config();
 
	/*USB初始化*/
 	USB_Init();
 
 	while (bDeviceState != CONFIGURED);	 //等待配置完成
	   
	printf("\r\n 野火 ISO STM32 USB MASS STORAGE 实验\r\n");
	 
  while (1)
  {
    LED1_TOGGLE;
    USB_Delay(0x0FFFFF);
  }
}
Esempio n. 6
0
int main()
{
    SysTick_Config(SystemCoreClock/1000);
    GPIO_PinRemapConfig(GPIO_Remap_SWJ_JTAGDisable,ENABLE);
    Set_System();
    Set_USBClock();
    USB_Interrupts_Config();
    USB_Init();

/*
 *    GPIO_Config();
 *
 *    GPIOA->BSRR = GPIO_Pin_15;
 *
 *    while (1)
 *    {
 *        if (bDeviceState == CONFIGURED) {
 *            CDC_Receive_DATA();
 *            [>Check to see if we have data yet <]
 *            if (Receive_length != 0) {
 *                if (packet_sent == 1)
 *                    CDC_Send_DATA((unsigned char*) Receive_Buffer, Receive_length);
 *                Receive_length = 0;
 *            }
 *        }
 *    }
 */
    while(1);
}
Esempio n. 7
0
void cliInit(void)
{
	Set_System();
	Set_USBClock();
	USB_Interrupts_Config();
	USB_Init();
}
Esempio n. 8
0
void main(void)
{
/*--------------initialization-----------*/

  Set_System();
  NVIC_Configuration();
  GPIO_Config();
  SD_Card_Check();
  USB_Init();
  ADC_Configuration();
  Timer_Configuration();
  LCD_Initial();
  Clear_Screen(BLACK); 
  Display_Logo(110,150);  
 
/*----------Power ON Information----------*/ 

  Display_Str(80, 87, GRN,   PRN, "System Initializing");
  Display_Str(102, 71, GRN,   PRN, "Please Wait");
  Display_Str(8, 39, WHITE, PRN, "DSO FW Copyright (c) BenF 2010-2011"); 
  Display_Str(8, 23, YEL,   PRN, "LIB ver 3.13");
  
  //WaitForKey();

  // check for presence of APP and jump to start
  pApp = (APP_Interface *)*(u32 *)(APP_VECTORS + 7 * 4);
  if (pApp->Signature == APP_SIGNATURE)
      pApp->APP_Start();

  Display_Str(150, 23, RED, PRN, "No APP found");
  while (1);
}
Esempio n. 9
0
/**
  * @brief  串口打印输出
  * @param  None
  * @retval None
  */
int main(void)
{
	uint8_t data[64];
	uint32_t i=0,ret=0;
	Set_System();//系统时钟初始化
	USART_Configuration();//串口1初始化
	printf("\x0c\0");printf("\x0c\0");//超级终端清屏
	printf("\033[1;40;32m");//设置超级终端背景为黑色,字符为绿色
	printf("\r\n*******************************************************************************");
	printf("\r\n************************ Copyright 2009-2012, ViewTool ************************");
	printf("\r\n*************************** http://www.viewtool.com ***************************");
	printf("\r\n***************************** All Rights Reserved *****************************");
	printf("\r\n*******************************************************************************");
	printf("\r\n");

	USB_Interrupts_Config();
	Set_USBClock();
	USB_Init();

	while(1)
	{
		if(USB_Received_Flag){
			USB_Received_Flag=0;
			ret = USB_GetData(data,sizeof(data));
			printf("usb get data %d byte data\n\r",ret);
			for(i=0;i<ret;i++){
				printf("0x%02X ",data[i]);
			}
			printf("\n\r");
			USB_SendData(data,sizeof(data));
		}
	}
}
Esempio n. 10
0
/*******************************************************************************
* Function Name  : main.
* Description    : Main routine.
* Input          : None.
* Output         : None.
* Return         : None.
*******************************************************************************/
int main(void)
{
    int i;
    Reset_GC3355();
    Set_System();
    Set_USBClock();
    USB_Interrupts_Config();
#ifdef USE_USB_AS_HOST_IF	
    USB_Init();
#endif	
	  USART_Config_Default();
    btc_ltc_uart_config(115200);
    delay_init(72);
    //gpio_init();
    Timerx_Init(100,7200-1);
    USART_Config_Default();
    rx_cx_buffers_init();
    while (1)
    {
        dispatch_host_cmd();
        report_nonce_to_host();
        if(timer_count > 100) {
		timer_count = 0;
		//PR_DEBUG("GPIOB8 = %d\n",GPIO_ReadInputDataBit(GPIOB, GPIO_Pin_8));
		led1_revert();
		//PR_DEBUG("%02X\n",get_next_n_out(&usb_trans_buffer,152));
		//PR_DEBUG("has cmd length = %d\n",trans_buffer_has_cmd(&usb_trans_buffer));
        }
        //delay_ms(1000);
        //PR_DEBUG("delay 1000ms \n");
    }
}
Esempio n. 11
0
/*******************************************************************************
* Function Name  : main.
* Description    : main routine.
* Input          : None.
* Output         : None.
* Return         : None.
*******************************************************************************/
int main(void)
{
  GPIO_InitTypeDef GPIO_InitStructure;
	NAND_IDTypeDef NAND_Id;
	NAND_ADDRESS NAND_Address;
	int i=0;
#ifdef DEBUG
  debug();
#endif

  Set_System();
  RCC_AHBPeriphClockCmd(RCC_AHBPeriph_FSMC, ENABLE);
  
  Serial_Init();

    NAND_Init();
		NAND_Reset();
  NAND_ReadID(&NAND_Id);

  Get_Medium_Characteristics();
  Set_USBClock();
  USB_Interrupts_Config(); 
  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_13;
  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_OD;
  GPIO_Init(GPIOC, &GPIO_InitStructure);
  USB_Init();
	
  while (1)
  {	

  }
}
Esempio n. 12
0
int main(void)
{
	volatile float fnk1,fnk2,fnk3=0;
        int i;

	Set_System();
	
	SysTickInit(INTERVAL);
	
	conio_init(UART_DEFAULT_NUM,UART_BAUDLATE);
	printf("\n");
	printf("Welcome to %s test program !!\n",MPU_SUBMODEL);
	printf("Version %s!!\n",APP_VERSION);
	printf("Build Date : %s\n",__DATE__);

	fnk1 = 14.0;
	fnk2 = 9.0;
	fnk3 = fnk1/fnk2;
	printf("Floating point calculation: %f/%f=%f\n",fnk1,fnk2,fnk3);
	printf("\n");
        fnk1 = 0.0;
        for (i = 1;i < 50000000;i += 4) {
          fnk1 += 4.0f / (float)(i) - 4.0f / (float)(i + 2);
        }
	printf("pi: %f\n",fnk1);
	printf("\n");

	/* Main Loop */
	while (1)
	{
		_delay_ms(100);
		_delay_ms(100);
	}
}
Esempio n. 13
0
int main()
{
  InitGPIO();
  //InitTIM3();
  //InitTIM4();

  InitIWDG();    // Init Watch Dog 
  InitBKP();
  
#ifdef DEBUG_OUTPUT_USB
  Set_System();
  Set_USBClock();
  USB_Interrupts_Config();
  USB_Init();
#else
  rtc_init();
#endif
  
  RTC_t date;
  date.year = 2015;
  date.month = 10;
  date.mday = 24;
  
  date.hour = 23;
  date.min = 20;
  date.sec = 0;
  rtc_settime(&date);
  
  // Start Task //
  xTaskCreate(vLcdPcf, "vLcdPcf", configMINIMAL_STACK_SIZE * 2, NULL, tskIDLE_PRIORITY + 1, &xHandlevLcdPcfTask);
  xTaskCreate(vDebugTask, "vDebugTask", configMINIMAL_STACK_SIZE * 2, NULL, tskIDLE_PRIORITY + 1, &xHandleDebugTask);
  
  // Start scheduler //
  osKernelStart(NULL, NULL);
}
Esempio n. 14
0
/*******************************************************************************
* Function Name  : main.
* Description    : main routine.
* Input          : None.
* Output         : None.
* Return         : None.
*******************************************************************************/
int main(void)
{
	DFU_Button_Config();

	/* Check if the Key push-button on STM3210x-EVAL Board is pressed */
	if (DFU_Button_Read())
	{ /* Test if user code is programmed starting from address 0x8003000 */
		if (((*(__IO uint32_t*)ApplicationAddress) & 0x2FFE0000 ) == 0x20000000)
		{ /* Jump to user application */

		JumpAddress = *(__IO uint32_t*) (ApplicationAddress + 4);
		Jump_To_Application = (pFunction) JumpAddress;
		/* Initialize user application's Stack Pointer */
		__set_MSP(*(__IO uint32_t*) ApplicationAddress);
		Jump_To_Application();
		}
	} /* Otherwise enters DFU mode to allow user to program his application */

	/* Enter DFU mode */
	DeviceState = STATE_dfuERROR;
	DeviceStatus[0] = STATUS_ERRFIRMWARE;
	DeviceStatus[4] = DeviceState;

	Set_System();
	Set_USBClock();

	USB_Init();  
  
	/* turn on LED */
	GPIOB->BSRR = GPIO_Pin_5;	

	/* Main loop */
	while (1)
	{}
}
Esempio n. 15
0
int main(void)
{
    /* Set Basis System(includes SYSTICK Setings) */
    Set_System();

    /* Set UART and redirect to stdio */
    conio_init(UART_DEFAULT_NUM,UART_BAUDRATE);

    BSP_LED_Init(LED_GREEN);


    int i = 0;

    for(;;)
    {
        BSP_LED_Toggle(LED_GREEN);

        for (int j = 0; j < 1000000; j++)
            ;

        printf("Hello, world! -- %i\n", i++);
    }

    return 0;
}
Esempio n. 16
0
int main()
{
  InitGPIO();

  InitBKP();
  
  Set_System();
  Set_USBClock();
  USB_Interrupts_Config();
  USB_Init();
  
  
  rtc_init();
  
  /*
  RTC_t date;
  date.year = 2015;
  date.month = 10;
  date.mday = 24;
  
  date.hour = 23;
  date.min = 20;
  date.sec = 0;
  rtc_settime(&date);
  */
  
  // Start Task //
  xTaskCreate(vLcdTask, "vLcdTask", configMINIMAL_STACK_SIZE * 1, NULL, tskIDLE_PRIORITY + 1, &xHandleLcdTask);
  xTaskCreate(vDebugTask, "vDebugTask", configMINIMAL_STACK_SIZE * 1, NULL, tskIDLE_PRIORITY + 1, &xHandleDebugTask);
  
  // Start scheduler //
  osKernelStart(NULL, NULL);
}
void uart_init() {
    Set_System();
    Set_USBClock();
    USB_Interrupts_Config();

    USB_Init();

}
Esempio n. 18
0
void OTG_HS_WKUP_IRQHandler(){
	if(USB_OTG_devB.cfg.low_power){
		*(uint32_t *)(0xE000ED10) &= 0xFFFFFFF9 ;
		Set_System();
		USB_OTG_UngateClock(&USB_OTG_devB);
	}
	EXTI_ClearITPendingBit(EXTI_Line20);
}
Esempio n. 19
0
/*********************************************************************************************
Function name   : VCP_Init
Author 					: Grant Phillips
Date Modified   : 10/04/2014
Compiler        : Keil ARM-MDK (uVision V4.70.0.0)

Description			: Initializes the Virtual COM Port module

Special Note(s) : NONE

Parameters			: NONE
Return value		: NONE
*********************************************************************************************/
void VCP_Init(void)
{
  Set_System();
  Set_USBClock();
  USB_Interrupts_Config();		
  USB_Init();
	
	packet_sent=1;
}
Esempio n. 20
0
serialPort_t *usbVcpOpen(void)
{
    vcpPort_t *s;

    IOInit(IOGetByTag(IO_TAG(PA11)), OWNER_USB, 0);
    IOInit(IOGetByTag(IO_TAG(PA12)), OWNER_USB, 0);

#if defined(STM32F4)
    usbGenerateDisconnectPulse();

    switch (usbDevConfig()->type) {
#ifdef USE_USB_CDC_HID
    case COMPOSITE:
        USBD_Init(&USB_OTG_dev, USB_OTG_FS_CORE_ID, &USR_desc, &USBD_HID_CDC_cb, &USR_cb);
        break;
#endif
    default:
        USBD_Init(&USB_OTG_dev, USB_OTG_FS_CORE_ID, &USR_desc, &USBD_CDC_cb, &USR_cb);
        break;
    }
#elif defined(STM32F7)
    usbGenerateDisconnectPulse();

    /* Init Device Library */
    USBD_Init(&USBD_Device, &VCP_Desc, 0);

    /* Add Supported Class */
    switch (usbDevConfig()->type) {
#ifdef USE_USB_CDC_HID
    case COMPOSITE:
    	USBD_RegisterClass(&USBD_Device, USBD_HID_CDC_CLASS);
        break;
#endif
    default:
        USBD_RegisterClass(&USBD_Device, USBD_CDC_CLASS);
        break;
    }

    /* HID Interface doesn't have any callbacks... */
    /* Add CDC Interface Class */
    USBD_CDC_RegisterInterface(&USBD_Device, &USBD_CDC_fops);

    /* Start Device Process */
    USBD_Start(&USBD_Device);
#else
    Set_System();
    Set_USBClock();
    USB_Init();
    USB_Interrupts_Config();
#endif

    s = &vcpPort;
    s->port.vTable = usbVTable;

    return (serialPort_t *)s;
}
Esempio n. 21
0
/*******************************************************************************
* Function Name  : main.
* Description    : Main routine.
* Input          : None.
* Output         : None.
* Return         : None.
*******************************************************************************/
int main(void)
{
	Set_System();
	Set_USBClock();
	USB_Interrupts_Config();
	USB_Init();

	while (1) {
	}
}
Esempio n. 22
0
/*******************************************************************************
* Function Name  : main.
* Description    : Main routine.
* Input          : None.
* Output         : None.
* Return         : None.
*******************************************************************************/
int main(void)
{
  Set_System();
  Set_USBClock();
  USB_Config();
  USB_Init();
  Speaker_Config();
  while (1)
  {}
}
Esempio n. 23
0
void USB_HID_Init(void)
{
	bDeviceState=UNCONNECTED;
	USB_HID_RecData_Ready = 0;
	USB_HID_RecData_Len = 0;
	Set_System();
	USB_Interrupts_Config();
	Set_USBClock();
	USB_Init();
}
Esempio n. 24
0
/**
 * @brief  Configure the USB.
 * @param  None
 * @retval None
 */
void USB_Config(void) {
	Set_System();
	Set_USBClock();
	USB_Interrupts_Config();

	USB_Init();

	while (bDeviceState != CONFIGURED) {
	}
}
Esempio n. 25
0
/*******************************************************************************
* Function Name  : main.
* Description    : Main routine.
* Input          : None.
* Output         : None.
* Return         : None.
*******************************************************************************/
int main(void)
{  NVIC_SetVectorTable(NVIC_VectTab_FLASH,0x3000);
  Set_System();
  Set_USBClock();
  USB_Interrupts_Config();
  USB_Init();
  
  while (1)
  {
  }
}
Esempio n. 26
0
/**
	* @brief	Configure the usb serial communication.
	*					Blocking function.
	* @param 	Void
	* @return Void
	*/
void usbCommInit( void )
{
	
	Set_System();
  Set_USBClock();
  USB_Interrupts_Config();
  USB_Init();
	while (USB_GetState() != CONFIGURED) {} // Wait USB is ready
	
	usbCommInitPeriodicSending();
}
Esempio n. 27
0
int main(void)
{
  Set_System();                     //系统初始化
  while (1)
  {
		USART1_Run();										//串口1实时运行函数
		USART2_Run();										//串口2实时运行函数
		KEY_Run();											//按键实时监测函数
		COMMUNICATE_TO_RLM_Run();				//通信处理函数
  }
}
Esempio n. 28
0
File: main.c Progetto: margguo/DAQ
/**
  * @brief  Configure the USB.
  * @param  None
  * @retval None
  */
void Demo_USB (void)
{
  Set_System();
  Set_USBClock();
  USB_Interrupts_Config();
  
  USB_Init();

  while ((bDeviceState != CONFIGURED)&&(USBConnectTimeOut != 0))
  {}
}
Esempio n. 29
0
/*******************************************************************************
* Function Name  : main.
* Description    : Main routine.
* Input          : None.
* Output         : None.
* Return         : None.
*******************************************************************************/
int main(void)
{
#ifdef DEBUG
    debug();
#endif

    Set_System();
    Set_USBClock();
    USB_Config();
    USB_Init();
    InitialIO();
    InitialADC();

#ifdef  JOYSTICK
    SSD1303_Init();

    InitialSSD1306_controller();
#endif

    InitialProcTask();

    //WaitConfig();

    InitialDevice(&dev,&SSD1303_Prop,SongSmall5_DrawChar);

    SysTick_CLKSourceConfig(SysTick_CLKSource_HCLK);
    SysTick_SetReload(72000000/20);
    SysTick_CounterCmd(SysTick_Counter_Enable);
    SysTick_ITConfig(ENABLE);

    CurrentProcess = JoystickProcess;
    CurrentSystick = JoystickSystick;
    JoystickUIInit();
    void  HidProcess(void);
    while (1)
    {
        HidProcess();
        continue;
        static u8 lastCamOn = 0;
        if(lastCamOn != bCameraOn) {
            if(bCameraOn) {
                CurrentProcess = TetrisProcess;
                CurrentSystick = TetrisSystick;
                TetrisUIInit();
            } else {
                CurrentProcess = JoystickProcess;
                CurrentSystick = JoystickSystick;
                JoystickUIInit();
            }
        }
        lastCamOn = bCameraOn;
        CurrentProcess();
    }
}
Esempio n. 30
0
/**
  * @brief  Main program.
  * @param  None
  * @retval None
  */
int main(void)
{
    /*!< At this stage the microcontroller clock setting is already configured, 
       this is done through SystemInit() function which is called from startup
       file (startup_stm32f10x_xx.s) before to branch to application main.
       To reconfigure the default setting of SystemInit() function, refer to
       system_stm32f10x.c file
     */ 
  
DFU_Button_Config();
  
#ifdef Enable_SW_Mode
  /* Check if the Key push-button on iNEMO Board is pressed or the Option Byte is 0*/
   if ( (DFU_Button_Read() != 0x00) && (Option_Byte_Read() != 0x01))
#else
  /* Check if the Key push-button on iNEMO Board is pressed */
   if (DFU_Button_Read() != 0x00)
#endif     
  { /* Test if user code is programmed starting from address 0x8003000 */
    if (((*(__IO uint32_t*)ApplicationAddress) & 0x2FFE0000 ) == 0x20000000)
    { /* Jump to user application */

      JumpAddress = *(__IO uint32_t*) (ApplicationAddress + 4);
      Jump_To_Application = (pFunction) JumpAddress;
      /* Initialize user application's Stack Pointer */
      __set_MSP(*(__IO uint32_t*) ApplicationAddress);
      Jump_To_Application();
    }
  } /*!< Otherwise enters DFU mode to allow user to program his application */

#ifdef Enable_SW_Mode
  /*Delete the Option Byte*/
  if(Option_Byte_Read()==0x01)
  {
    Leave_DFU_SW_Mode();
  }
#endif 
  
  
  /* Enter DFU mode */
  DeviceState = STATE_dfuERROR;
  DeviceStatus[0] = STATUS_ERRFIRMWARE;
  DeviceStatus[4] = DeviceState;

  Set_System();
  Set_USBClock();
  USB_Init();

  /* Main loop */
  while (1)
  {}
}