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

C++ GPIO_ToggleBits函数代码示例

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

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



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

示例1: NEC_ReceiveInterrupt

void NEC_ReceiveInterrupt(NEC_FRAME f) {
	GPIO_ToggleBits(GPIOD, GPIO_Pin_7);
	char buf[12];
	USART_WriteString("NEC Frame was received : \r\nAddress : ");
	Int2Str(buf, f.Address);
	USART_WriteString(buf);
	USART_WriteString("\r\nCommand : ");
	Int2Str(buf, f.Command);
	USART_WriteString(buf);
	USART_WriteString("\r\n");

	switch (f.Command) {
	case 1:
		GPIO_ToggleBits(GPIOD, GPIO_Pin_12);
		break;
	case 2:
		GPIO_ToggleBits(GPIOD, GPIO_Pin_13);
		break;
	case 3:
		GPIO_ToggleBits(GPIOD, GPIO_Pin_14);
		break;
	case 4:
		GPIO_ToggleBits(GPIOD, GPIO_Pin_15);
		break;
	}
}
开发者ID:mbedproject,项目名称:NEC_DECODE,代码行数:26,代码来源:main.c


示例2: main

int main(void) {
///////// Initial Portion /////////////////////////
  init_USART1(9600); // initialize USART1 @ 9600 baud
	SystemCoreClockUpdate();                      /* Get Core Clock Frequency   */
  if (SysTick_Config(SystemCoreClock / 1000)) { /* SysTick 1 msec interrupts  */
    while (1);                                  /* Capture error              */
  }
  USART_puts(USART1, "Init 1 complete! Hello World!rn"); // just send a message to indicate that it works

		//Init GPIO for Leds on board and button input
	init_GPIO();
	
	/////////////////- Loop - ////////////////////////////////////
  while (1){
    
     // You can do whatever you want in here
		USART_puts(USART1, "Init 2 complete! Hello World! \r \n"); // just send a message to indicate that it works
				
		//GPIO_ToggleBits(GPIOD, GPIO_Pin_15 | GPIO_Pin_14 | GPIO_Pin_13| GPIO_Pin_12 );
		GPIO_ToggleBits(GPIOD, GPIO_Pin_12 ); //Test Leds on board
		Delay(200);
		GPIO_ToggleBits(GPIOD, GPIO_Pin_13 ); //Test Leds on board
		Delay(200);
		GPIO_ToggleBits(GPIOD, GPIO_Pin_14 ); //Test Leds on board
		Delay(1000);
     
  }
//////////////////////////////////////////////////////////	
}
开发者ID:taro10h,项目名称:STM32f4_Discovery_Learning,代码行数:29,代码来源:main.c


示例3: gpio_toggle

/*******************************************************************************
* Function Name  : gpio_toggle
* Description    : Toggle the value of a specified GPIO
* Input          : - Gpio: Select the GPIO to be toggled
* Output         : None
* Return         : None
*******************************************************************************/
void gpio_toggle(const _Gpio_Descriptor *Gpio)
{
  if (!Gpio) return;
  #ifdef _GPIO_I2CIO_SUPPORT
    if (gpio_is_i2c(Gpio)) i2cio_toggle_output(Gpio->Port, Gpio->GPIO_Pin);
    else GPIO_ToggleBits((GPIO_TypeDef *)Gpio->Port, Gpio->GPIO_Pin);
  #else
    GPIO_ToggleBits((GPIO_TypeDef *)Gpio->Port, Gpio->GPIO_Pin);
  #endif
}
开发者ID:lepton-distribution,项目名称:lepton-root.scions,代码行数:17,代码来源:gpio.c


示例4: TIMER32_0_IRQHandler

void TIMER32_0_IRQHandler()
{
    static unsigned int duty_counter_r = 0;
    static unsigned int duty_counter_g = 0;
    static unsigned int duty_counter_b = 0;
    static unsigned int bl_duty_counter = 0;

    static unsigned int period_counter = 0;
    static int activity_counter = 0;

    CoEnterISR();

    TIM_ClearIntPending(LPC_TMR32B0, TIM_MR0_INT);

    // 39.0625us activity indicator (for calibration)
    GPIO_ToggleBits(TIMER_ACTIVITY_PORT, TIMER_ACTIVITY_PIN);

    if( period_counter -- > 0 ) {
        if( duty_counter_r -- == 0 )
            GPIO_ResetBits(RED_PORT, RED_PIN);
        if( duty_counter_g -- == 0 )
            GPIO_ResetBits(GREEN_PORT, GREEN_PIN);
        if( duty_counter_b -- == 0 )
            GPIO_ResetBits(BLUE_PORT, BLUE_PIN);

        if (bl_duty_counter-- == 0)
            GPIO_ResetBits(LCD_BACKLITE_PORT, LCD_BACKLITE_PIN);
    }
    else {
        if( activity_counter ++ >= TICKS_PER_SECOND ) {
            activity_counter = 0;
            GPIO_ToggleBits(TIMER_ACTIVITY_PORT, TIMER_ACTIVITY_PIN);

            //if( device_mode == AMBIENT_TEMPERATURE )
            //    PLUGIN_Temperature_Update();
        }

        SEQ_Tick();
        duty_counter_r = SEQ_CurrentRed();
        duty_counter_r == 0 ? GPIO_ResetBits(RED_PORT, RED_PIN) : GPIO_SetBits(RED_PORT, RED_PIN);

        duty_counter_g = SEQ_CurrentGreen();
        duty_counter_g == 0 ? GPIO_ResetBits(GREEN_PORT, GREEN_PIN ) : GPIO_SetBits(GREEN_PORT, GREEN_PIN );

        duty_counter_b = SEQ_CurrentBlue();
        duty_counter_b == 0 ? GPIO_ResetBits(BLUE_PORT, BLUE_PIN ) : GPIO_SetBits(BLUE_PORT, BLUE_PIN );

        bl_duty_counter = backlite_power;
        bl_duty_counter == 0 ? GPIO_ResetBits(LCD_BACKLITE_PORT, LCD_BACKLITE_PIN) : GPIO_SetBits(LCD_BACKLITE_PORT, LCD_BACKLITE_PIN);

        period_counter = 255;
    }

    CoExitISR();
}
开发者ID:apkbox,项目名称:lpc_testbed,代码行数:55,代码来源:main.c


示例5: main

int main(void) {
    uint8_t c;
    /* System Init */
    SystemInit();

    /* Initialize LED's. Make sure to check settings for your board in tm_stm32f4_disco.h file */
    RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOG, ENABLE); //
    GPIO_InitTypeDef GPIO_InitDef;

    GPIO_InitDef.GPIO_Pin = GPIO_Pin_13 | GPIO_Pin_14; // we gaan pin 13 en 14 gebruiken

    GPIO_InitDef.GPIO_OType = GPIO_OType_PP;		// init push-pull
    GPIO_InitDef.GPIO_Mode = GPIO_Mode_OUT; 		// init output
    GPIO_InitDef.GPIO_PuPd = GPIO_PuPd_NOPULL;	// init no pullup
    GPIO_InitDef.GPIO_Speed = GPIO_Speed_100MHz;	// init 100 MHZ

    //Initialize pins
    GPIO_Init(GPIOG, &GPIO_InitDef);
    GPIO_ToggleBits(GPIOG, GPIO_Pin_13);


    /* Initialize USB VCP */
    TM_USB_VCP_Init();

    while (1) {
        /* USB configured OK, drivers OK */
        if (TM_USB_VCP_GetStatus() == TM_USB_VCP_CONNECTED) {
            /* Turn on GREEN led */
            //TM_DISCO_LedOn(LED_GREEN);
            //TM_DISCO_LedOff(LED_RED);
            /* If something arrived at VCP */
            if (TM_USB_VCP_Getc(&c) == TM_USB_VCP_DATA_OK) {
                /* Return data back */
                TM_USB_VCP_Putc('0' + (c /100) % 10);
                TM_USB_VCP_Putc('0' + (c /10) % 10);
                TM_USB_VCP_Putc('0' + c % 10);
                TM_USB_VCP_Putc(',');
                TM_USB_VCP_Putc(' ');
                GPIO_ToggleBits(GPIOG, GPIO_Pin_13 | GPIO_Pin_14);
            }
            else
            {
                //TM_USB_VCP_Putc(' ');
            }
        } else {
            /* USB not OK */
            //TM_DISCO_LedOff(LED_GREEN);
            //TM_DISCO_LedOn(LED_RED);
        }
    }
}
开发者ID:gilles951,项目名称:STM32F429_DISCOVERY,代码行数:51,代码来源:main.c


示例6: flipBuffers

void flipBuffers()
{
        char *tempBuffer = currentReadBuffer;
        currentReadBuffer = currentWriteBuffer;
        currentWriteBuffer = tempBuffer;
        read_ptr = currentReadBuffer;
        
        rxIndex = 0;
        countFlips += 1;
        
        GPIO_ToggleBits(GPIOD,  GPIO_Pin_11);
        GPIO_ToggleBits(GPIOD,  GPIO_Pin_11);
        
}
开发者ID:ahmedjafri,项目名称:EE478,代码行数:14,代码来源:main.c


示例7: blinkDebugLeds

//Rotina para exibir, visualmente, que os dispostivios foram iniciados
void blinkDebugLeds() {

	GPIO_ToggleBits(GPIOD, GPIO_Pin_12);

	delay(2500);

	GPIO_ToggleBits(GPIOD, GPIO_Pin_12);

	delay(2500);
	
	GPIO_ToggleBits(GPIOD, GPIO_Pin_13);

	delay(2500);

	GPIO_ToggleBits(GPIOD, GPIO_Pin_13);

	delay(2500);

	GPIO_ToggleBits(GPIOD, GPIO_Pin_14);

	delay(2500);

	GPIO_ToggleBits(GPIOD, GPIO_Pin_14);

	delay(2500);

	GPIO_ToggleBits(GPIOD, GPIO_Pin_15);

	delay(2500);

	GPIO_ToggleBits(GPIOD, GPIO_Pin_15);

	delay(2500);
}
开发者ID:kallegaro,项目名称:Quadcopter-Controller,代码行数:35,代码来源:main.c


示例8: LogA_ToggleActiveLED

void LogA_ToggleActiveLED(void)
{
	switch (LEDCurrentlyBlinking)
	{
		case LEDBlinking_Red_Slowly :
		case LEDBlinking_Red_Quickly :
			{
				GPIO_ToggleBits(LEDRED);
				GPIO_ResetBits(LEDORANGE);
				GPIO_ResetBits(LEDGREEN);
				GPIO_ResetBits(LEDBLUE);
			}
			break;
		case LEDBlinking_Orange_Slowly :
		case LEDBlinking_Orange_Quickly :
			{
				GPIO_ResetBits(LEDRED);
				GPIO_ToggleBits(LEDORANGE);
				GPIO_ResetBits(LEDGREEN);
				GPIO_ResetBits(LEDBLUE);
			}
			break;
		case LEDBlinking_Green_Slowly :
		case LEDBlinking_Green_Quickly :
			{
				GPIO_ResetBits(LEDRED);
				GPIO_ResetBits(LEDORANGE);
				GPIO_ToggleBits(LEDGREEN);
				GPIO_ResetBits(LEDBLUE);
			}
			break;
		case LEDBlinking_Blue_Slowly :
		case LEDBlinking_Blue_Quickly :
			{
				GPIO_ResetBits(LEDRED);
				GPIO_ResetBits(LEDORANGE);
				GPIO_ResetBits(LEDGREEN);
				GPIO_ToggleBits(LEDBLUE);
			}
			break;
		case LEDBlinking_ToggleAllFour :
		{
			GPIO_ToggleBits(LEDRED);
			GPIO_ToggleBits(LEDORANGE);
			GPIO_ToggleBits(LEDGREEN);
			GPIO_ToggleBits(LEDBLUE);
		}
		break;
		// Covers LEDBlinking_None
		default:
			{
				GPIO_ResetBits(LEDRED);
				GPIO_ResetBits(LEDORANGE);
				GPIO_ResetBits(LEDGREEN);
				GPIO_ResetBits(LEDBLUE);
			}
			break;
	}
}
开发者ID:useger,项目名称:src,代码行数:59,代码来源:LogA_LEDs.c


示例9: RxPacket

void RxPacket(void const *argument){
	uint8_t mode_filter, transmit_mode;
   //uint8_t buf;
	uint8_t buf;
	Packet pkt;
   GPIO_ResetBits(GPIOD, GPIO_Pin_12 | GPIO_Pin_13 | GPIO_Pin_14 | GPIO_Pin_15);
   mode_filter = 0x70;
   transmit_mode = 0x20;
	printf("Thread_started. waitig for signal\n");
   // put reciever in RX mode
	CC2500_Strobe(CC2500_STROBE_SRX, 0x00);
   
	while(1){
		int i;
		osSignalWait(RX_PKT, osWaitForever);
		
      //turn on LED on packet RX
		GPIO_ToggleBits(GPIOD, GPIO_Pin_12 | GPIO_Pin_13 | GPIO_Pin_14 | GPIO_Pin_15);
		CC2500_Read(&buf ,CC2500_FIFO_ADDR, 1); 
		//CC2500_RxPackets((uint8_t*)&pkt, CC2500_SETTING_PKTLEN + 2);
		printf("buf is %d \n", buf);

		if(pkt.Src_addr == 0x01){
			i++;
			 // put the measured RSSI in  byte 3 for main board
      pkt.Aux_rssi = pkt.Rssi;
      printf("%d Packet received from user beacon\n", i);
      printf("SRC: 0x%02x\t\t", pkt.Src_addr);
      printf("SEQ: 0x%02x\t\t", pkt.Seq_num);
      printf("RAW_RSSI: 0x%02x\n", pkt.Rssi);
			
			buf = CC2500_Strobe(CC2500_STROBE_SRX, 0x3F);
			printf("Buffer : 0x%02x\n", buf); 
		}
      
		
      // change the source address on the packet
      pkt.Src_addr = CC2500_SETTING_ADDR;
      
		// transmit this packet for main board
      osDelay(100);
      CC2500_TxPacket((uint8_t*)&pkt, CC2500_SETTING_PKTLEN);
		
      // turn off LED on successful Tx
      GPIO_ToggleBits(GPIOD, GPIO_Pin_12 | GPIO_Pin_13 | GPIO_Pin_14 | GPIO_Pin_15);
      // put device back to rx mode
      osDelay(100);
	}
}
开发者ID:rmursh,项目名称:MicroP-ECSE426,代码行数:49,代码来源:main.c


示例10: USART3_IRQHandler

// this is the interrupt request handler (IRQ) for ALL USART3 interrupts
void USART3_IRQHandler(void){

	// check if the USART3 receive interrupt flag was set
	if( USART_GetITStatus(USART3, USART_IT_RXNE) ){

		/*check the uart RX have accept the char*/
		GPIO_ToggleBits(GPIOD,GPIO_Pin_14);


		static uint8_t cnt = 0; // this counter is used to determine the uart receive string length

		//Receive_data = USART3->DR; // the character from the USART3 data register is saved in t
		Receive_data = USART_ReceiveData(USART3);;

		/* check if the received character is not the LF character (used to determine end of string) 
		 * or the if the maximum string length has been been reached 
		 */

		if( cnt < MAX_STRLEN){ 
			received_string[cnt] = Receive_data;
            if(Receive_data=='0') GPIO_ToggleBits(GPIOD,GPIO_Pin_15);

            /*start determine the period of command.*/
            if(received_string[cnt]=='\r'){
                Receive_String_Ready = 1; /*Ready to parse the command */
                cnt=0; /*restart to accept next stream message.*/
            }
            else{
                cnt++;
            }
		}
		else{ // over the max string length, cnt return to zero.
			Receive_String_Ready=1;
			cnt = 0;  
		}
		if(Receive_String_Ready){
			//print the content of the received string
			USART_puts(USART3, received_string);
			USART_puts(USART3,"\r\n");
			//receive_task();
			/*clear the received string and the flag*/
			Receive_String_Ready = 0;
			int i;
			for( i = 0 ; i< MAX_STRLEN ; i++){
				received_string[i]= 0;
			}
		}
	}
}
开发者ID:DanTsai2014,项目名称:STM32_SmallCarXJoystick,代码行数:50,代码来源:uart.c


示例11: tcp_rx_handler

void tcp_rx_handler(void)
{
  if(crc32((uint8_t*)&rx_tcp_msg+4,rx_tcp_msg.msg_len + TCP_HEADER_SIZE - 4) == rx_tcp_msg.msg_crc)
  {
    switch(rx_tcp_msg.msg_id)
    {
      case CHECK_CONNECT: 
           tcp_write(pout_pcb," соединение установлено",23,1);
           tcp_output(pout_pcb);
           tcp_sent(pout_pcb,NULL); 
      break;
      
      case SEND_FILE: 
        {
           int adr  = rx_tcp_msg.data[0];
           int size = rx_tcp_msg.msg_len - 1;
           memcpy(&buffer[adr][0],&rx_tcp_msg.data[1],size);
        }
      break;
      
      case SET_DATA_DAC: 
        {
           unsigned short data_temp = *((unsigned short*)&rx_tcp_msg.data[0]);
           for (int i = 0; i < 8192; i++) *(uint16_t *) (sram_bank4 + 0) =  data_temp;
           GPIO_ToggleBits(GPIOI, GPIO_Pin_0); 
        }
      break;
      

      case SEND_FILE_DONE: 
        {
          int adr,size;
          unsigned short *pbuffer = (unsigned short*)&buffer[0][0];
 
          adr  = rx_tcp_msg.data[0];
          size = rx_tcp_msg.msg_len - 1;
          memcpy(&buffer[adr][0],&rx_tcp_msg.data[1],size);
           
          for (int i = 0; i < 8192; i++) *(uint16_t *) (sram_bank4 + 0) = *(pbuffer++);
             
          GPIO_ToggleBits(GPIOI, GPIO_Pin_0); 
          
        } 
     
      break;
    }
  }
}
开发者ID:TSURKOVSERGEY,项目名称:meteo,代码行数:48,代码来源:tcp_rx_handler.c


示例12: main

int main(void)
{
  Timer_init();

  RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOD, ENABLE);
  GPIO_InitTypeDef  GPIO_InitStructure;
  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_12 |GPIO_Pin_13 | GPIO_Pin_14 | GPIO_Pin_15;
  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
  GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
  GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
  GPIO_Init(GPIOD, &GPIO_InitStructure);

  static uint32_t timerValue;
  uint32_t lastTime = TIM2->CNT;
  while (1)
  {
    timerValue = TIM2->CNT;

    if( timerValue - lastTime > 1000000 )
    {
      GPIO_ToggleBits(GPIOD, GPIO_Pin_12 |GPIO_Pin_13 | GPIO_Pin_14 | GPIO_Pin_15);
      lastTime = timerValue;
    }

  }
}
开发者ID:chansak79,项目名称:DataLoggerForMultirotor,代码行数:27,代码来源:main.c


示例13: main

int main(void)
{
  RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOD, ENABLE);

  /* Configure PD12, PD13, PD14 and PD15 in output pushpull mode */
  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_12 | GPIO_Pin_13| GPIO_Pin_14| GPIO_Pin_15;
  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
  GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
  GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
  GPIO_Init(GPIOD, &GPIO_InitStructure);

  uint8_t rec;
  spi_init();

  while (1)
  {
    GPIO_ToggleBits( GPIOD, GPIO_Pin_15 );
    GPIOC->BSRRH |= GPIO_Pin_4;
    rec = spi_send( 0xaa );

    GPIOC->BSRRL |= GPIO_Pin_4;
    Delay( 0xffff );
  }
}
开发者ID:rummanwaqar,项目名称:STM32F4_Examples,代码行数:25,代码来源:main.c


示例14: main

int main(void)
{
  uint8_t colorR =0 ,colorG =0 ,colorB =0 ;
  uint8_t colorR_dir =0 ,colorG_dir =0 ,colorB_dir =0 ;
  char lcd_text_buff[100];

  float GyX =0.0f, GyY =0.0f, GyZ =0.0f;
  float X_offset =0.0f,Y_offset =0.0f,Z_offset =0.0f;
  uint32_t i=0;
  float delay_count=1000.0f;

  GPIO_Configuration();
  USART1_Configuration();
  CANx_Config();
  CANx_NVIC_Config();
  lcd_init();
  lcd_drawBackground(20,60,250);
  lcd_drawBGPersimmon(20, 60, 250);


    LCD_SetColors(LCD_COLOR_WHITE-1,LCD_COLOR_WHITE);
    LCD_SetFont(&Font16x24);
    LCD_DisplayStringLine(LINE(1), (uint8_t*)" CAN Bus DEMO  ");
    DrawNeedle(120,120,60,300.0f,0.0f,200.0f);
  while (1)
  {
    CANx_Transmit();
    GPIO_ToggleBits(LED4);

    Delay_1us(1000);
  }
  
}
开发者ID:icylon,项目名称:STMF429_Learning,代码行数:33,代码来源:main.c


示例15: vLEDTask

void vLEDTask( void *pvParameters ) {
	const portTickType xDelay = 1000;
	while(1) {
		GPIO_ToggleBits(GPIOD, GPIO_Pin_12);
	    vTaskDelay(xDelay);
	}
}
开发者ID:quasarz,项目名称:FreeRTOS-Template,代码行数:7,代码来源:main.c


示例16: main

int main(void)
{
	// Set clock to 168MHz
	CLOCK_SetClockTo168MHz();
	// Delay initialization
	DELAY_Init();

	// Enable clock for GPIOD
	RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOD, ENABLE);
	// Initialize PD13 and PD15 as output for orange and blue LED
	GPIO_InitTypeDef GPIO_InitStruct;
	GPIO_InitStruct.GPIO_Mode = GPIO_Mode_OUT;
	GPIO_InitStruct.GPIO_OType = GPIO_OType_PP;
	GPIO_InitStruct.GPIO_Pin = GPIO_Pin_13 | GPIO_Pin_15;
	GPIO_InitStruct.GPIO_PuPd = GPIO_PuPd_NOPULL;
	GPIO_InitStruct.GPIO_Speed = GPIO_Speed_2MHz;
	GPIO_Init(GPIOD, &GPIO_InitStruct);

	// External interrupt initialization
	EXTI0_Init();

	while (1)
	{
		// Toggle blue LED (PD15) every 5s
		GPIO_ToggleBits(GPIOD, GPIO_Pin_15);
		DELAY_Ms(5000);
	}
}
开发者ID:yohanes-erwin,项目名称:stm32f4-gcc,代码行数:28,代码来源:main.c


示例17: main

int main()
{
  while(true){
    Reset();
    systickInit();
    gpioInit();
    adcInit();
    lcdInit();
    tsInit();
    welcomeScreen();
    #ifdef DEBUG
      ledInit();
    #endif
    spiInit();
    while(!IsRebootRequired()){
      if(IsSynchronizationRequired()){
        AssertGoBusIRQ();
      }
      #ifdef DEBUG
        GPIO_ToggleBits(GPIOC, GPIO_Pin_13);
        delay(5);
      #endif
    }
  }
}
开发者ID:fabienroyer,项目名称:NetduinoGo,代码行数:25,代码来源:main.c


示例18: main

int main(void)
{
    GPIO_InitTypeDef  GPIO_InitStructure;

    /* Enable GPIOG clock */
    LED_RCC_CLKCMD(LED_RCC_PERIPH, ENABLE);

    /* Configure LED pin in output mode */
    GPIO_InitStructure.GPIO_Pin   = LED_GPIO_PIN;
    GPIO_InitStructure.GPIO_Mode  = GPIO_Mode_OUT;
    GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
    GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
    GPIO_InitStructure.GPIO_PuPd  = GPIO_PuPd_NOPULL;

    GPIO_Init(LED_GPIO_PORT, &GPIO_InitStructure);
    GPIO_SetBits(LED_GPIO_PORT, LED_GPIO_PIN);

    /* configure systick to interrupt every 1ms */
    if (SysTick_Config(SystemCoreClock / 1000)) {
        while(1);
    }

    /* Do nothing */
    while (1) {
        /* wait 500ms */
        systick_sleep(500);

        /* Toggle LED */
        GPIO_ToggleBits(LED_GPIO_PORT, LED_GPIO_PIN);
    }
}
开发者ID:andrecurvello,项目名称:stm32f4xx,代码行数:31,代码来源:main.c


示例19: VCP_DataTx

 */
static uint16_t VCP_DataTx(uint8_t* Buf, uint32_t Len) {
	uint32_t i = 0;

	GPIO_ToggleBits(LED3_GPIO_PORT, LED3_PIN);

	//If no buffer, we're supposed to receive USART, send USB
//   if (Buf==NULL) {
//      if (g_lc.datatype == 7)
//         APP_Rx_Buffer[APP_Rx_ptr_in] = USART_ReceiveData(DISCOVERY_COM) & 0x7F;
//      else if (g_lc.datatype == 8)
//         APP_Rx_Buffer[APP_Rx_ptr_in] = USART_ReceiveData(DISCOVERY_COM);
//
//      APP_Rx_ptr_in++;
//
//      /* To avoid buffer overflow */
//      if(APP_Rx_ptr_in == APP_RX_DATA_SIZE)
//         APP_Rx_ptr_in = 0;
//   }
//   else

	if (Buf) {      //If we were passed a buffer, transmit that
		while (i < Len) {
			APP_Rx_Buffer[APP_Rx_ptr_in] = *(Buf + i);
			APP_Rx_ptr_in++;
			i++;

			/* To avoid buffer overflow */
			if (APP_Rx_ptr_in == APP_RX_DATA_SIZE)
				APP_Rx_ptr_in = 0;
		}
	}

	return USBD_OK;
开发者ID:jgdo,项目名称:arips_dev,代码行数:34,代码来源:usbd_cdc_vcp.c


示例20: pick_port

void GPIO< port, pin >::toggle()
{
    constexpr auto m_port = pick_port(port);
    constexpr auto m_pin  = pick_pin(pin);

    GPIO_ToggleBits(m_port, m_pin);
}
开发者ID:GamovCoder,项目名称:theCore,代码行数:7,代码来源:gpio_device.hpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ GPIO_VREG函数代码示例发布时间:2022-05-30
下一篇:
C++ GPIO_StructInit函数代码示例发布时间: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