当前位置: 首页>>代码示例>>C++>>正文


C++ STM_EVAL_LEDToggle函数代码示例

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


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

示例1: main

/**
  * @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_stm32l1xx_xx.s) before to branch to application main.
       To reconfigure the default setting of SystemInit() function, refer to
       system_stm32l1xx.c file
     */     

  /* Initialize Leds and Key Button mounted on STM3210X-EVAL board */       
  STM_EVAL_LEDInit(LED1);
  STM_EVAL_LEDInit(LED2);
  STM_EVAL_LEDInit(LED3);
  STM_EVAL_LEDInit(LED4);
  STM_EVAL_PBInit(BUTTON_KEY, BUTTON_MODE_EXTI); 

  /* DMA Channel 6 or 3 configuration ----------------------------------------------*/
  DMA_Config();

  /* EVAL COM1 configuration --------------------------------------------------*/
  USART_Config();  
    
  while (1)
  {
    if(LowPowerMode == 1)
    {
      /* Turn Off LED2 and LED3 */
      STM_EVAL_LEDOff(LED2);
      STM_EVAL_LEDOff(LED3);

      /* Request to enter WFI mode */
      __WFI();
      LowPowerMode = 0;
    }

    Delay(0xFFFFF);
    STM_EVAL_LEDToggle(LED1);
  }

}
开发者ID:jongtao,项目名称:stm32l-dev-chain,代码行数:45,代码来源:main.c

示例2: main

/*******************************************************************************
* Function Name  : main.
* Descriptioan    : Main routine.
* Input          : None.
* Output         : None.
* Return         : None.
*******************************************************************************/
int main(void)
{
  Set_System();
  Set_USBClock();
  USB_Interrupts_Config();
  USB_Init();
  init_USART1();
  Led_init();
  //Configure Systick timing
 if (SysTick_Config(SystemCoreClock / 1000))
  { 
    /* Capture error */ 
    STM_EVAL_LEDOn(LED10);
    while (1);
  }
 
 char dat[7];
 strcpy(dat, conv_f2c(1.53));
  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;
      }*/
      /* Toggle LED3 */
    STM_EVAL_LEDToggle(LED3);  
    /* Insert 100 ms delay */
     USART_puts( USART1, dat);
      Delay(500);
  //  }
  } 
}
开发者ID:fahdovski,项目名称:ROV_PC_Test,代码行数:45,代码来源:main.c

示例3: WAV_OpenNextFile

void WAV_OpenNextFile(void)
{
  uint8_t i;
  FRESULT fresult;
  uint8_t wavHeader[_MAX_SS];

  f_close(&fileR);
  for(i = 0; i < _WAV_FileCounter; i++){
    fresult = f_open(&fileR, _WAV_FileList[_WAV_CurrentFileNumber], FA_READ);
    if (fresult != FR_OK) {
      _WAV_CurrentFileNumber = (_WAV_CurrentFileNumber+1)%_WAV_FileCounter;
      continue;
    }
    else {
      f_read (&fileR, (void *) wavHeader, _MAX_SS, &BytesRead);
      WaveFileStatus = WavePlayer_WaveParsing((uint8_t *) wavHeader);
      if (WaveFileStatus == Valid_WAVE_File) {
        WaveDataLength = WAVE_Format.DataSize;
        printf("Reading sound file %s\n", _WAV_FileList[_WAV_CurrentFileNumber]);
        _WAV_CurrentFileNumber = (_WAV_CurrentFileNumber+1)%_WAV_FileCounter;
        break;
      }
      else {
        f_close(&fileR);
        _WAV_CurrentFileNumber = (_WAV_CurrentFileNumber+1)%_WAV_FileCounter;
        continue;
      }
    }
  }
  if(i == _WAV_FileCounter){
    /* Led Red Toggles in infinite loop */
    while(1)
    {
      STM_EVAL_LEDToggle(LED5);
      Delay(10);
    }
  }
}
开发者ID:cahya-wirawan,项目名称:stm32f4-playsound,代码行数:38,代码来源:waveplayer.c

示例4: LwIP_Periodic_Handle

/**
 * @brief  LwIP periodic tasks
 * @param  localtime the current LocalTime value
 * @retval None
 */
void LwIP_Periodic_Handle(__IO uint32_t localtime) {
#if LWIP_TCP
	/* TCP periodic process every 250 ms */
	if (localtime - TCPTimer >= TCP_TMR_INTERVAL) {
		TCPTimer = localtime;
		tcp_tmr();
	}
#endif

	/* ARP periodic process every 5s */
	if ((localtime - ARPTimer) >= ARP_TMR_INTERVAL) {
		ARPTimer = localtime;
		etharp_tmr();
	}

#ifdef USE_DHCP
	/* Fine DHCP periodic process every 500ms */
	if (localtime - DHCPfineTimer >= DHCP_FINE_TIMER_MSECS) {
		DHCPfineTimer = localtime;
		dhcp_fine_tmr();
		if ((DHCP_state != DHCP_ADDRESS_ASSIGNED)
				&& (DHCP_state != DHCP_TIMEOUT)) {
			/* toggle LED1 to indicate DHCP on-going process */
			STM_EVAL_LEDToggle(LED3);

			/* process DHCP state machine */
			LwIP_DHCP_Process_Handle();
		}
	}

	/* DHCP Coarse periodic process every 60s */
	if (localtime - DHCPcoarseTimer >= DHCP_COARSE_TIMER_MSECS) {
		DHCPcoarseTimer = localtime;
		dhcp_coarse_tmr();
	}

#endif
}
开发者ID:UCC-LCRS,项目名称:Demo-Ethernet,代码行数:43,代码来源:netconf.c

示例5: Media_ReadHalfWord

/*******************************************************************************
* Function Name  : Media_ReadHalfWord
* Description    : Read one half word from the media (SPI_Flash/NOR/NAND memories..)
* Input          : - Offset: the adress offset for read operation
* Output         : None.
* Return         : Data read from the media memory.
*******************************************************************************/
uint16_t Media_ReadHalfWord(uint32_t Offset)
{
    static uint32_t ReplayTimes = 0;
    /* Test if the left channel is to be sent */
    if(monovar == 0)
    {
        if(AudioFileAddress + Offset > AudioFileAddressEnd)
        {
            AudioDataIndex = 0;
            /* Toggle selected LED */
            STM_EVAL_LEDToggle(LED4);
            ReplayTimes++;
            printf("\r 重复播放 %d ... ", ReplayTimes);
        }

        tmpvar =  (*(__IO uint16_t *) (AudioFileAddress + Offset));

        /* Increment the mono variable only if the file is in mono format */
        if(WAVE_Format.NumChannels == Channel_MONO)
        {
            /* Increment the monovar variable */
            monovar++;
        }

        /* Return the read value */
        return tmpvar;
    }
    /* Right channel to be sent in mono format */
    else
    {
        /* Reset the monovar variable */
        monovar = 0;

        /* Return the previous read data in mono format */
        return tmpvar;
    }

}
开发者ID:congallenwang,项目名称:107vc-iap,代码行数:45,代码来源:I2S_Code.c

示例6: main

int main (void){
    InitPeripherals();
    
    PlayTimebase();
    
    UsbInterface usb = UsbInterface();
    usb.Init();
    
    STM_EVAL_LEDInit(LED3);
    STM_EVAL_LEDInit(LED4);
    STM_EVAL_LEDInit(LED5);
    STM_EVAL_LEDInit(LED6);
    STM_EVAL_LEDInit(LED7);
    STM_EVAL_LEDInit(LED8);
    STM_EVAL_LEDInit(LED9);
    STM_EVAL_LEDInit(LED10);

	TIM2_Encoder_Init();
	TIM8_Encoder_Init();

    while(1)
    {
//        usb.printf("flag = %d\n\r", flag);
//        usb.SendNow();

		u16 counter_1 = TIM_GetCounter(TIM2);
		usb.printf("counter1 = %d\n\r", counter_1);
		u16 counter_2 = TIM_GetCounter(TIM8);
		usb.printf("counter2 = %d\n\r", counter_2);
		usb.SendNow();
        STM_EVAL_LEDToggle(LED10);
        DelayMilliseconds(10);
		
    }
    return(0);
}
开发者ID:vincentwenxuan,项目名称:smores_document,代码行数:36,代码来源:main.cpp

示例7: RTC_IRQHandler

/**
  * @brief  This function handles RTC global interrupt request.
  * @param  None
  * @retval None
  */
void RTC_IRQHandler(void)
{
  if (RTC_GetITStatus(RTC_IT_SEC) != RESET)
  {
    /* Clear the RTC Second interrupt */
    RTC_ClearITPendingBit(RTC_IT_SEC);

    /* Toggle LED1 */
    STM_EVAL_LEDToggle(LED1);

    /* Enable time update */
    TimeDisplay = 1;

    /* Wait until last write operation on RTC registers has finished */
    RTC_WaitForLastTask();
    /* Reset RTC Counter when Time is 23:59:59 */
    if (RTC_GetCounter() == 0x00015180)
    {
      RTC_SetCounter(0x0);
      /* Wait until last write operation on RTC registers has finished */
      RTC_WaitForLastTask();
    }
  }
}
开发者ID:jwithee,项目名称:bearboard,代码行数:29,代码来源:stm32f10x_it.c

示例8: ledAction

/**
  * @brief  Perform some led toggling according to the button received from remote node
  * @param  button
  * @retval None
  */
void ledAction(uint8_t buttonAction)
{
  uint32_t i;
  
  if (buttonAction == BUTTON_ACTION_1)
  {
    STM_EVAL_LEDToggle(LED1);
  }
  else if (buttonAction == BUTTON_ACTION_2)
  {
    STM_EVAL_LEDToggle(LED3);
  }
  else if (buttonAction == BUTTON_ACTION_3)
  {
    STM_EVAL_LEDToggle(LED1);
    STM_EVAL_LEDToggle(LED3);
  }
  else if (buttonAction == BUTTON_ACTION_4)
  {
    STM_EVAL_LEDOff(LED1);
    for (i = 0; i < 5; i++)
    {
      STM_EVAL_LEDToggle(LED1);
      halCommonDelayMilliseconds(200);
    }
  } 
  else if (buttonAction == BUTTON_ACTION_5) 
  {
    STM_EVAL_LEDOff(LED3);
    for (i = 0; i < 5; i++)
    {
      STM_EVAL_LEDToggle(LED3);
      halCommonDelayMilliseconds(200);
    }
  }
}
开发者ID:ndpr43,项目名称:CpE5170,代码行数:41,代码来源:talk.c

示例9: MainTask_Gyro

void MainTask_Gyro(void) {
      SysTICK();
      float Buffer[6] = {0};
      uint8_t Xval, Yval = 0x00;


      Demo_GyroConfig();



	SetemWinRunning(1);
		
	GUI_SelectLayer(1); // select foregroung layer
	GUI_SetBkColor(STBLUE);	// select background color as a solid color
	GUI_Clear();	// fill with the background color


        GRAPH_DATA_Handle hData1, hData2, hData3;
        GRAPH_SCALE_Handle hScale;
        WM_HWIN hGraph;
        hGraph = GRAPH_CreateEx(0, 0, 240, 320, WM_HBKWIN, WM_CF_SHOW, 0, GUI_ID_GRAPH0);
        hData1 = GRAPH_DATA_YT_Create(GUI_GREEN, 240, 0, 0);
        hData2 = GRAPH_DATA_YT_Create(GUI_RED, 240, 0, 0);
        //hData3 = GRAPH_DATA_YT_Create(GUI_BLUE, 240, 0, 0);

        GRAPH_AttachData(hGraph, hData1);
        GRAPH_AttachData(hGraph, hData2);
        //GRAPH_AttachData(hGraph, hData3);

        hScale = GRAPH_SCALE_Create(19, GUI_TA_RIGHT, GRAPH_SCALE_CF_VERTICAL, 20);

        GRAPH_SCALE_SetFactor(hScale, 0.5);
        GRAPH_SCALE_SetNumDecs(hScale, 0.01);
        GRAPH_SCALE_SetFont(hScale, &GUI_Font16_1);
        GRAPH_SCALE_SetTextColor(hScale, GUI_BLACK);


        GRAPH_AttachScale(hGraph, hScale);
        GRAPH_SetBorder(hGraph, 20, 0, 0, 0);
        GRAPH_SetGridVis(hGraph, 1);


        GRAPH_SetColor(hGraph, GUI_WHITE, GRAPH_CI_BK);
        GRAPH_SetColor(hGraph, GUI_LIGHTGRAY, GRAPH_CI_BORDER);
        GRAPH_SetColor(hGraph, GUI_BLACK, GRAPH_CI_FRAME);
        GRAPH_SetColor(hGraph, GUI_DARKGRAY, GRAPH_CI_GRID);
        
        GRAPH_SetLineStyleH(hGraph, GUI_LS_DOT);
        GRAPH_SetLineStyleV(hGraph, GUI_LS_DOT);
        
        GRAPH_SetGridDistX(hGraph, 50);
        GRAPH_SetGridDistY(hGraph, 20);

        GUI_Exec();

        STM_EVAL_LEDToggle(LED4);
        STM_EVAL_LEDToggle(LED3);

	// the GUI is now rendered 
	// in never ending loop just check if an incon is touched
  


  while(!tamperPushed)
  {             
    if(open){

        /* Read Gyro Angular data */
        Demo_GyroReadAngRate(Buffer);
        /* Update autoreload and capture compare registers value*/
        Xval = ABS((int8_t)(Buffer[0]));
        Yval = ABS((int8_t)(Buffer[1]));

      
              GRAPH_DATA_YT_AddValue(hData1, Xval*2);
              GRAPH_DATA_YT_AddValue(hData2, Yval*2);
              GUI_Exec();
      
              
                open=0;
    }

  }     
       // WM_DeleteWindow(hGraph);
	SetemWinRunning(0);
	GUI_CURSOR_Hide(); 
}
开发者ID:GreenYo0413,项目名称:stm32f429-lcd-demo,代码行数:87,代码来源:main_Gyro.c

示例10: main

void main(void){
  
    // 0.001 с = 1/1000 с = 1мс
    if (SysTick_Config(SystemCoreClock / 1000)){ 
        /* если вернулся не ноль - ошибка */
        while (1);
    }
    
    STM_EVAL_LEDInit(LED3);
    STM_EVAL_LEDInit(LED4);
    STM_EVAL_LEDInit(LED5);
    STM_EVAL_LEDInit(LED6);
    
    nRF24L01_init();

    nRF24L01_set_rf(nRF24L01_DataRate_2M, nRF24L01_OutputPower_M18dBm);
    
    // устанавливаем адреса приемника и передатчика
    nRF24L01_set_my_addr(MyAddress);
    nRF24L01_set_tx_addr(TxAddress);
    
    u8 str[32] = "Hello blablacode.ru by nRF24\n";
    u8 dataIn[32];
    u16 req = 0;
    
    u16 badTransactions = 0;
    u16 successfulTransactions = 0;  
    
    while (1)  {
        status_reg = nRF24L01_readStatus();
        STM_EVAL_LEDToggle(LED3);
        nRF24L01_writeTx(str);
        do {
            status_reg = nRF24L01_readStatus();
        } while (status_reg.bit.MAX_RT == 0 && status_reg.bit.TX_DS == 0);
        
        nRF24L01_ClearStatus();
        
        nRF24L01_configure_rx();
        do {
            status_reg = nRF24L01_readStatus();
            req++;
            if (req > 1000)
            {
                req = 0;
                break;
            }
        } while (status_reg.bit.RX_DR == 0);
        
        if (status_reg.bit.RX_DR)
        {
            // чистим буфер
            memset(dataIn,0,32);
            // читаем
            nRF24L01_readRx(dataIn,32);
            
            // сравниваем
            int ret = memcmp(dataIn,str,32);
            if (ret == 0)
                successfulTransactions++;
            else
                badTransactions++;
        }        

        status_reg = nRF24L01_readStatus();
    }
}
开发者ID:ClarePhang,项目名称:nRF24L01_lib,代码行数:67,代码来源:main.c

示例11: main

/**
  * @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_stm32f4xx.s) before to branch to application main.
       To reconfigure the default setting of SystemInit() function, refer to
       system_stm32f4xx.c file
     */

  /* Enable PWR APB1 Clock */
  RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR, ENABLE);

  /* Allow access to Backup */
  PWR_BackupAccessCmd(ENABLE);

  /* Reset RTC Domain */
  RCC_BackupResetCmd(ENABLE);
  RCC_BackupResetCmd(DISABLE);

  /* Configure User Button */
  STM_EVAL_PBInit(BUTTON_USER,BUTTON_MODE_EXTI);

  /* Wait until User button is pressed to enter the Low Power mode */
  while(UserButtonStatus == 0x00)
  {
  }
  /* Loop while User button is maintained pressed */
  while(STM_EVAL_PBGetState(BUTTON_USER) != RESET)
  {
  }

#if defined (SLEEP_MODE)
  /* Sleep Mode Entry
      - System Running at PLL (168MHz)
      - Flash 3 wait state
      - Prefetch and Cache enabled
      - Code running from Internal FLASH
      - All peripherals disabled.
      - Wakeup using EXTI Line (User Button PA.00)
   */
  SleepMode_Measure();
#elif defined (STOP_MODE)
  /* STOP Mode Entry
      - RTC Clocked by LSI
      - Regulator in LP mode
      - HSI, HSE OFF and LSI OFF if not used as RTC Clock source
      - No IWDG
      - FLASH in deep power down mode
      - Automatic Wakeup using RTC clocked by LSI (after ~20s)
   */
  StopMode_Measure();
#elif defined (STANDBY_MODE)
  /* STANDBY Mode Entry
      - Backup SRAM and RTC OFF
      - IWDG and LSI OFF
      - Wakeup using WakeUp Pin (PA.00)
   */
  StandbyMode_Measure();
#elif defined (STANDBY_RTC_MODE)
  /* STANDBY Mode with RTC on LSI Entry
      - RTC Clocked by LSI
      - IWDG OFF and LSI OFF if not used as RTC Clock source
      - Backup SRAM OFF
      - Automatic Wakeup using RTC clocked by LSI (after ~20s)
   */

  StandbyRTCMode_Measure();
#elif defined (STANDBY_RTC_BKPSRAM_MODE)
  /* STANDBY Mode with RTC on LSI Entry
      - RTC Clocked by LSI
      - Backup SRAM ON
      - IWDG OFF
      - Automatic Wakeup using RTC clocked by LSI (after ~20s)
  */

  StandbyRTCBKPSRAMMode_Measure();
#else

  /* Initialize LED4 on STM32F4-Discovery board */
  STM_EVAL_LEDInit(LED4);

  /* Infinite loop */
  while (1)
  {
    /* Toggle The LED4 */
    STM_EVAL_LEDToggle(LED4);

    /* Inserted Delay */
    for(i = 0; i < 0x5FF; i++);
  }
#endif

}
开发者ID:rabryan,项目名称:stm32f4examples,代码行数:98,代码来源:main.c

示例12: main

/**
  * @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_stm32f30x.s) before to branch to application main.
         To reconfigure the default setting of SystemInit() function, refer to
         system_stm32f30x.c file
       */

    /* Initialize Leds mounted on STM32F3-discovery */
    STM_EVAL_LEDInit(LED3);
    STM_EVAL_LEDInit(LED4);
    STM_EVAL_LEDInit(LED5);
    STM_EVAL_LEDInit(LED6);
    STM_EVAL_LEDInit(LED7);
    STM_EVAL_LEDInit(LED8);
    STM_EVAL_LEDInit(LED9);
    STM_EVAL_LEDInit(LED10);

    /* Turn On LED3 */
    STM_EVAL_LEDOn(LED3);
    /* Turn On LED7 */
    STM_EVAL_LEDOn(LED7);
    /* Turn On LED6 */
    STM_EVAL_LEDOn(LED6);
    /* Turn On LED10 */
    STM_EVAL_LEDOn(LED10);

    /* Setup SysTick Timer for 1 msec interrupts.
       ------------------------------------------
      1. The SysTick_Config() function is a CMSIS function which configure:
         - The SysTick Reload register with value passed as function parameter.
         - Configure the SysTick IRQ priority to the lowest value (0x0F).
         - Reset the SysTick Counter register.
         - Configure the SysTick Counter clock source to be Core Clock Source (HCLK).
         - Enable the SysTick Interrupt.
         - Start the SysTick Counter.

      2. You can change the SysTick Clock source to be HCLK_Div8 by calling the
         SysTick_CLKSourceConfig(SysTick_CLKSource_HCLK_Div8) just after the
         SysTick_Config() function call. The SysTick_CLKSourceConfig() is defined
         inside the stm32f30x_misc.c file.

      3. You can change the SysTick IRQ priority by calling the
         NVIC_SetPriority(SysTick_IRQn,...) just after the SysTick_Config() function
         call. The NVIC_SetPriority() is defined inside the core_cm0.h file.

      4. To adjust the SysTick time base, use the following formula:

           Reload Value = SysTick Counter Clock (Hz) x  Desired Time base (s)

         - Reload Value is the parameter to be passed for SysTick_Config() function
         - Reload Value should not exceed 0xFFFFFF
     */
    if (SysTick_Config(SystemCoreClock / 1000))
    {
        /* Capture error */
        while (1);
    }

    while (1)
    {
        /* Toggle LED3 */
        STM_EVAL_LEDToggle(LED3);
        /* Toggle LED7 */
        STM_EVAL_LEDToggle(LED7);
        /* Toggle LED6 */
        STM_EVAL_LEDToggle(LED6);
        /* Toggle LED10 */
        STM_EVAL_LEDToggle(LED10);

        /* Insert 100 ms delay */
        Delay(100);

        /* Toggle LED4 */
        STM_EVAL_LEDToggle(LED4);
        /* Toggle LED5 */
        STM_EVAL_LEDToggle(LED5);
        /* Toggle LED9 */
        STM_EVAL_LEDToggle(LED9);
        /* Toggle LED8 */
        STM_EVAL_LEDToggle(LED8);

        /* Insert 150 ms delay */
        Delay(150);
    }
}
开发者ID:gnunicky,项目名称:openstm32f303xx,代码行数:92,代码来源:main.c

示例13: SysTick_Handler

/**
  * @brief  This function handles SysTick Handler.
  * @param  None
  * @retval None
  */
void SysTick_Handler(void)
{
  /* Toggle LED1 */
  STM_EVAL_LEDToggle(LED1);
}
开发者ID:bmaxfie,项目名称:Cerulean-Hardware,代码行数:10,代码来源:stm32f4xx_it.c

示例14: main

/**
  * @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
     */     
       
  /* System Clocks Configuration */
  RCC_Configuration();
       
  /* Configure the GPIO ports */
  GPIO_Configuration();

  /* Initialize Leds, Wakeup and Key Buttons mounted on STM3210X-EVAL board */ 
  STM_EVAL_LEDInit(LED1);
  STM_EVAL_LEDInit(LED2);
  STM_EVAL_LEDInit(LED3);
  STM_EVAL_LEDInit(LED4);
  STM_EVAL_PBInit(BUTTON_WAKEUP, BUTTON_MODE_EXTI);          
  STM_EVAL_PBInit(BUTTON_KEY, BUTTON_MODE_EXTI);  

/* USARTy and USARTz configuration -------------------------------------------*/
  /* USARTy and USARTz configured as follow:
        - BaudRate = 9600 baud  
        - Word Length = 9 Bits
        - One Stop Bit
        - No parity
        - Hardware flow control disabled (RTS and CTS signals)
        - Receive and transmit enabled
  */
  USART_InitStructure.USART_BaudRate = 9600;
  USART_InitStructure.USART_WordLength = USART_WordLength_9b;
  USART_InitStructure.USART_StopBits = USART_StopBits_1;
  USART_InitStructure.USART_Parity = USART_Parity_No;
  USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
  USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;
  
  /* Configure USARTy */
  USART_Init(USARTy, &USART_InitStructure);
  /* Configure USARTz */
  USART_Init(USARTz, &USART_InitStructure);
  
  /* Enable the USARTy */
  USART_Cmd(USARTy, ENABLE);
  /* Enable the USARTz */
  USART_Cmd(USARTz, ENABLE);

  /* Set the USARTy Address */
  USART_SetAddress(USARTy, 0x1);
  /* Set the USARTz Address */
  USART_SetAddress(USARTz, 0x2);

  /* Select the USARTz WakeUp Method */
  USART_WakeUpConfig(USARTz, USART_WakeUp_AddressMark);
  
  while (1)
  {
    /* Send one byte from USARTy to USARTz */
    USART_SendData(USARTy, 0x33);
    
    /* Wait while USART1 TXE = 0 */
    while(USART_GetFlagStatus(USARTz, USART_FLAG_TXE) == RESET)
    {
    }
    
    if(USART_GetFlagStatus(USARTz, USART_FLAG_RXNE) != RESET)
    {
      if(USART_ReceiveData(USARTz) == 0x33)
      {
        STM_EVAL_LEDToggle(LED1);
        Delay(0x5FFFF);
        STM_EVAL_LEDToggle(LED2);
        Delay(0x5FFFF);
        STM_EVAL_LEDToggle(LED3);
        Delay(0x5FFFF);
        STM_EVAL_LEDToggle(LED4);
        Delay(0x5FFFF);
      }
    }
  }
}
开发者ID:0x00f,项目名称:STM32F1-workarea,代码行数:88,代码来源:main.c

示例15: main

/**
  * @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_stm32f30x.s) before to branch to application main.
       To reconfigure the default setting of SystemInit() function, refer to
       system_stm32f30x.c file
     */ 
  
  /* Configure USER Button */
  STM_EVAL_PBInit(BUTTON_USER,BUTTON_MODE_EXTI);
  KeyPressed = 0;
  
  /* Loop while USER button is maintained pressed */
  while(KeyPressed == 0)
  {
  }
  
  /* Loop while User button is maintained pressed */
  while(STM_EVAL_PBGetState(BUTTON_USER) != RESET)
  {
  }
  
  /* Enable PWR APB1 Clock */
  RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR, ENABLE);
    
  /* Allow access to Backup */
  PWR_BackupAccessCmd(ENABLE);
    
  /* Reset RTC Domain */
  RCC_BackupResetCmd(ENABLE);
  RCC_BackupResetCmd(DISABLE);
      
#if defined (SLEEP_MODE)
  /* Sleep Mode Entry 
      - System Running at PLL (72MHz)
      - Flash 1 wait state
      - Prefetch and Cache enabled
      - Code running from Internal FLASH
      - All peripherals disabled.
      - Wakeup using EXTI Line (USER Button PA.0)
   */  
  SleepMode_Measure();
#elif defined (STOP_MODE)
  /* STOP Mode Entry 
      - RTC Clocked by LSI
      - Regulator in LP mode
      - HSI, HSE OFF and LSI OFF if not used as RTC Clock source  
      - No IWDG
      - FLASH in deep power down mode
      - Automatic Wakeup using RTC clocked by LSI 
   */
  /* When using the small packages (48 and 64 pin packages), the GPIO pins which 
     are not present on these packages, must not be configured in analog mode.*/
  StopMode_Measure();
#elif defined (STANDBY_MODE)
  /* STANDBY Mode Entry 
      - RTC OFF
      - IWDG and LSI OFF
      - Wakeup using WakeUp Pin (PA.0)
   */
  StandbyMode_Measure();
#elif defined (STANDBY_RTC_MODE)
  /* STANDBY Mode with RTC on LSI Entry 
      - RTC Clocked by LSI
      - IWDG OFF and LSI OFF if not used as RTC Clock source
      - Automatic Wakeup using RTC clocked by LSI 
   */

  StandbyRTCMode_Measure();
#else

  /* Initialize LED3 on STM32373C-EVAL board */
  STM_EVAL_LEDInit(LED3);
  
  /* Infinite loop */
  while (1)
  {
    /* Toggle The LED3 */
    STM_EVAL_LEDToggle(LED3);

    /* Inserted Delay */
    for(i = 0; i < 0x7FFF; i++);
  }
#endif
}
开发者ID:BGCX261,项目名称:ziplockk-embedded-svn-to-git,代码行数:91,代码来源:main.c


注:本文中的STM_EVAL_LEDToggle函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。