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

C++ HAL_GPIO_ReadPin函数代码示例

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

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



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

示例1: 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


示例2: TIM3_IRQHandler

/**
* @brief This function handles TIM3 global interrupt.
*/
void TIM3_IRQHandler(void)
{
  /* USER CODE BEGIN TIM3_IRQn 0 */


	int i;
	if(btnDebounceIRQTimer[0]>debounceDelay){
		btnDebounceIRQTimer[0] = 0;
		if(HAL_GPIO_ReadPin(GPIOE,GPIO_PIN_10)) irqflag_btns[0] = 1;
	}
	else if(btnDebounceIRQTimer[0] > 0) btnDebounceIRQTimer[0] ++;

	if(btnDebounceIRQTimer[1]>debounceDelay){
			btnDebounceIRQTimer[1] = 0;
			if(HAL_GPIO_ReadPin(GPIOE,GPIO_PIN_11)) irqflag_btns[1] = 1;
		}
		else if(btnDebounceIRQTimer[1] > 0) btnDebounceIRQTimer[1] ++;

	if(btnDebounceIRQTimer[2]>debounceDelay){
			btnDebounceIRQTimer[2] = 0;
			if(HAL_GPIO_ReadPin(GPIOE,GPIO_PIN_12)) irqflag_btns[2] = 1;
		}
		else if(btnDebounceIRQTimer[2] > 0) btnDebounceIRQTimer[2] ++;



  /* USER CODE END TIM3_IRQn 0 */
  HAL_TIM_IRQHandler(&htim3);
  /* USER CODE BEGIN TIM3_IRQn 1 */
  /* USER CODE END TIM3_IRQn 1 */
}
开发者ID:rschrader,项目名称:voltdrum_mcu,代码行数:34,代码来源:stm32f3xx_it.c


示例3: AD7190_PowerDown

void AD7190_PowerDown()
{
	uint8_t mode[4] = {0x68,0x04,0x00,0x01};
	int i = 0;
	while(!HAL_GPIO_ReadPin(GPIOC,GPIO_PIN_11) && i<50000);
	while(HAL_GPIO_ReadPin(GPIOC,GPIO_PIN_11) && i<50000);
	AD7190_SPI_Write(mode,4);
}
开发者ID:Wanghuaichen,项目名称:dt900,代码行数:8,代码来源:ad7190.c


示例4: EXTI0_IRQHandler

void EXTI0_IRQHandler()
{
    if(HAL_GPIO_ReadPin(GPIOA, GPIO_PIN_0)) {
        ExpLedToggle(RED_LED);
        while(HAL_GPIO_ReadPin(GPIOA, GPIO_PIN_0));
        HAL_NVIC_ClearPendingIRQ(EXTI0_IRQn);
    }
}
开发者ID:Bosvark,项目名称:STMf401_ahrs,代码行数:8,代码来源:exp_board.c


示例5: main

int main(void) {
  char msg[20];

  HAL_Init();
  Nucleo_BSP_Init();

  /* Before we can access to every register of the PWR peripheral we must enable it */
  __HAL_RCC_PWR_CLK_ENABLE();

  while (1) {
    if(__HAL_PWR_GET_FLAG(PWR_FLAG_SB)) {
      /* If standby flag set in PWR->CSR, then the reset is generated from
       * the exit of the standby mode */
      sprintf(msg, "RESET after STANDBY mode\r\n");
      HAL_UART_Transmit(&huart2, (uint8_t*)msg, strlen(msg), HAL_MAX_DELAY);
      /* We have to explicitly clear the flag */
      __HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU|PWR_FLAG_SB);
    }

    sprintf(msg, "MCU in run mode\r\n");
    HAL_UART_Transmit(&huart2, (uint8_t*)msg, strlen(msg), HAL_MAX_DELAY);
    while(HAL_GPIO_ReadPin(GPIOC, GPIO_PIN_13) == GPIO_PIN_SET) {
      HAL_GPIO_TogglePin(LD2_GPIO_Port, LD2_Pin);
      HAL_Delay(100);
    }

    HAL_Delay(200);

    sprintf(msg, "Entering in SLEEP mode\r\n");
    HAL_UART_Transmit(&huart2, (uint8_t*)msg, strlen(msg), HAL_MAX_DELAY);

    SleepMode();

    sprintf(msg, "Exiting from SLEEP mode\r\n");
    HAL_UART_Transmit(&huart2, (uint8_t*)msg, strlen(msg), HAL_MAX_DELAY);

    while(HAL_GPIO_ReadPin(GPIOC, GPIO_PIN_13) == GPIO_PIN_SET);
    HAL_Delay(200);

    sprintf(msg, "Entering in STOP mode\r\n");
    HAL_UART_Transmit(&huart2, (uint8_t*)msg, strlen(msg), HAL_MAX_DELAY);

    StopMode();

    sprintf(msg, "Exiting from STOP mode\r\n");
    HAL_UART_Transmit(&huart2, (uint8_t*)msg, strlen(msg), HAL_MAX_DELAY);

    while(HAL_GPIO_ReadPin(GPIOC, GPIO_PIN_13) == GPIO_PIN_SET);
    HAL_Delay(200);

    sprintf(msg, "Entering in STANDBY mode\r\n");
    HAL_UART_Transmit(&huart2, (uint8_t*)msg, strlen(msg), HAL_MAX_DELAY);

    StandbyMode();

    while(1); //Never arrives here, since MCU is reset when exiting from STANDBY
  }
}
开发者ID:Shreeyak,项目名称:mastering-stm32,代码行数:58,代码来源:main-ex1.c


示例6: get_column

/**
   * @brief Reports column of key that was pressed
   * @retval Int of column activated
   */
uint8_t get_column(void) {
	
	// Initialize pins to allow for columns as input
	init_columns();
	
	// Row selection determined by active low 
	if(!HAL_GPIO_ReadPin(GPIOD, col_pinmap[0])) return 0;
	else if(!HAL_GPIO_ReadPin(GPIOD, col_pinmap[1])) return 1;
	else if(!HAL_GPIO_ReadPin(GPIOD, col_pinmap[2])) return 2;
	else return 9;
	
}
开发者ID:lsoldano93,项目名称:ECSE426,代码行数:16,代码来源:keypad.c


示例7: findRow

/**
	* @brief Find in which row a button was pressed
	* @param None
	* @retval None
	*/
int findRow(void){
	int row = 0;
	/* change the column at output */
	Column_GPIO_InitDef.Mode = GPIO_MODE_OUTPUT_PP;
	Column_GPIO_InitDef.Pull = GPIO_NOPULL;

	HAL_GPIO_Init(GPIOC, &Column_GPIO_InitDef);


	/* change row as input */
	Row_GPIO_InitDef.Mode = GPIO_MODE_INPUT;
	Row_GPIO_InitDef.Pull = GPIO_PULLUP;

	HAL_GPIO_Init(GPIOC, &Row_GPIO_InitDef);

	HAL_GPIO_WritePin(GPIOC, col1, GPIO_PIN_RESET);
	HAL_GPIO_WritePin(GPIOC, col2, GPIO_PIN_RESET);
	HAL_GPIO_WritePin(GPIOC, col3, GPIO_PIN_RESET);

	/* check which row have a button pressed */
	if (HAL_GPIO_ReadPin(GPIOC, row1) == GPIO_PIN_RESET){
		row = 1;
	}

	else if (HAL_GPIO_ReadPin(GPIOC, row2) == GPIO_PIN_RESET){
		row = 2;
	}

	else if (HAL_GPIO_ReadPin(GPIOC, row3) == GPIO_PIN_RESET){
		row = 3;
	}
	else if (HAL_GPIO_ReadPin(GPIOC, row4) == GPIO_PIN_RESET){
		row = 4;
	}

	/* set back the row and column as output and input */
	Row_GPIO_InitDef.Mode = GPIO_MODE_OUTPUT_PP;
	Row_GPIO_InitDef.Pull = GPIO_NOPULL;

	HAL_GPIO_Init(GPIOC, &Row_GPIO_InitDef);

	HAL_GPIO_WritePin(GPIOC, row1, GPIO_PIN_RESET);
	HAL_GPIO_WritePin(GPIOC, row2, GPIO_PIN_RESET);
	HAL_GPIO_WritePin(GPIOC, row3, GPIO_PIN_RESET);
	HAL_GPIO_WritePin(GPIOC, row4, GPIO_PIN_RESET);

	Column_GPIO_InitDef.Mode = GPIO_MODE_INPUT;
	Column_GPIO_InitDef.Pull = GPIO_PULLUP;

	HAL_GPIO_Init(GPIOC, &Column_GPIO_InitDef);

	return row;
}
开发者ID:felixdube,项目名称:microprocessor-systems,代码行数:58,代码来源:keypad.c


示例8: read_key

/***************读按键程序**************/
uint8_t read_key()
{
uint8_t rekey =0;
uint8_t   i ;
I2CStart();
I2CWritebyte(0x42);							 //写读指令0x42
DIO_H;
CLK_H;
for(i=0;i<8;i++)
{
	CLK_L;
  #ifdef tm1651_delay_EN
	__nop() ;
   tm1651_delay();
  #endif
	rekey>>=1;	   						//先读低位
  #ifdef tm1651_delay_EN
	__nop() ;
   tm1651_delay();
  #endif
	CLK_H;
   HAL_GPIO_WritePin(TM1651_DIO_GPIO_Port ,TM1651_DIO_Pin,GPIO_PIN_SET) ;
	if( HAL_GPIO_ReadPin(TM1651_DIO_GPIO_Port ,TM1651_DIO_Pin))
	  rekey=rekey|0x80;
	else 
	  rekey=rekey|0x00;
  #ifdef tm1651_delay_EN
	__nop() ;
   tm1651_delay();
  #endif
}
	CLK_L;							  //判断芯片发过来的ACK应答信号
  #ifdef tm1651_delay_EN
	__nop() ;
   tm1651_delay();
  #endif
//使用开漏输出模式,在读取管脚电平的时候 先将管脚写高电平,然后读数
 HAL_GPIO_WritePin(TM1651_DIO_GPIO_Port ,TM1651_DIO_Pin,GPIO_PIN_SET) ;
	while( HAL_GPIO_ReadPin(TM1651_DIO_GPIO_Port ,TM1651_DIO_Pin));
  #ifdef tm1651_delay_EN
	__nop() ;
   tm1651_delay();
  #endif
	CLK_H;
  #ifdef tm1651_delay_EN
	__nop() ;
   tm1651_delay();
  #endif
	I2CStop();
	
	return rekey;
}
开发者ID:Williamzhangtw,项目名称:8586S,代码行数:53,代码来源:TM1651.c


示例9: HAL_GPIO_EXTI_Callback

/**
  * @brief  EXTI line detection callbacks.
  * @param  GPIO_Pin: Specifies the pins connected EXTI line
  * @retval None
  */
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
{
  if(HAL_GPIO_ReadPin(SEL_JOY_GPIO_PORT, SEL_JOY_PIN) != GPIO_PIN_SET) 
  {
    /* SEL is used to pause and resume the audio playback */
    if (PressCount == 1)
    {
      /* Resume playing Wave status */
      PauseResumeStatus = RESUME_STATUS;
      PressCount = 0;
    }
    else
    {
      /* Pause playing Wave status */
      PauseResumeStatus = PAUSE_STATUS;
      PressCount = 1;
    }
  }
  else if(HAL_GPIO_ReadPin(UP_JOY_GPIO_PORT, UP_JOY_PIN) != GPIO_PIN_SET)
  {
    /* UP is used to increment the volume of the audio playback */
    volume ++;
    if (volume > 100)
    {
      volume = 100;
    }
    VolumeChange = 1;
  }
  else if(HAL_GPIO_ReadPin(DOWN_JOY_GPIO_PORT, DOWN_JOY_PIN) != GPIO_PIN_SET)
  {
    /* DOWN is used to decrement the volume of the audio playback */
    volume --;
    if ((int8_t)volume < 50)
    {
      volume = 50;
    }
    VolumeChange = 1;
  }
  else if(HAL_GPIO_ReadPin(RIGHT_JOY_GPIO_PORT, RIGHT_JOY_PIN) != GPIO_PIN_SET)
  {
    /* Audio change output: speaker only */
    UserOutputMode = OUTPUT_DEVICE_SPEAKER;
  }
  else if(HAL_GPIO_ReadPin(LEFT_JOY_GPIO_PORT, LEFT_JOY_PIN) != GPIO_PIN_SET)
  {
    /* Audio change output: headset only */
    UserOutputMode = OUTPUT_DEVICE_HEADPHONE;
  }

}
开发者ID:Lembed,项目名称:STM32CubeF1-mirrors,代码行数:55,代码来源:main.c


示例10: main

int main(void) {
  HAL_Init();
  Nucleo_BSP_Init();

  hdma_memtomem_dma1_channel5.Instance = DMA1_Channel5;
  hdma_memtomem_dma1_channel5.Init.Direction = DMA_MEMORY_TO_MEMORY;
  hdma_memtomem_dma1_channel5.Init.PeriphInc = DMA_PINC_ENABLE;
  hdma_memtomem_dma1_channel5.Init.MemInc = DMA_MINC_ENABLE;
  hdma_memtomem_dma1_channel5.Init.PeriphDataAlignment = DMA_PDATAALIGN_BYTE;
  hdma_memtomem_dma1_channel5.Init.MemDataAlignment = DMA_PDATAALIGN_BYTE;
  hdma_memtomem_dma1_channel5.Init.Mode = DMA_NORMAL;
  hdma_memtomem_dma1_channel5.Init.Priority = DMA_PRIORITY_VERY_HIGH;
  HAL_DMA_Init(&hdma_memtomem_dma1_channel5);

  GPIOC->ODR = 0x100;
  HAL_DMA_Start(&hdma_memtomem_dma1_channel5,  (uint32_t)&flashData,  (uint32_t)&sramData, 1000);
  HAL_DMA_PollForTransfer(&hdma_memtomem_dma1_channel5, HAL_DMA_FULL_TRANSFER, HAL_MAX_DELAY);
  GPIOC->ODR = 0x0;

  while(HAL_GPIO_ReadPin(B1_GPIO_Port, B1_Pin));

  hdma_memtomem_dma1_channel5.Init.PeriphDataAlignment = DMA_PDATAALIGN_WORD;
  hdma_memtomem_dma1_channel5.Init.MemDataAlignment = DMA_PDATAALIGN_WORD;
  HAL_DMA_Init(&hdma_memtomem_dma1_channel5);

  GPIOC->ODR = 0x100;
  HAL_DMA_Start(&hdma_memtomem_dma1_channel5,  (uint32_t)&flashData,  (uint32_t)&sramData, 250);
  HAL_DMA_PollForTransfer(&hdma_memtomem_dma1_channel5, HAL_DMA_FULL_TRANSFER, HAL_MAX_DELAY);
  GPIOC->ODR = 0x0;

  HAL_Delay(1000);

  while(HAL_GPIO_ReadPin(B1_GPIO_Port, B1_Pin));

  GPIOC->ODR = 0x100;
  memcpy(sramData, flashData, 1000);
  GPIOC->ODR = 0x0;

  HAL_Delay(1000);

  while(HAL_GPIO_ReadPin(B1_GPIO_Port, B1_Pin));

  GPIOC->ODR = 0x100;
  for(int i = 0; i < 1000; i++)
	  sramData[i] = flashData[i];
  GPIOC->ODR = 0x0;

  /* Infinite loop */
  while (1);
}
开发者ID:doebbertt,项目名称:mastering-stm32,代码行数:50,代码来源:mem2mem.c


示例11: read_keypad_col

void read_keypad_col() {
	initGPIOT(GPIOB, COLUMN_PIN_SET, input);//Used for the keypad
	initGPIOT(GPIOB, ROW_PIN_SET, output);
	
	// set all rows to 0
	HAL_GPIO_WritePin(GPIOB,ROW_PIN_SET,GPIO_PIN_RESET);
	
	// loop through all columns, see which is right!!!
	//while (!colDet) {
		if(GPIO_PIN_RESET == HAL_GPIO_ReadPin(GPIOB, GPIO_PIN_6)) colDet = 1;
		if(GPIO_PIN_RESET == HAL_GPIO_ReadPin(GPIOB, GPIO_PIN_7)) colDet = 2;
		if(GPIO_PIN_RESET == HAL_GPIO_ReadPin(GPIOB, GPIO_PIN_8)) colDet = 3;
	//}
}
开发者ID:Tedderic,项目名称:MicroP-Lab-4,代码行数:14,代码来源:keypad.c


示例12: 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,SET);
  HAL_Delay(1000);
  HAL_GPIO_WritePin(Led_gpio,Led_pin,RESET);

  HAL_GPIO_WritePin(DcCal_gpio,DcCal_pin,RESET);
  HAL_GPIO_WritePin(EnGate_gpio,EnGate_pin,SET);

  char state;
  /* Infinite loop */
  /* USER CODE BEGIN WHILE */
  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);

    ApplyPhase(state);
  }
  /* USER CODE END 3 */

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


示例13: main_loop

static void main_loop(void){
	static uint32_t loopCounter = 0;
	static uint32_t divider100ms = 100;
	uint32_t i = 0;
	if(!(loopCounter%divider100ms)){
		HAL_GPIO_TogglePin(GPIOD,GPIO_PIN_15);
		kommuHandler();
	}
	
	if(!(loopCounter)){

	}
	power[3] = 100+pidY_X;
	if(HAL_GPIO_ReadPin(GPIOA,GPIO_PIN_0) == GPIO_PIN_SET){
		if(!bursting_start && !bursting_end){
			//bursting_start = 1;
		}
	}else{
		if(bursting_end){
			i = 0;
			while(i <= currentburst ){
				stdout_putchar(burst[i++]);
			}
			currentburst = 0;
			bursting_end = 0;
		}
	}

	loopCounter++;
}
开发者ID:RageFlo,项目名称:testImport1,代码行数:30,代码来源:main.c


示例14: BLE_CON

/*****************************************************************
Name			:	uint8_t BLE_CON(void)
Fuction		:	the BLE connect state
Input			:	void
Output		:	the value of connect state
						(PA4	BLE_CON Low:connected ; High:disconnected)
Author		:	@hiyangdong
Version		:	V0.1
Time			:	30 Nov. 2015
*****************************************************************/
uint8_t BLE_CON(void)
{
	if(HAL_GPIO_ReadPin(GPIOA,GPIO_PIN_4)==GPIO_PIN_RESET)
		return 0;
	else
		return 1;
}
开发者ID:DavidYangShare,项目名称:STM32F030Bootloader,代码行数:17,代码来源:BLE.c


示例15: HAL_GPIO_EXTI_Callback

void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin){
	

	if (GPIO_Pin==GPIO_PIN_0){
	while (BSP_PB_GetState(BUTTON_KEY) != RESET)
	{};
		
 	click++;
		
	startsyncpulse();
	frameid = 0;
		
		
	printf("\nButton Press Detected");
	return;
	}

	
	
	if (GPIO_Pin==GPIO_PIN_2){
	 
	 if(HAL_GPIO_ReadPin(GPIOA,GPIO_PIN_2)){
		//Rising Edge Detected
	  modulation_on();
		startcounter(); //Starts ticking the clock for exposure		 
	
	 }
	 else{	
		//Falling Edge Detected 	 	  
   
	 }
	}
	
	
}
开发者ID:shikharshrestha,项目名称:Stanford_TOF,代码行数:35,代码来源:main.c


示例16: is_update_image_enable

int is_update_image_enable(gpio_t *gpio_uart_update_eable)
{

	HAL_GPIO_PIN  GPIO_Pin;
    u32 active_state;
//	gpio_t gpio_uart_update_eable;
	int ret = 0;
#if 0
    GPIO_Pin.pin_name = 0xC4;
	//low active
	GPIO_Pin.pin_mode = DIN_PULL_HIGH;
	active_state = GPIO_PIN_LOW;
	
    HAL_GPIO_Init(&GPIO_Pin);
	
    if (HAL_GPIO_ReadPin(&GPIO_Pin) == active_state)
    	ret = 0;
	else
		ret = 1;
	
   	HAL_GPIO_DeInit(&GPIO_Pin);
#else
	gpio_init(gpio_uart_update_eable, PIN_NAME);
	gpio_dir(gpio_uart_update_eable, PIN_INPUT);     // Direction: Input
	gpio_mode(gpio_uart_update_eable, PullUp);       // Pull-High
//	ret = gpio_read(&gpio_uart_update_eable);
#endif

	return ret;
}
开发者ID:Lee1124Amy,项目名称:HomeKit,代码行数:30,代码来源:example_uart_update.c


示例17: 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


示例18: HAL_GPIO_WritePin

void TM1637::writeByte(int8_t wr_data)
{
  uint8_t i,count1;   
  for(i=0;i<8;i++)        //sent 8bit data
  {
		HAL_GPIO_WritePin(CLK_GPIO_Port, CLK_Pin, GPIO_PIN_RESET);	
    if(wr_data & 0x01) HAL_GPIO_WritePin(DI_GPIO_Port, DI_Pin, GPIO_PIN_SET);	//LSB first
    else HAL_GPIO_WritePin(DI_GPIO_Port, DI_Pin, GPIO_PIN_RESET);
    wr_data >>= 1;      
    HAL_GPIO_WritePin(CLK_GPIO_Port, CLK_Pin, GPIO_PIN_SET);
      
  }  
  HAL_GPIO_WritePin(CLK_GPIO_Port, CLK_Pin, GPIO_PIN_RESET);	 //wait for the ACK
  HAL_GPIO_WritePin(DI_GPIO_Port, DI_Pin, GPIO_PIN_SET);
  HAL_GPIO_WritePin(CLK_GPIO_Port, CLK_Pin, GPIO_PIN_SET);     
  pinDI_Input();
  while(HAL_GPIO_ReadPin(DI_GPIO_Port, DI_Pin))    
  { 
    count1 +=1;
    if(count1 == 200)//
    {
     pinDI_Output();
     HAL_GPIO_WritePin(DI_GPIO_Port, DI_Pin, GPIO_PIN_RESET);
     count1 =0;
    }
    pinDI_Input();
  }
  pinDI_Output();
  
}
开发者ID:TERMIN36,项目名称:TabletIllumination,代码行数:30,代码来源:TM1637.cpp


示例19: HAL_GPIO_EXTI_Callback

/**
 * @brief  EXTI line detection callback.
 * @param  uint16_t GPIO_Pin Specifies the pins connected EXTI line
 * @retval None
 */
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
{
  tHciDataPacket * hciReadPacket = NULL;
  uint8_t data_len;
  /* 
   * No need to call Clear_SPI_EXTI_Flag() here as
   * HAL_GPIO_EXTI_IRQHandler() already does it
   */
  
  if(GPIO_Pin == BNRG_SPI_EXTI_PIN) {
    
    while (HAL_GPIO_ReadPin(BNRG_SPI_EXTI_PORT, BNRG_SPI_EXTI_PIN) == GPIO_PIN_SET) {
      
      uint8_t rx_buffer[255];
      uint8_t rx_bytes;
      
      /* Data are available from BlueNRG: read them through SPI */
      rx_bytes = BlueNRG_SPI_Read_All(&SpiHandle, rx_buffer, sizeof(rx_buffer)); 
      /* Check if there is data is so, send it to VCOM */
      if (rx_bytes > 0) {
        int i;
        for (i = 0; i < rx_bytes; i++) {
          PRINTF("0x%x, ", rx_buffer[i]);

          if(HAL_UART_Transmit(&UartHandle, (uint8_t*)&rx_buffer[i], 1, 300)!= HAL_OK) {
            Error_Handler();
          }
        }
        PRINTF("\n");
      }
      
      Clear_SPI_EXTI_Flag();
    }
  }
}
开发者ID:icelittle,项目名称:hid_ble,代码行数:40,代码来源:bluenrg_interface.c


示例20: Test_Stateflow_step

/* Model step function */
void Test_Stateflow_step(void)
{
  /* S-Function Block: <Root>/STM32_Config */

  /* S-Function Block: <Root>/GPIO_Read */
  Test_Stateflow_B.GPIO_Read = (boolean_T)HAL_GPIO_ReadPin(GPIOE, GPIO_PIN_8);
  if (Test_Stateflow_DW.temporalCounter_i1 < 7U) {
    Test_Stateflow_DW.temporalCounter_i1++;
  }

  if (Test_Stateflow_DW.is_active_c3_Test_Stateflow == 0U) {
    Test_Stateflow_DW.is_active_c3_Test_Stateflow = 1U;
    Test_Stateflow_DW.is_c3_Test_Stateflow = Test_Stateflow_IN_S1;
    Test_Stateflow_B.LED1 = 1.0;
    Test_Stateflow_B.LED2 = 0.0;
    Test_Stateflow_B.LED3 = 0.0;
  } else {
    switch (Test_Stateflow_DW.is_c3_Test_Stateflow) {
     case Test_Stateflow_IN_S1:
      if (Test_Stateflow_B.GPIO_Read == 1.0) {
        Test_Stateflow_DW.is_c3_Test_Stateflow = Test_Stateflow_IN_S2;
        Test_Stateflow_B.LED1 = 0.0;
        Test_Stateflow_B.LED2 = 1.0;
        Test_Stateflow_B.LED3 = 0.0;
      }
      break;

     case Test_Stateflow_IN_S2:
      if (Test_Stateflow_B.GPIO_Read == 0.0) {
        Test_Stateflow_DW.is_c3_Test_Stateflow = Test_Stateflow_IN_S3;
        Test_Stateflow_DW.temporalCounter_i1 = 0U;
        Test_Stateflow_B.LED1 = 0.0;
        Test_Stateflow_B.LED2 = 0.0;
        Test_Stateflow_B.LED3 = 1.0;
      }
      break;

     default:
      if (Test_Stateflow_DW.temporalCounter_i1 >= 4U) {
        Test_Stateflow_DW.is_c3_Test_Stateflow = Test_Stateflow_IN_S1;
        Test_Stateflow_B.LED1 = 1.0;
        Test_Stateflow_B.LED2 = 0.0;
        Test_Stateflow_B.LED3 = 0.0;
      }
      break;
    }
  }

  /* S-Function Block: <Root>/GPIO_Write */
  HAL_GPIO_WritePin(GPIOD, GPIO_PIN_11, Test_Stateflow_B.LED1);
  HAL_GPIO_WritePin(GPIOD, GPIO_PIN_12, Test_Stateflow_B.LED2);
  HAL_GPIO_WritePin(GPIOD, GPIO_PIN_13, Test_Stateflow_B.LED3);

  /* S-Function Block: <Root>/GPIO_Write2 */
  HAL_GPIO_WritePin(GPIOD, GPIO_PIN_7, Test_Stateflow_P.Constant1_Value);

  /* S-Function Block: <Root>/GPIO_Write1 */
  HAL_GPIO_WritePin(GPIOC, GPIO_PIN_13, Test_Stateflow_P.Constant2_Value);
  HAL_GPIO_WritePin(GPIOC, GPIO_PIN_14, Test_Stateflow_P.Constant2_Value);
}
开发者ID:janhieber,项目名称:HTWAA_car_32b,代码行数:61,代码来源:Test_Stateflow.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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