本文整理汇总了C++中HAL_GPIO_WritePin函数的典型用法代码示例。如果您正苦于以下问题:C++ HAL_GPIO_WritePin函数的具体用法?C++ HAL_GPIO_WritePin怎么用?C++ HAL_GPIO_WritePin使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了HAL_GPIO_WritePin函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: clear_led
void clear_led(uint8_t led)
{
HAL_GPIO_WritePin(leds[led].port, leds[led].pin, GPIO_PIN_RESET);
}
开发者ID:drmetal,项目名称:lollyjar,代码行数:4,代码来源:leds.c
示例2: StatusLED_Off_T3B
void StatusLED_Off_T3B(StatusLED_T3B_TypeDef Led) {
HAL_GPIO_WritePin(STATUSLED_GPIO_PORT[Led], STATUSLED_GPIO_PIN[Led],
GPIO_PIN_RESET);
}
开发者ID:glocklueng,项目名称:myLib,代码行数:4,代码来源:Tumbler3BSP.c
示例3: LSM303D_CS_ENABLE
void LSM303D_CS_ENABLE(void)
{
HAL_GPIO_WritePin(LSM303D_CS_PORT, LSM303D_CS_PIN, GPIO_PIN_RESET);
}
开发者ID:fhtthg,项目名称:my_pix4,代码行数:4,代码来源:lsm303d.c
示例4: main
/**
* @brief Main program.
* @param None
* @retval None
*/
int main(void)
{
/* STM32F3xx HAL library initialization:
- Configure the Flash prefetch
- 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 have a system clock = 72 MHz */
SystemClock_Config();
/* Initialize STM32F3348-DISCO LEDs */
BSP_LED_Init(LED3);
BSP_LED_Init(LED4);
BSP_LED_Init(LED6);
/* Initialize User_Button on STM32F3348-DISCO */
BSP_PB_Init(BUTTON_USER, BUTTON_MODE_GPIO);
/* Initialize ADC to be triggered by the HRTIMER */
ADC_Config();
/* Initialize HRTIM and related inputs */
#ifdef SNIPPET
HRTIM_Config_NoHAL();
#else
HRTIM_Config();
#endif
/* Initialize BUCK outputs (it has to be done after HRTIM init) */
GPIO_BUCK_outputs_Config();
/* Turn ON T6 MOSFET on discovery board */
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_11, GPIO_PIN_SET);
/* Infinite loop */
while (1)
{
/* ---------------- */
/* Fault management */
/* ---------------- */
#ifdef SNIPPET
/* If Fault occured */
while(HRTIM1->sCommonRegs.ISR & HRTIM_ICR_FLT1C)
{
/* LED3 is flashing in case of fault */
BSP_LED_On(LED3);
HAL_Delay(20);
BSP_LED_Off(LED3);
HAL_Delay(80);
/* Re-arm HRTIM TD1 output if "User" push button is pressed*/
if((BSP_PB_GetState(BUTTON_USER) == SET))
{
/* Clear interrupt flag */
HRTIM1->sCommonRegs.ICR = HRTIM_ICR_FLT1C;
/* Re-enable TA1 and TA2 */
HRTIM1->sCommonRegs.OENR = HRTIM_OENR_TA1OEN + HRTIM_OENR_TA2OEN;
}
}
#else
while(__HAL_HRTIM_GET_FLAG(&hhrtim, HRTIM_FLAG_FLT1) == SET)
{
/* LED3 is flashing in case of fault */
BSP_LED_On(LED3);
HAL_Delay(20);
BSP_LED_Off(LED3);
HAL_Delay(80);
/* Re-arm HRTIM TD1 output if "User" push button is pressed*/
if((BSP_PB_GetState(BUTTON_USER) == SET))
{
__HAL_HRTIM_CLEAR_IT(&hhrtim, HRTIM_IT_FLT1);
HAL_HRTIM_WaveformOutputStart(&hhrtim, HRTIM_OUTPUT_TA1 | HRTIM_OUTPUT_TA2);
}
}
#endif
/* ---------------- */
/* Normal operation */
/* ---------------- */
/* LED6 toggling to show MCU activity */
BSP_LED_On(LED6);
HAL_Delay(100);
BSP_LED_Off(LED6);
HAL_Delay(400);
/* -----------------------------------------------------------------------*/
/* Input and output voltages can be displayed real-time in a watch window */
/* -----------------------------------------------------------------------*/
Vin = (HAL_ADCEx_InjectedGetValue(&AdcHandle, ADC_INJECTED_RANK_1) * ADC_VREF)/0x1000;
//.........这里部分代码省略.........
开发者ID:eleciawhite,项目名称:STM32Cube,代码行数:101,代码来源:main.c
示例5: BSP_LED_Off
/**
* @brief Turns selected LED Off.
* @param Led: Specifies the Led to be set off.
* This parameter can be one of following parameters:
* @arg LED4
* @arg LED3
* @arg LED5
* @arg LED6
*/
void BSP_LED_Off(Led_TypeDef Led)
{
HAL_GPIO_WritePin(GPIO_PORT[Led], GPIO_PIN[Led], GPIO_PIN_RESET);
}
开发者ID:bittercrow,项目名称:btstack,代码行数:13,代码来源:stm32f4_discovery.c
示例6: LcdWriteDataMultiple
/********************************************************************
*
* LcdWriteDataMultiple
*
* Function description:
* Writes multiple values to a display register.
*/
void LcdWriteDataMultiple(uint8_t * pData, int NumItems)
{
HAL_GPIO_WritePin(LCD_DCX_GPIO_Port, LCD_DCX_Pin, GPIO_PIN_SET);
HAL_SPI_Transmit(&hspi1, pData, NumItems, 10);
}
开发者ID:wosayttn,项目名称:aos,代码行数:12,代码来源:st7789.c
示例7: prvADC_CS_HIGH
/**
* @brief Pull the CS pin HIGH
* @param None
* @retval None
*/
static inline void prvADC_CS_HIGH()
{
HAL_GPIO_WritePin(ADC_PORT, ADC_CS_PIN, GPIO_PIN_SET);
}
开发者ID:hampussandberg,项目名称:HexConnect,代码行数:9,代码来源:max1301.c
示例8: HAL_LedSet
void HAL_LedSet(ST_LedInit_t *pstLedInit, EN_Led_Value_t enLedValue)
{
HAL_GPIO_WritePin(pstLedInit->pvGPIOPort, pstLedInit->pvInitStruct.Pin, (GPIO_PinState)enLedValue);
}
开发者ID:hugozijlmans,项目名称:HOME_AUTOMATION_SYSTEM,代码行数:4,代码来源:HAL_Led.c
示例9: set_led
void set_led(uint8_t led)
{
HAL_GPIO_WritePin(leds[led].port, leds[led].pin, GPIO_PIN_SET);
}
开发者ID:drmetal,项目名称:lollyjar,代码行数:4,代码来源:leds.c
示例10: main
//.........这里部分代码省略.........
/* Configure PB.03 to display wave form of channel4 */
GPIO_InitStruct.Pin = GPIO_PIN_3;
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
/* Compute the prescaler value to have TIMx counter clock equal to 10 kHz */
uwPrescalerValue = ((SystemCoreClock) / 10000) - 1;
/*##-1- Configure the TIM peripheral #######################################*/
/* Initialize TIMx peripheral as follow:
+ Prescaler = (SystemCoreClock)/10000 - 1;
+ Period = 65535
+ ClockDivision = 0
+ Counter direction = Up
*/
TimHandle.Instance = TIM1;
TimHandle.Init.Period = 65535;
TimHandle.Init.Prescaler = uwPrescalerValue;
TimHandle.Init.ClockDivision = 0;
TimHandle.Init.CounterMode = TIM_COUNTERMODE_UP;
if(HAL_TIM_OC_Init(&TimHandle) != HAL_OK)
{
/* Initialization Error */
Error_Handler();
}
/*##-2- Configure the Output Compare channels #########################################*/
/* Common configuration for all channels */
sConfig.OCMode = TIM_OCMODE_INACTIVE;
sConfig.OCPolarity = TIM_OCPOLARITY_HIGH;
/* Set the pulse (delay1) value for channel 1 */
sConfig.Pulse = PULSE1_VALUE;
if(HAL_TIM_OC_ConfigChannel(&TimHandle, &sConfig, TIM_CHANNEL_1) != HAL_OK)
{
/* Configuration Error */
Error_Handler();
}
/* Set the pulse (delay2) value for channel 2 */
sConfig.Pulse = PULSE2_VALUE;
if(HAL_TIM_OC_ConfigChannel(&TimHandle, &sConfig, TIM_CHANNEL_2) != HAL_OK)
{
/* Configuration Error */
Error_Handler();
}
/* Set the pulse (delay3) value for channel 3 */
sConfig.Pulse = PULSE3_VALUE;
if(HAL_TIM_OC_ConfigChannel(&TimHandle, &sConfig, TIM_CHANNEL_3) != HAL_OK)
{
/* Configuration Error */
Error_Handler();
}
/* Set the pulse (delay4) value for channel 4 */
sConfig.Pulse = PULSE4_VALUE;
if(HAL_TIM_OC_ConfigChannel(&TimHandle, &sConfig, TIM_CHANNEL_4) != HAL_OK)
{
/* Configuration Error */
Error_Handler();
}
/*##-3- Set GPIO Pins PB.00, PB.01, PB.02 and PB.03 as reference ###################*/
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_0, GPIO_PIN_SET);
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_1, GPIO_PIN_SET);
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_2, GPIO_PIN_SET);
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_3, GPIO_PIN_SET);
/*##-4- Start signals generation #######################################*/
/* Start channel 1 in Output compare mode */
if(HAL_TIM_OC_Start_IT(&TimHandle, TIM_CHANNEL_1) != HAL_OK)
{
/* Starting Error */
Error_Handler();
}
/* Start channel 2 in Output compare mode */
if(HAL_TIM_OC_Start_IT(&TimHandle, TIM_CHANNEL_2) != HAL_OK)
{
/* Starting Error */
Error_Handler();
}
/* Start channel 3 in Output compare mode */
if(HAL_TIM_OC_Start_IT(&TimHandle, TIM_CHANNEL_3) != HAL_OK)
{
/* Starting Error */
Error_Handler();
}
/* Start channel 4 in Output compare mode */
if(HAL_TIM_OC_Start_IT(&TimHandle, TIM_CHANNEL_4) != HAL_OK)
{
/* Starting Error */
Error_Handler();
}
while (1)
{
}
}
开发者ID:MrZANE42,项目名称:verisure1512,代码行数:101,代码来源:main.c
示例11: HAL_TIM_OC_DelayElapsedCallback
// 输出比较 回调函数
void HAL_TIM_OC_DelayElapsedCallback(TIM_HandleTypeDef *htim)
{
uint16_t delay_new = 0;
// TIM4
if (htim->Instance == TIM4) {
// 1
// 排烟风机 通道
if(htim->Channel == HAL_TIM_ACTIVE_CHANNEL_1) {
// 排烟风机 delay_on, 打开输出
// 输出:On
HAL_GPIO_WritePin(PORT_SCR, SCR0_smoke, GPIO_PIN_RESET);
HAL_TIM_OC_Stop_IT( &htim4, TIM_CHANNEL_1);
// 启动波峰
if (is_lower_blow) {
is_lower_blow = false;
delay_new = __HAL_TIM_GET_COMPARE(&htim4, TIM_CHANNEL_1);
__HAL_TIM_SET_COMPARE(&htim4, TIM_CHANNEL_1, delay_new + 10000 - 1);
HAL_TIM_OC_Start_IT( &htim4, TIM_CHANNEL_1);
}
//设置停止时间
delay_new = __HAL_TIM_GET_COMPARE(&htim1, TIM_CHANNEL_1);
__HAL_TIM_SET_COMPARE(&htim1, TIM_CHANNEL_1, delay_new + uS_DELAY_OFF);
// 启动定时器
HAL_TIM_OC_Start_IT( &htim1, TIM_CHANNEL_1);
}
// 2
// 循环风机通道
if(htim->Channel == HAL_TIM_ACTIVE_CHANNEL_2) {
// 循环风机 delay_on, 打开输出
// 输出:On
HAL_GPIO_WritePin(PORT_SCR, SCR1_exchange, GPIO_PIN_RESET);
HAL_TIM_OC_Stop_IT( &htim4, TIM_CHANNEL_2);
// 启动波峰
if (is_lower_exchange) {
is_lower_exchange = false;
delay_new = __HAL_TIM_GET_COMPARE(&htim4, TIM_CHANNEL_2);
__HAL_TIM_SET_COMPARE(&htim4, TIM_CHANNEL_2, delay_new + 10000 - 1);
HAL_TIM_OC_Start_IT( &htim4, TIM_CHANNEL_2);
}
//设置停止时间
uint16_t delay_new = __HAL_TIM_GET_COMPARE(&htim1, TIM_CHANNEL_2);
__HAL_TIM_SET_COMPARE(&htim1, TIM_CHANNEL_2, delay_new + uS_DELAY_OFF);
// 启动定时器
HAL_TIM_OC_Start_IT( &htim1, TIM_CHANNEL_2);
}
// 3
// 送料电机 通道
if(htim->Channel == HAL_TIM_ACTIVE_CHANNEL_3) {
HAL_GPIO_WritePin(PORT_SCR, SCR2_feed, GPIO_PIN_RESET);
HAL_TIM_OC_Stop_IT( &htim4, TIM_CHANNEL_3);
// 启动波峰
if (is_lower_feed) {
is_lower_feed = false;
uint16_t delay_new = __HAL_TIM_GET_COMPARE(&htim4, TIM_CHANNEL_3);
__HAL_TIM_SET_COMPARE(&htim4, TIM_CHANNEL_3, delay_new + 10000 - 1);
HAL_TIM_OC_Start_IT( &htim4, TIM_CHANNEL_3);
}
//设置停止时间
uint16_t delay_new = __HAL_TIM_GET_COMPARE(&htim1, TIM_CHANNEL_3);
__HAL_TIM_SET_COMPARE(&htim1, TIM_CHANNEL_3, delay_new + uS_DELAY_OFF);
}
}
// TIM1
// 延时1ms关闭触发
if (htim->Instance == TIM1) {
// 1
if(htim->Channel == HAL_TIM_ACTIVE_CHANNEL_1) {
HAL_GPIO_WritePin(PORT_SCR, SCR0_smoke, GPIO_PIN_SET);
HAL_TIM_OC_Stop_IT( &htim1, TIM_CHANNEL_1);
}
// 2
if(htim->Channel == HAL_TIM_ACTIVE_CHANNEL_2) {
// 输出 循环:Off
HAL_GPIO_WritePin(PORT_SCR, SCR1_exchange, GPIO_PIN_SET);
HAL_TIM_OC_Stop_IT( &htim1, TIM_CHANNEL_2);
}
// 3
if(htim->Channel == HAL_TIM_ACTIVE_CHANNEL_3) {
// 输出 送料: Off
HAL_GPIO_WritePin(PORT_SCR, SCR2_feed, GPIO_PIN_SET);
HAL_TIM_OC_Stop_IT( &htim1, TIM_CHANNEL_3);
}
} // TIM1
//
//.........这里部分代码省略.........
开发者ID:yusp75,项目名称:pellet-stove-control,代码行数:101,代码来源:triac+-+0316.c
示例12: MX_GPIO_Init
/** Configure pins as
* Analog
* Input
* Output
* EVENT_OUT
* EXTI
PA10 ------> USB_OTG_FS_ID
PA11 ------> USB_OTG_FS_DM
PA12 ------> USB_OTG_FS_DP
*/
void MX_GPIO_Init(void)
{
GPIO_InitTypeDef GPIO_InitStruct;
/* GPIO Ports Clock Enable */
__GPIOC_CLK_ENABLE();
__GPIOH_CLK_ENABLE();
__GPIOA_CLK_ENABLE();
__GPIOB_CLK_ENABLE();
__GPIOD_CLK_ENABLE();
HAL_GPIO_WritePin(GPIO_BOARD_KILL_PORT, GPIO_BOARD_KILL_PIN, GPIO_PIN_SET);
GPIO_InitStruct.Pin = GPIO_PIN_13|GPIO_PIN_15|GPIO_PIN_6|GPIO_PIN_7
|GPIO_PIN_8|GPIO_PIN_14;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_LOW;
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
GPIO_InitStruct.Pin = GPIO_PIN_15;
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
GPIO_InitStruct.Pin = GPIO_PIN_1;
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
//---------------------------------------------------------------------------------
// Initialize Power Kill Pin
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_LOW;
GPIO_InitStruct.Pin = GPIO_PIN_9;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
//---------------------------------------------------------------------------------
// Initialize LED GPIOs
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_LOW;
// Port A LED GPIOs
GPIO_InitStruct.Pin = GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_7;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
// Port B LED GPIOs
GPIO_InitStruct.Pin = GPIO_PIN_3|GPIO_PIN_4|GPIO_PIN_5;
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
// Port C LED GPIOs
GPIO_InitStruct.Pin = GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_7|GPIO_PIN_8;
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
// Port D LED GPIOs
GPIO_InitStruct.Pin = GPIO_PIN_2;
HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
// THIS ONE DOESNT SEEM TO WORK
// Port H LED GPIOs
GPIO_InitStruct.Pin = GPIO_PIN_1;
HAL_GPIO_Init(GPIOH, &GPIO_InitStruct);
//---------------------------------------------------------------------------------
GPIO_InitStruct.Pin = GPIO_PIN_10|GPIO_PIN_11|GPIO_PIN_12;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_HIGH;
GPIO_InitStruct.Alternate = GPIO_AF10_OTG_FS;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
GPIO_InitStruct.Pin = GPIO_PIN_2;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_LOW;
HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
GPIO_InitStruct.Pin = GPIO_PIN_3|GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_12;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_LOW;
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
}
开发者ID:CalPolyRobotics,项目名称:IGVC-OlympusFirmware,代码行数:99,代码来源:gpio.c
示例13: 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_USART3_UART_Init();
MX_SPI1_Init();
MX_SPI2_Init();
/* USER CODE BEGIN 2 */
uint8_t init_bytes[] = { 0x07, 0x40, 0xC0, 0x01, 0x00, 0x8C, 0x8E, 0x00 };
for (int i = 0; i < 2; i++) {
HAL_GPIO_WritePin(SPI_CS_GPIO_Port, SPI_CS_Pin, GPIO_PIN_RESET);
HAL_SPI_Transmit(&hspi1, (uint8_t*) (&init_bytes[i]), 1, 1000);
HAL_GPIO_WritePin(SPI_CS_GPIO_Port, SPI_CS_Pin, GPIO_PIN_SET);
}
for (int i = 0; i < 0x16; i++) {
HAL_GPIO_WritePin(SPI_CS_GPIO_Port, SPI_CS_Pin, GPIO_PIN_RESET);
HAL_SPI_Transmit(&hspi1, (uint8_t*) (&init_bytes[2]), 1, 1000);
HAL_SPI_Transmit(&hspi1, (uint8_t*) (&init_bytes[4]), 1, 1000);
init_bytes[2]++;
HAL_GPIO_WritePin(SPI_CS_GPIO_Port, SPI_CS_Pin, GPIO_PIN_SET);
}
HAL_GPIO_WritePin(SPI_CS_GPIO_Port, SPI_CS_Pin, GPIO_PIN_RESET);
HAL_SPI_Transmit(&hspi1, (uint8_t*) (&init_bytes[5]), 1, 1000);
HAL_GPIO_WritePin(SPI_CS_GPIO_Port, SPI_CS_Pin, GPIO_PIN_SET);
// ds3234_set_time();
vfd_display();
ds3234_set_reg(DS3234_REG_CONTROL, 0x00);
// vfd_write_display_flag(0x03, 0x04);
// vfd_write_display_flag(0x0F, 0x03);
while (1) {
};
/* USER CODE END 2 */
/* USER CODE BEGIN RTOS_MUTEX */
/* add mutexes, ... */
/* USER CODE END RTOS_MUTEX */
/* USER CODE BEGIN RTOS_SEMAPHORES */
/* add semaphores, ... */
/* USER CODE END RTOS_SEMAPHORES */
/* USER CODE BEGIN RTOS_TIMERS */
/* start timers, add new ones, ... */
/* USER CODE END RTOS_TIMERS */
/* Create the thread(s) */
/* definition and creation of defaultTask */
osThreadDef(defaultTask, StartDefaultTask, osPriorityIdle, 0, 128);
defaultTaskHandle = osThreadCreate(osThread(defaultTask), NULL);
/* definition and creation of myTask02 */
osThreadDef(myTask02, StartTask02, osPriorityNormal, 0, 128);
myTask02Handle = osThreadCreate(osThread(myTask02), NULL);
/* definition and creation of myTask03 */
osThreadDef(myTask03, StartTask03, osPriorityNormal, 0, 128);
myTask03Handle = osThreadCreate(osThread(myTask03), NULL);
/* definition and creation of myTask01 */
osThreadDef(myTask01, StartTask01, osPriorityNormal, 0, 128);
myTask01Handle = osThreadCreate(osThread(myTask01), NULL);
/* definition and creation of myTask04 */
osThreadDef(myTask04, StartTask04, osPriorityNormal, 0, 128);
myTask04Handle = osThreadCreate(osThread(myTask04), NULL);
/* USER CODE BEGIN RTOS_THREADS */
/* add threads, ... */
/* USER CODE END RTOS_THREADS */
/* USER CODE BEGIN RTOS_QUEUES */
/* add queues, ... */
/* USER CODE END RTOS_QUEUES */
/* Start scheduler */
osKernelStart();
/* We should never get here as control is now taken by the scheduler */
//.........这里部分代码省略.........
开发者ID:li3p,项目名称:F4-DiscoverFree,代码行数:101,代码来源:main.c
示例14: MX_GPIO_Init
/** Configure pins as
* Analog
* Input
* Output
* EVENT_OUT
* EXTI
*/
static void MX_GPIO_Init(void)
{
GPIO_InitTypeDef GPIO_InitStruct;
GPIO_InitStruct.Pin = GPIO_PIN_All;
GPIO_InitStruct.Mode = GPIO_MODE_AF_INPUT;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
/* GPIO Ports Clock Enable */
__HAL_RCC_GPIOC_CLK_ENABLE();
__HAL_RCC_GPIOD_CLK_ENABLE();
__HAL_RCC_GPIOA_CLK_ENABLE();
__HAL_RCC_GPIOB_CLK_ENABLE();
// Clear the B8,B9 lines
GPIO_InitStruct.Pin = GPIO_PIN_8|GPIO_PIN_9;
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
/*Configure GPIO pin Output Level */
HAL_GPIO_WritePin(GPIOC, LCD_A0_Pin|MOD4_GPIO2_Pin|MOD3_GPIO2_Pin|MOD2_GPIO2_Pin
|WIFI_EN_Pin, GPIO_PIN_RESET);
/*Configure GPIO pin Output Level */
HAL_GPIO_WritePin(GPIOA, MOD1_GPIO2_Pin|LCD_BL_Pin, GPIO_PIN_RESET);
/*Configure GPIO pin Output Level */
HAL_GPIO_WritePin(GPIOB, MOD2_GPIO1_Pin|MOD4_GPIO1_Pin|LCD_RST_Pin, GPIO_PIN_RESET);
/*Configure GPIO pins : LCD_A0_Pin MOD4_GPIO2_Pin MOD3_GPIO2_Pin MOD2_GPIO2_Pin
WIFI_EN_Pin */
GPIO_InitStruct.Pin = LCD_A0_Pin|MOD4_GPIO2_Pin|MOD3_GPIO2_Pin|MOD2_GPIO2_Pin
|WIFI_EN_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
/*Configure GPIO pins : MOD1_GPIO2_Pin LCD_BL_Pin */
GPIO_InitStruct.Pin = MOD1_GPIO2_Pin|LCD_BL_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
/*Configure GPIO pins : MOD2_GPIO1_Pin MOD4_GPIO1_Pin LCD_RST_Pin */
GPIO_InitStruct.Pin = MOD2_GPIO1_Pin|MOD4_GPIO1_Pin|LCD_RST_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
/*Configure GPIO pins : SW_D_Pin SW_E_Pin */
GPIO_InitStruct.Pin = SW_D_Pin|SW_E_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
// Configure pins for I2C
GPIO_InitStruct.Pin = GPIO_PIN_8|GPIO_PIN_9;
GPIO_InitStruct.Mode = GPIO_MODE_AF_OD;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
/*Configure GPIO pin : VCAP1_Pin */
GPIO_InitStruct.Pin = VCAP1_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
HAL_GPIO_Init(VCAP1_GPIO_Port, &GPIO_InitStruct);
/*Configure GPIO pin : BATT_STAT_Pin */
GPIO_InitStruct.Pin = BATT_STAT_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(BATT_STAT_GPIO_Port, &GPIO_InitStruct);
/*Configure GPIO pin : SW_A_Pin */
GPIO_InitStruct.Pin = SW_A_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(SW_A_GPIO_Port, &GPIO_InitStruct);
/*Configure GPIO pin : SW_B_Pin */
GPIO_InitStruct.Pin = SW_B_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(SW_B_GPIO_Port, &GPIO_InitStruct);
/*Configure GPIO pin : SW_C_Pin */
GPIO_InitStruct.Pin = SW_C_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
//.........这里部分代码省略.........
开发者ID:PaxInstruments,项目名称:PaxInstruments-LabWiz-firmware,代码行数:101,代码来源:labwiz_entry.c
示例15: MX_GPIO_Init
/** Configure pins as
* Analog
* Input
* Output
* EVENT_OUT
* EXTI
*/
void MX_GPIO_Init(void)
{
GPIO_InitTypeDef GPIO_InitStruct;
/* GPIO Ports Clock Enable */
__GPIOC_CLK_ENABLE();
__GPIOA_CLK_ENABLE();
__GPIOB_CLK_ENABLE();
__GPIOD_CLK_ENABLE();
/*Configure GPIO pin : ACC_INT2_Pin */
GPIO_InitStruct.Pin = ACC_INT2_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING_FALLING;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(ACC_INT2_GPIO_Port, &GPIO_InitStruct);
/*Configure GPIO pin : nDISCHARGE_Pin */
GPIO_InitStruct.Pin = nDISCHARGE_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_PULLUP;
GPIO_InitStruct.Speed = GPIO_SPEED_VERY_LOW;
HAL_GPIO_Init(nDISCHARGE_GPIO_Port, &GPIO_InitStruct);
/*Configure GPIO pins : PWR_TO_2_8V_Pin ENABLE_2_5V_Pin INDICATOR2_Pin WIFI_PWR_Pin */
GPIO_InitStruct.Pin = PWR_TO_2_8V_Pin|ENABLE_2_5V_Pin|INDICATOR2_Pin|WIFI_PWR_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_VERY_LOW;
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
/*Configure GPIO pin : ACC_INT1_Pin */
GPIO_InitStruct.Pin = ACC_INT1_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING_FALLING;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(ACC_INT1_GPIO_Port, &GPIO_InitStruct);
/*Configure GPIO pins : STATUS_Pin ACC_CS_Pin HALL_CLAMP_PWR_Pin INDICATOR3_Pin */
GPIO_InitStruct.Pin = STATUS_Pin|ACC_CS_Pin|HALL_CLAMP_PWR_Pin|INDICATOR3_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_VERY_LOW;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
/*Configure GPIO pins : SENS_CLAMP_A_Pin SENS_TAKEOFF_Pin */
GPIO_InitStruct.Pin = SENS_CLAMP_A_Pin|SENS_TAKEOFF_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
GPIO_InitStruct.Pull = GPIO_PULLUP;
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
/*Configure GPIO pins : SHUNT_0_06_DISABLE_Pin RF_CE_Pin */
GPIO_InitStruct.Pin = SHUNT_0_06_DISABLE_Pin|RF_CE_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_PULLDOWN;
GPIO_InitStruct.Speed = GPIO_SPEED_VERY_LOW;
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
/*Configure GPIO pin : HALL_SENS_PWR_Pin */
GPIO_InitStruct.Pin = HALL_SENS_PWR_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_PULLUP;
GPIO_InitStruct.Speed = GPIO_SPEED_VERY_LOW;
HAL_GPIO_Init(HALL_SENS_PWR_GPIO_Port, &GPIO_InitStruct);
/*Configure GPIO pins : RF_PWR_Pin SD_PWR_Pin */
GPIO_InitStruct.Pin = RF_PWR_Pin|SD_PWR_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_PULLUP;
GPIO_InitStruct.Speed = GPIO_SPEED_VERY_LOW;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
/*Configure GPIO pins : PWR_TO2_8AND2_9V_Pin INDICATOR1_Pin */
GPIO_InitStruct.Pin = PWR_TO2_8AND2_9V_Pin|INDICATOR1_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_VERY_LOW;
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
/*Configure GPIO pins : SENS_CLAMP_B_Pin RF_IRQ_Pin SENS_OPEN_Pin */
GPIO_InitStruct.Pin = SENS_CLAMP_B_Pin|RF_IRQ_Pin|SENS_OPEN_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
GPIO_InitStruct.Pull = GPIO_PULLUP;
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
/*Configure GPIO pin Output Level */
HAL_GPIO_WritePin(GPIOC, nDISCHARGE_Pin|WIFI_PWR_Pin, GPIO_PIN_SET);
/*Configure GPIO pin Output Level */
HAL_GPIO_WritePin(GPIOC, PWR_TO_2_8V_Pin|ENABLE_2_5V_Pin|INDICATOR2_Pin, GPIO_PIN_RESET);
/*Configure GPIO pin Output Level */
HAL_GPIO_WritePin(GPIOA, STATUS_Pin|ACC_CS_Pin|HALL_CLAMP_PWR_Pin|INDICATOR3_Pin, GPIO_PIN_RESET);
//.........这里部分代码省略.........
开发者ID:mrengineer,项目名称:KaijaSensor,代码行数:101,代码来源:main.c
示例16: switch_led
void switch_led(uint8_t led, bool state)
{
HAL_GPIO_WritePin(leds[led].port, leds[led].pin, state ? GPIO_PIN_SET : GPIO_PIN_RESET);
}
开发者ID:drmetal,项目名称:lollyjar,代码行数:4,代码来源:leds.c
示例17: MX_GPIO_Init
/** Configure pins as
* Analog
* Input
* Output
* EVENT_OUT
* EXTI
PC3 ------> I2S2_SD
PA4 ------> I2S3_WS
PA5 ------> SPI1_SCK
PA6 ------> SPI1_MISO
PA7 ------> SPI1_MOSI
PB10 ------> I2S2_CK
PC7 ------> I2S3_MCK
PC10 ------> I2S3_CK
PC12 ------> I2S3_SD
PB6 ------> I2C1_SCL
PB9 ------> I2C1_SDA
*/
void MX_GPIO_Init(void)
{
GPIO_InitTypeDef GPIO_InitStruct;
/* GPIO Ports Clock Enable */
__GPIOE_CLK_ENABLE();
__GPIOC_CLK_ENABLE();
__GPIOH_CLK_ENABLE();
__GPIOA_CLK_ENABLE();
__GPIOB_CLK_ENABLE();
__GPIOD_CLK_ENABLE();
/*Configure GPIO pin Output Level */
HAL_GPIO_WritePin(CS_I2C_SPI_GPIO_Port, CS_I2C_SPI_Pin, GPIO_PIN_RESET);
/*Configure GPIO pin Output Level */
HAL_GPIO_WritePin(OTG_FS_PowerSwitchOn_GPIO_Port, OTG_FS_PowerSwitchOn_Pin, GPIO_PIN_RESET);
/*Configure GPIO pin Output Level */
HAL_GPIO_WritePin(GPIOD, LD4_Pin|LD3_Pin|LD5_Pin|LD6_Pin
|Audio_RST_Pin, GPIO_PIN_RESET);
/*Configure GPIO pin : PtPin */
GPIO_InitStruct.Pin = CS_I2C_SPI_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_LOW;
HAL_GPIO_Init(CS_I2C_SPI_GPIO_Port, &GPIO_InitStruct);
/*Configure GPIO pin : PtPin */
GPIO_InitStruct.Pin = OTG_FS_PowerSwitchOn_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_LOW;
HAL_GPIO_Init(OTG_FS_PowerSwitchOn_GPIO_Port, &GPIO_InitStruct);
/*Configure GPIO pin : PtPin */
GPIO_InitStruct.Pin = PDM_OUT_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_LOW;
GPIO_InitStruct.Alternate = GPIO_AF5_SPI2;
HAL_GPIO_Init(PDM_OUT_GPIO_Port, &GPIO_InitStruct);
/*Configure GPIO pin : PA4 */
GPIO_InitStruct.Pin = GPIO_PIN_4;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_LOW;
GPIO_InitStruct.Alternate = GPIO_AF6_SPI3;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
/*Configure GPIO pins : PA5 PA6 PA7 */
GPIO_InitStruct.Pin = GPIO_PIN_5|GPIO_PIN_6|GPIO_PIN_7;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_LOW;
GPIO_InitStruct.Alternate = GPIO_AF5_SPI1;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
/*Configure GPIO pin : PtPin */
GPIO_InitStruct.Pin = BOOT1_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(BOOT1_GPIO_Port, &GPIO_InitStruct);
/*Configure GPIO pin : PtPin */
GPIO_InitStruct.Pin = CLK_IN_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_LOW;
GPIO_InitStruct.Alternate = GPIO_AF5_SPI2;
HAL_GPIO_Init(CLK_IN_GPIO_Port, &GPIO_InitStruct);
/*Configure GPIO pins : PDPin PDPin PDPin PDPin
PDPin */
GPIO_InitStruct.Pin = LD4_Pin|LD3_Pin|LD5_Pin|LD6_Pin
|Audio_RST_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_PULLUP;
GPIO_InitStruct.Speed = GPIO_SPEED_LOW;
//.........这里部分代码省略.........
开发者ID:Vadim-Stupakov,项目名称:ProjectX,代码行数:101,代码来源:gpio.c
示例18: HAL_GPIO_EXTI_Callback
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) {
if(GPIO_Pin == GPIO_PIN_13)
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5, SET);
else
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5, RESET);
}
开发者ID:Shreeyak,项目名称:mastering-stm32,代码行数:6,代码来源:main-ex2.c
示例19: prvADC_CS_LOW
/**
* @brief Pull the CS pin LOW
* @param None
* @retval None
*/
static inline void prvADC_CS_LOW()
{
HAL_GPIO_WritePin(ADC_PORT, ADC_CS_PIN, GPIO_PIN_RESET);
}
开发者ID:hampussandberg,项目名称:HexConnect,代码行数:9,代码来源:max1301.c
示例20: compare_user_actual_angle
/**
* @brief A function used to compare user input angle with the actual angle, and blink LEDs accordingly
* @param none
* @retval
*/
void compare_user_actual_angle(void)
{
float neg_roll = roll*(-1);
float neg_threshold = threshold*(-1);
//check if the threshold has been set
if(threshold_set_flag) {
//if less than the threshold, blink LD3(orange) to tell user to lower the board in that direction
if((roll > 0 && roll < (threshold-THRESHOLD_TOLERANCE)) || (roll < 0 && roll < (neg_threshold-THRESHOLD_TOLERANCE))) {
if(count_for_animation>=700 && count_for_animation<1000) {
HAL_GPIO_WritePin(GPIOD, GPIO_PIN_13, GPIO_PIN_RESET);
} else {
HAL_GPIO_WritePin(GPIOD, GPIO_PIN_13, GPIO_PIN_SET);
}
HAL_GPIO_WritePin(GPIOD, GPIO_PIN_12 | GPIO_PIN_14 | GPIO_PIN_15, GPIO_PIN_RESET);
//if less than the threshold, blink LD6(blue) to tell user to lower the board in that direction
} else if((roll > 0 && roll > (threshold+THRESHOLD_TOLERANCE)) || (roll < 0 && roll > (neg_threshold+THRESHOLD_TOLERANCE))) {
if(count_for_animation>=700 && count_for_animation<1000) {
HAL_GPIO_WritePin(GPIOD, GPIO_PIN_15, GPIO_PIN_RESET);
} else {
HAL_GPIO_WritePin(GPIOD, GPIO_PIN_15, GPIO_PIN_SET);
}
HAL_GPIO_WritePin(GPIOD, GPIO_PIN_13 | GPIO_PIN_14 | GPIO_PIN_12, GPIO_PIN_RESET);
//if within range, blink all LEDs to tell user that the board pitch/roll angle is within defined range
} else {
if(count_for_animation>=700 && count_for_animation<1000) {
HAL_GPIO_WritePin(GPIOD, GPIO_PIN_12 | GPIO_PIN_13 | GPIO_PIN_14 | GPIO_PIN_15, GPIO_PIN_RESET);
} else {
HAL_GPIO_WritePin(GPIOD, GPIO_PIN_12, GPIO_PIN_SET);
HAL_GPIO_WritePin(GPIOD, GPIO_PIN_13, GPIO_PIN_SET);
HAL_GPIO_WritePin(GPIOD, GPIO_PIN_14, GPIO_PIN_SET);
HAL_GPIO_WritePin(GPIOD, GPIO_PIN_15, GPIO_PIN_SET);
}
}
count_for_animation++;
//reset the counter to 0
if(count_for_animation==1000) count_for_animation = 0;
}
}
开发者ID:RichardCheung1,项目名称:ECSE426-Microprocessor-Systems,代码行数:52,代码来源:accelerometer.c
注:本文中的HAL_GPIO_WritePin函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论