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

C++ HAL_GPIO_TogglePin函数代码示例

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

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



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

示例1: main

int main(void)
{

  int i;

  HAL_Init();
  SystemClock_Config();

  __GPIOC_CLK_ENABLE();

  // LEDs on Discovery F0
  GPIO_InitTypeDef GPIO_InitTypeDefStruct;
  GPIO_InitTypeDefStruct.Pin = GPIO_PIN_9 | GPIO_PIN_8;
  GPIO_InitTypeDefStruct.Mode= GPIO_MODE_OUTPUT_PP;
  GPIO_InitTypeDef* GPIO_Init= & GPIO_InitTypeDefStruct;
  HAL_GPIO_Init(GPIOC,GPIO_Init);



    while (1) {
	for (i = 1000000; i > 0; i--);
        HAL_GPIO_TogglePin(GPIOC, GPIO_PIN_9);
        HAL_GPIO_TogglePin(GPIOC, GPIO_PIN_8);
    }



  /* Infinite loop */
  exit (1);
}
开发者ID:Xinxin19871118,项目名称:stm32-codeblocks,代码行数:30,代码来源:main.c


示例2: send

void send(uint8_t status, uint8_t* buffer, uint8_t buffer_length) {
  uint8_t transmitBuffer[UART_command_length + 1];
  transmitBuffer[0] = MORE_DATA;
  uint8_t total_transmitted = 0;
  while (total_transmitted < buffer_length) {
    if (buffer_length - total_transmitted <= UART_command_length) {
      transmitBuffer[0] = status;
    }
    for (int i = 0; i < UART_command_length; i++) {
      if (total_transmitted < buffer_length) {
        transmitBuffer[i+1] = buffer[total_transmitted];
      } else {
        transmitBuffer[i+1] = 0;
      }
      total_transmitted++;
    }
    if (HAL_UART_Transmit(&hUART, (unsigned char*) transmitBuffer, UART_command_length + 1, 1000) != HAL_OK) {
      Output_High(FAIL_LED_GPIOx, FAIL_LED_Pin);
      Output_High(BUSY_LED_GPIOx, BUSY_LED_Pin);
      for (int i = 0; i < 10; i++) {
        HAL_GPIO_TogglePin(FAIL_LED_GPIOx, FAIL_LED_Pin);
        HAL_GPIO_TogglePin(BUSY_LED_GPIOx, BUSY_LED_Pin);
        HAL_Delay(50);
      }
    }
    HAL_Delay(100);
  }
}
开发者ID:chickadee-tech,项目名称:g-test-bot,代码行数:28,代码来源:main.cpp


示例3: main

/**
  * @brief  Main program
  * @param  None
  * @retval None
  */
int main(void)
{
  /* This sample code shows how to use GPIO HAL API to toggle LED1, LED2, LED3 and LED4 IOs
    in an infinite loop. */

  /* STM32F3xx HAL library initialization:
       - Configure the Flash prefetch
       - Systick timer is configured by default as source of time base, but user 
         can eventually implement his proper time base source (a general purpose 
         timer for example or other time source), keeping in mind that Time base 
         duration should be kept 1ms since PPP_TIMEOUT_VALUEs are defined and 
         handled in milliseconds basis.
       - Set NVIC Group Priority to 4
       - Low Level Initialization
     */
  HAL_Init();

  /* Configure the system clock to 72 MHz */
  SystemClock_Config();
  
  /* -1- Enable each GPIO Clock (to be able to program the configuration registers) */
  LED1_GPIO_CLK_ENABLE();
  LED2_GPIO_CLK_ENABLE();
  LED3_GPIO_CLK_ENABLE();
  LED4_GPIO_CLK_ENABLE();

  /* -2- Configure IOs in output push-pull mode to drive external LEDs */
  GPIO_InitStruct.Mode  = GPIO_MODE_OUTPUT_PP;
  GPIO_InitStruct.Pull  = GPIO_PULLUP;
  GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;

  GPIO_InitStruct.Pin = LED1_PIN;
  HAL_GPIO_Init(LED1_GPIO_PORT, &GPIO_InitStruct);

  GPIO_InitStruct.Pin = LED2_PIN;
  HAL_GPIO_Init(LED2_GPIO_PORT, &GPIO_InitStruct);

  GPIO_InitStruct.Pin = LED3_PIN;
  HAL_GPIO_Init(LED3_GPIO_PORT, &GPIO_InitStruct);

  GPIO_InitStruct.Pin = LED4_PIN;
  HAL_GPIO_Init(LED4_GPIO_PORT, &GPIO_InitStruct);

  /* -3- Toggle IOs in an infinite loop */
  while (1)
  {
    HAL_GPIO_TogglePin(LED1_GPIO_PORT, LED1_PIN);
    /* Insert delay 100 ms */
    HAL_Delay(100);
    HAL_GPIO_TogglePin(LED2_GPIO_PORT, LED2_PIN);
    /* Insert delay 100 ms */
    HAL_Delay(100);
    HAL_GPIO_TogglePin(LED3_GPIO_PORT, LED3_PIN);
    /* Insert delay 100 ms */
    HAL_Delay(100);
    HAL_GPIO_TogglePin(LED4_GPIO_PORT, LED4_PIN);
    /* Insert delay 100 ms */
    HAL_Delay(100);
  }
}
开发者ID:PaxInstruments,项目名称:STM32CubeF3,代码行数:65,代码来源:main.c


示例4: main

int main(void)
{
  uint32_t bootStatus;
  
  /* MCU Configuration----------------------------------------------------------*/
  
  /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
  HAL_Init();
  
  /* Configure the system clock */
  SystemClock_Config();
  
  /* Initialize all configured peripherals */
  MX_GPIO_Init();
  
  /* Turn on led Init */
  HAL_GPIO_WritePin(GPIOE, GPIO_PIN_12|GPIO_PIN_13, GPIO_PIN_RESET);
  
  /* Wait for timeout */
  bootStatus = bootWait(5000);
  
  /* Turn off led */
  HAL_GPIO_WritePin(GPIOE, GPIO_PIN_12|GPIO_PIN_13, GPIO_PIN_SET);
  
  /* Check for Result */
  if(bootStatus == 0)
  {
    /* Test if user code is programmed starting from address USBD_DFU_APP_DEFAULT_ADD */
    if(((*(__IO uint32_t*)USBD_DFU_APP_DEFAULT_ADD) & 0x2FFE0000 ) == 0x20000000)
    {
      /* Jump to user application */
      JumpAddress = *(__IO uint32_t*) (USBD_DFU_APP_DEFAULT_ADD + 4);
      JumpToApplication = (pFunction) JumpAddress;
      
      /* Initialize user application's Stack Pointer */
      __set_MSP(*(__IO uint32_t*) USBD_DFU_APP_DEFAULT_ADD);
      JumpToApplication();
    }
    
    /* load application failed */
    while (1)
    {
      HAL_Delay(50);
      HAL_GPIO_TogglePin(GPIOE, GPIO_PIN_12|GPIO_PIN_13);
    }
  }
  
  /* Init Device Library,Add Supported Class and Start the library*/
  USBD_Init(&hUsbDeviceFS, &FS_Desc, DEVICE_FS);
  USBD_RegisterClass(&hUsbDeviceFS, &USBD_DFU);
  USBD_DFU_RegisterMedia(&hUsbDeviceFS, &USBD_DFU_fops_FS);
  USBD_Start(&hUsbDeviceFS);
  
  /* Infinite loop */
  while (1)
  {
    HAL_Delay(500);
    HAL_GPIO_TogglePin(GPIOE, GPIO_PIN_13);
  }
}
开发者ID:loopedison,项目名称:mFlight,代码行数:60,代码来源:main.c


示例5: main

int main(void)
{
  /* USER CODE BEGIN 1 */

  /* USER CODE END 1 */


  /* USER CODE BEGIN 2 */
  /* USER CODE END 2 */

  /* Infinite loop */
  /* USER CODE BEGIN WHILE */
  while (1)
  {
      HAL_GPIO_TogglePin(GPIOB, GPIO_PIN_2);
      HAL_Delay(100);
      HAL_GPIO_TogglePin(GPIOE, GPIO_PIN_8);
      HAL_Delay(100);

  /* USER CODE END WHILE */

  /* USER CODE BEGIN 3 */

  }
  /* USER CODE END 3 */

}
开发者ID:Montanari9,项目名称:STM32L4_Short,代码行数:27,代码来源:lab1_blinky.c


示例6: can2RxCpltCallback

/**
  * @brief  Rx Transfer completed callback
  * @param  None
  * @retval None
  */
void can2RxCpltCallback()
{
//	if ((CAN_Handle.pRxMsg->StdId == 0x321) && (CAN_Handle.pRxMsg->IDE == CAN_ID_STD) && (CAN_Handle.pRxMsg->DLC == 2))
//	{
//		HAL_GPIO_TogglePin(GPIOC, GPIO_PIN_3);
//		volatile uint8_t test1 = CAN_Handle.pRxMsg->Data[0];
//		volatile uint8_t test2 = CAN_Handle.pRxMsg->Data[1];
//	}

	if (prvRxBuffer1State != CANBufferState_Reading && prvRxBuffer1Count < RX_BUFFER_SIZE)
	{
		HAL_GPIO_TogglePin(GPIOC, GPIO_PIN_3);
		prvRxBuffer1State = CANBufferState_Writing;
		/* Save the message */
		prvRxBuffer1[prvRxBuffer1CurrentIndex].id = CAN_Handle.pRxMsg->StdId;
		prvRxBuffer1[prvRxBuffer1CurrentIndex].dlc = CAN_Handle.pRxMsg->DLC;
		for (uint32_t i = 0; i < CAN_Handle.pRxMsg->DLC; i++)
			prvRxBuffer1[prvRxBuffer1CurrentIndex].data[i] = CAN_Handle.pRxMsg->Data[i];

		/* Increment the counters */
		prvRxBuffer1CurrentIndex++;
		prvRxBuffer1Count++;

		/* Start the timer which will clear the buffer if it's not already started */
		if (xTimerIsTimerActive(prvBuffer1ClearTimer) == pdFALSE)
			xTimerStartFromISR(prvBuffer1ClearTimer, NULL);
	}
	else if (prvRxBuffer2State != CANBufferState_Reading && prvRxBuffer2Count < RX_BUFFER_SIZE)
	{
		HAL_GPIO_TogglePin(GPIOC, GPIO_PIN_3);
		prvRxBuffer2State = CANBufferState_Writing;
		/* Save the message */
		prvRxBuffer2[prvRxBuffer1CurrentIndex].id = CAN_Handle.pRxMsg->StdId;
		prvRxBuffer2[prvRxBuffer1CurrentIndex].dlc = CAN_Handle.pRxMsg->DLC;
		for (uint32_t i = 0; i < CAN_Handle.pRxMsg->DLC; i++)
			prvRxBuffer2[prvRxBuffer1CurrentIndex].data[i] = CAN_Handle.pRxMsg->Data[i];

		/* Increment the counters */
		prvRxBuffer2CurrentIndex++;
		prvRxBuffer2Count++;

		/* Start the timer which will clear the buffer if it's not already started */
		if (xTimerIsTimerActive(prvBuffer2ClearTimer) == pdFALSE)
			xTimerStartFromISR(prvBuffer2ClearTimer, NULL);
	}
	else
	{
		/* No buffer available, something has gone wrong */
		HAL_GPIO_TogglePin(GPIOC, GPIO_PIN_3);
	}


	/* Receive */
	if (HAL_CAN_Receive_IT(&CAN_Handle, CAN_FIFO1) != HAL_OK)
	{
		/* Reception Error */
//		Error_Handler();
	}
}
开发者ID:hampussandberg,项目名称:HexConnect,代码行数:64,代码来源:can2_task.c


示例7: HAL_ADC_ConvCpltCallback

void HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef* AdcHandle)
{	
	HAL_GPIO_TogglePin(GPIOB, GPIO_PIN_9);
	HAL_ADC_Stop_DMA(&g_AdcHandle);
	osSignalSet(tid_TH_GUI,DMA_ConvCpltSig);
	HAL_GPIO_TogglePin(GPIOB, GPIO_PIN_9);
	//GPIOB->ODR ^= GPIO_PIN_9; // this is just for test of DMA speed
}
开发者ID:AdrK,项目名称:STM32F7_ADC_DMA_LCD,代码行数:8,代码来源:ADC+Config.c


示例8: main

/**
  * @brief  Main program
  * @param  None
  * @retval None
  */
int main(void)
{
    /* STM32F2xx HAL library initialization:
         - Configure the Flash prefetch, instruction and Data caches
         - Configure the Systick to generate an interrupt each 1 msec
         - Set NVIC Group Priority to 4
         - Global MSP (MCU Support Package) initialization
       */
    HAL_Init();

    /* Configure the system clock to 120 MHz */
    SystemClock_Config();

    /* -1- Enable GPIOG, GPIOC and GPIOI Clock (to be able to program the configuration registers) */
    __HAL_RCC_GPIOG_CLK_ENABLE();
    __HAL_RCC_GPIOC_CLK_ENABLE();
    __HAL_RCC_GPIOI_CLK_ENABLE();

    /* -2- Configure PG.6, PG.8, PI.9 and PC.7 IOs in output push-pull mode to
           drive external LEDs */
    GPIO_InitStruct.Pin = (GPIO_PIN_6 | GPIO_PIN_8);
    GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
    GPIO_InitStruct.Pull = GPIO_PULLUP;
    GPIO_InitStruct.Speed = GPIO_SPEED_FAST;

    HAL_GPIO_Init(GPIOG, &GPIO_InitStruct);

    GPIO_InitStruct.Pin = GPIO_PIN_9;
    GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
    GPIO_InitStruct.Pull = GPIO_PULLUP;
    GPIO_InitStruct.Speed = GPIO_SPEED_FAST;

    HAL_GPIO_Init(GPIOI, &GPIO_InitStruct);

    GPIO_InitStruct.Pin = GPIO_PIN_7;
    GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
    GPIO_InitStruct.Pull = GPIO_PULLUP;
    GPIO_InitStruct.Speed = GPIO_SPEED_FAST;

    HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);

    /* -3- Toggle PG.6, PG.8, PI.9 and PC.7 IOs in an infinite loop */
    while (1)
    {
        HAL_GPIO_TogglePin(GPIOG, GPIO_PIN_6);
        /* Insert delay 100 ms */
        HAL_Delay(100);
        HAL_GPIO_TogglePin(GPIOG, GPIO_PIN_8);
        /* Insert delay 100 ms */
        HAL_Delay(100);
        HAL_GPIO_TogglePin(GPIOI, GPIO_PIN_9);
        /* Insert delay 100 ms */
        HAL_Delay(100);
        HAL_GPIO_TogglePin(GPIOC, GPIO_PIN_7);
        /* Insert delay 100 ms */
        HAL_Delay(100);
    }
}
开发者ID:PaxInstruments,项目名称:STM32CubeF2,代码行数:63,代码来源:main.c


示例9: main

int main(void)
{

  /* USER CODE BEGIN 1 */
	char ADC_Tx_Data[70];
  /* USER CODE END 1 */

  /* MCU Configuration----------------------------------------------------------*/

  /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
  HAL_Init();

  /* Configure the system clock */
  SystemClock_Config();

  /* Initialize all configured peripherals */
  MX_GPIO_Init();
  MX_DMA_Init();
  MX_ADC1_Init();
  MX_USART1_UART_Init();

  /* USER CODE BEGIN 2 */
	
	HAL_UART_Receive_IT(&huart1, (uint8_t *)Rx_Data, 1);
	HAL_ADC_Start_DMA(&hadc1, (uint32_t*)&ADC_Value, 6);

  /* USER CODE END 2 */

  /* Infinite loop */
  /* USER CODE BEGIN WHILE */
  while (1)
  {
		HAL_Delay(15);
		HAL_GPIO_TogglePin(GPIOC, GPIO_PIN_4);
		HAL_Delay(15);
		HAL_GPIO_TogglePin(GPIOC, GPIO_PIN_0);	
		HAL_Delay(15);
		HAL_GPIO_TogglePin(GPIOC, GPIO_PIN_1);	
		HAL_Delay(15);
		HAL_GPIO_TogglePin(GPIOC, GPIO_PIN_2);	
		HAL_Delay(15);		
	  sprintf(ADC_Tx_Data,"ADC1:%4d\tADC2:%4d\tADC3:%4d\tADC4:%4d\tADC5:%4d\tADC6:%4d\n\r", ADC_Value[0], ADC_Value[1], ADC_Value[2], ADC_Value[3], ADC_Value[4], ADC_Value[5]);
		HAL_UART_Transmit_IT(&huart1, (uint8_t *)ADC_Tx_Data, 70);
			
  /* USER CODE END WHILE */

  /* USER CODE BEGIN 3 */

  }
  /* USER CODE END 3 */

}
开发者ID:Bit-Embedded-3,项目名称:smart_glove,代码行数:52,代码来源:main.c


示例10: main

int main(void) {

    /* USER CODE BEGIN 1 */

    /* USER CODE END 1 */

    /* MCU Configuration----------------------------------------------------------*/

    /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
    HAL_Init();

    /* Configure the system clock */
    SystemClock_Config();

    /* Initialize all configured peripherals */
    MX_GPIO_Init();
    MX_DMA_Init();
    MX_USART3_UART_Init();
    MX_TIM2_Init();

    /* USER CODE BEGIN 2 */
    nec.timerHandle = &htim2;

    nec.timerChannel = TIM_CHANNEL_1;
    nec.timerChannelActive = HAL_TIM_ACTIVE_CHANNEL_1;

    nec.timingBitBoundary = 1680;
    nec.timingAgcBoundary = 12500;
    nec.type = NEC_NOT_EXTENDED;

    nec.NEC_DecodedCallback = myNecDecodedCallback;
    nec.NEC_ErrorCallback = myNecErrorCallback;
    nec.NEC_RepeatCallback = myNecRepeatCallback;

    NEC_Read(&nec);
    /* USER CODE END 2 */

    /* Infinite loop */
    /* USER CODE BEGIN WHILE */
    while (1) {
        /* USER CODE END WHILE */

        /* USER CODE BEGIN 3 */
        HAL_GPIO_TogglePin(GPIOD, GPIO_PIN_12);
        HAL_Delay(100);
        HAL_GPIO_TogglePin(GPIOD, GPIO_PIN_13);
        HAL_Delay(100);
    }
    /* USER CODE END 3 */

}
开发者ID:Ribster,项目名称:STM32_NEC_Decode,代码行数:51,代码来源:main.c


示例11: main

/**
  * @brief  Main program
  * @param  None
  * @retval None
  */
int main(void)
{
  /* STM32F4xx HAL library initialization:
       - Configure the Flash prefetch, instruction and Data caches
       - Configure the Systick to generate an interrupt each 1 msec
       - Set NVIC Group Priority to 4
       - Global MSP (MCU Support Package) initialization
     */
  HAL_Init();
  
  /* Configure the system clock to 100 MHz */
  SystemClock_Config();
  
  /*##-1- Enable GPIOA Clock (to be able to program the configuration registers) */
  __HAL_RCC_GPIOA_CLK_ENABLE();
  
  /*##-2- Configure PA05 IO in output push-pull mode to drive external LED ###*/  
  GPIO_InitStruct.Pin = GPIO_PIN_5;
  GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
  GPIO_InitStruct.Pull = GPIO_PULLUP;
  GPIO_InitStruct.Speed = GPIO_SPEED_FAST;
  HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); 
   
  /*##-3- Toggle PA05 IO in an infinite loop #################################*/  
  while (1)
  {
    HAL_GPIO_TogglePin(GPIOA, GPIO_PIN_5);
    
    /* Insert a 100ms delay */
    HAL_Delay(100);
  }
}
开发者ID:eemei,项目名称:library-stm32f4,代码行数:37,代码来源:main.c


示例12: LED_Thread1

static void LED_Thread1(void const *argument)
{
	GPIO_InitTypeDef GPIO_InitStruct_LED, GPIO_InitStruct_BUTTON;

	/* GPIO Ports Clock Enable */
	__GPIOI_CLK_ENABLE();

	/*Configure GPIO pin : PI1 */
	GPIO_InitStruct_LED.Pin = GPIO_PIN_1;
	GPIO_InitStruct_LED.Mode = GPIO_MODE_OUTPUT_PP;
	GPIO_InitStruct_LED.Pull = GPIO_NOPULL;
	GPIO_InitStruct_LED.Speed = GPIO_SPEED_LOW;
	HAL_GPIO_Init(GPIOI, &GPIO_InitStruct_LED);

	GPIO_InitStruct_BUTTON.Pin = GPIO_PIN_11;
	GPIO_InitStruct_BUTTON.Mode = GPIO_MODE_INPUT;
	GPIO_InitStruct_BUTTON.Pull = GPIO_PULLUP;
	HAL_GPIO_Init(GPIOI, &GPIO_InitStruct_BUTTON);

	while(1)
	{
		if(HAL_GPIO_ReadPin(GPIOI, GPIO_PIN_11)){
			HAL_GPIO_TogglePin(GPIOI, GPIO_PIN_1);
			HAL_Delay(500);
			printf("Pintando \n");
		}
		HAL_GPIO_WritePin(GPIOI, GPIO_PIN_1, 0);

	}
}
开发者ID:aescacena,项目名称:stm32f7,代码行数:30,代码来源:main.c


示例13: myNecRepeatCallback

void myNecRepeatCallback() {
    char* msg = "Repeat!\n";
    HAL_UART_Transmit_DMA(&huart3, (uint8_t*) msg, strlen(msg));
    HAL_GPIO_TogglePin(GPIOD, GPIO_PIN_15);
    HAL_Delay(10);
    NEC_Read(&nec);
}
开发者ID:Ribster,项目名称:STM32_NEC_Decode,代码行数:7,代码来源:main.c


示例14: rs232RxCpltCallback

/**
  * @brief  Rx Transfer completed callback
  * @param  None
  * @retval None
  */
void rs232RxCpltCallback()
{
	if (prvRxBuffer1State != BUFFERState_Reading && prvRxBuffer1Count < RX_BUFFER_SIZE)
	{
		prvRxBuffer1State = BUFFERState_Writing;
		prvRxBuffer1[prvRxBuffer1CurrentIndex++] = prvReceivedByte;
		prvRxBuffer1Count++;
		/* Start the timer which will clear the buffer if it's not already started */
		if (xTimerIsTimerActive(prvBuffer1ClearTimer) == pdFALSE)
			xTimerStartFromISR(prvBuffer1ClearTimer, NULL);
	}
	else if (prvRxBuffer2State != BUFFERState_Reading && prvRxBuffer2Count < RX_BUFFER_SIZE)
	{
		prvRxBuffer2State = BUFFERState_Writing;
		prvRxBuffer2[prvRxBuffer2CurrentIndex++] = prvReceivedByte;
		prvRxBuffer2Count++;
		/* Start the timer which will clear the buffer if it's not already started */
		if (xTimerIsTimerActive(prvBuffer2ClearTimer) == pdFALSE)
			xTimerStartFromISR(prvBuffer2ClearTimer, NULL);
	}
	else
	{
		/* No buffer available, something has gone wrong */
		HAL_GPIO_TogglePin(GPIOC, GPIO_PIN_3);
	}

	/* Continue receiving data */
	HAL_UART_Receive_IT(&UART_Handle, &prvReceivedByte, 1);
	/* Give back the semaphore now that we are done */
	xSemaphoreGiveFromISR(xSemaphore, NULL);
}
开发者ID:efimefimefim,项目名称:HexConnect,代码行数:36,代码来源:rs232_task.c


示例15: main

int main(void)
{
    HAL_Init();

    led_gpio_init();

    SystemClock_Config();

    mima_init();

    usbKB_init();

    USBD_Init(&USBD_Device, &HID_Desc, 0);

    USBD_RegisterClass(&USBD_Device, USBD_HID_CLASS);

    USBD_CUSTOM_HID_RegisterInterface(&USBD_Device, &USBD_CustomHID_fops);

    USBD_Start(&USBD_Device);

    HAL_Delay(1000);
    USB_KB_type("Hello world", 11);

    while(1) {
        HAL_GPIO_TogglePin(GPIOB, GPIO_PIN_7);
        mima_loop();
    }
}
开发者ID:apeng2012,项目名称:mi_ma_bao,代码行数:28,代码来源:main.c


示例16: digitalToggle

void digitalToggle( uint32_t ulPin )
{
    if ( digitalPinToPort(ulPin) == NULL ) {
        return ;
    }
    HAL_GPIO_TogglePin(digitalPinToPort(ulPin), digitalPinToBitMask(ulPin));
}
开发者ID:evark,项目名称:cbp-halmx,代码行数:7,代码来源:wiring_digital.c


示例17: Thread_LED

 /*----------------------------------------------------------------------------
*      Thread  'LED_Thread': Toggles LED
 *---------------------------------------------------------------------------*/
	void Thread_LED (void const *argument) {
		while(1){
				osDelay(200);
				//printf("LED");
				HAL_GPIO_TogglePin(GPIOD, GPIO_PIN_12);
		}
	}
开发者ID:deepaks4077,项目名称:426-microprcessors,代码行数:10,代码来源:Thread_LED.c


示例18: HAL_TIM_PWM_PulseFinishedCallback

// The following is never bing called:
void  HAL_TIM_PWM_PulseFinishedCallback (TIM_HandleTypeDef *htim)
{
  if ((htim->Instance == easySPIN_TIMER_PWM1) && (htim->Channel == easySPIN_HAL_ACT_CHAN_TIMER_PWM1))
    {
      if (EasySpin_GetDeviceState(0) != INACTIVE)
         {
           EasySpin_StepClockHandler(0);
         }
    }

  if ((htim->Instance == easySPIN_TIMER_PWM2) && (htim->Channel == easySPIN_HAL_ACT_CHAN_TIMER_PWM2))
    {
      if (EasySpin_GetDeviceState(1) != INACTIVE)
         {
           EasySpin_StepClockHandler(1);
         }
   }

  if ((htim->Instance == easySPIN_TIMER_PWM3) && (htim->Channel == easySPIN_HAL_ACT_CHAN_TIMER_PWM3))
    {
      HAL_GPIO_TogglePin(easySPIN_PWM_3_PORT, easySPIN_PWM_3_PIN);
      if (EasySpin_GetDeviceState(2) != INACTIVE)
         {
           EasySpin_StepClockHandler(2);
         }
    }
}
开发者ID:GrandviewIoT,项目名称:Industrial_IoT_Projects,代码行数:28,代码来源:main_easyspin_stepper.c


示例19: main

int main(void)
{

  /* USER CODE BEGIN 1 */

  /* USER CODE END 1 */

  /* MCU Configuration----------------------------------------------------------*/

  /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
  HAL_Init();

  /* Configure the system clock */
  SystemClock_Config();

  /* Initialize all configured peripherals */
  MX_GPIO_Init();
  //MX_TIM3_Init();
  //MX_TIM4_Init();

  //HAL_TIM_Base_Start(&htim3);
  //HAL_TIM_Base_Start(&htim4);
  //HAL_TIM_PWM_Start(&htim3, TIM_CHANNEL_3);
  //HAL_TIM_PWM_Start(&htim3, TIM_CHANNEL_4);
  //HAL_TIM_PWM_Start(&htim4, TIM_CHANNEL_2);

  HAL_GPIO_WritePin(Led_gpio,Led_pin,GPIO_PIN_SET);
  HAL_Delay(1000);
  HAL_GPIO_WritePin(Led_gpio,Led_pin,GPIO_PIN_RESET);

  HAL_GPIO_WritePin(DcCal_gpio,DcCal_pin,GPIO_PIN_RESET);
  

  char state;
  int cnt;
  cnt = HAL_GetTick();
  while (1)
  {
    state = HAL_GPIO_ReadPin(sens_gpio,sens_ph1_pin);
    state = state << 1;
    state |= HAL_GPIO_ReadPin(sens_gpio,sens_ph2_pin);
    state = state << 1;
    state |= HAL_GPIO_ReadPin(sens_gpio,sens_ph3_pin);

    ApplyPhaseSolid(state);
    if(HAL_GetTick()>1000+cnt) {
      HAL_GPIO_TogglePin(EnGate_gpio,EnGate_pin);
      cnt = HAL_GetTick();
    }

//      if(TIM3->CCR3<200)
//        TIM3->CCR3++;
//      else
//        TIM3->CCR3=0;
//
//      HAL_Delay(20);
  }
  /* USER CODE END 3 */

}
开发者ID:sinaaghli,项目名称:STM32DT,代码行数:60,代码来源:main.c


示例20: vLEDFlashTask

static void vLEDFlashTask( void *pvParameters )
{

	for(;;)
	{
		/* Delay for half the flash period then turn the LED on. */
		//vTaskDelayUntil( &xLastFlashTime, xFlashRate );
		vTaskDelay(500/portTICK_RATE_MS);
		HAL_GPIO_TogglePin(GPIOD, GPIO_PIN_13);

		/* Delay for half the flash period then turn the LED off. */
		//vTaskDelayUntil( &xLastFlashTime, xFlashRate );
		vTaskDelay(500/portTICK_RATE_MS);
		HAL_GPIO_TogglePin(GPIOD, GPIO_PIN_13);
	}
}
开发者ID:khjtony,项目名称:TinyCar_TypeNeg1,代码行数:16,代码来源:flash.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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