本文整理汇总了C++中STM_EVAL_PBInit函数的典型用法代码示例。如果您正苦于以下问题:C++ STM_EVAL_PBInit函数的具体用法?C++ STM_EVAL_PBInit怎么用?C++ STM_EVAL_PBInit使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了STM_EVAL_PBInit函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
/**
* @brief Main program.
* @param None
* @retval None
*/
int main( void )
{
/* At this stage the microcontroller clock setting is already configured to
120 MHz, this is done through SystemInit() function which is called from
startup file (startup_stm32f2xx.S) before to branch to application main.
To reconfigure the default setting of SystemInit() function, refer to
system_stm32f2xx.c file
*/
/* USART Configuration */
DebugComPort_Init();
/* Initialize buttons */
STM_EVAL_PBInit( BUTTON_WAKEUP, BUTTON_MODE_EXTI );
STM_EVAL_PBInit( BUTTON_TAMPER, BUTTON_MODE_EXTI );
STM_EVAL_PBInit( BUTTON_KEY , BUTTON_MODE_EXTI );
STM_EVAL_PBInit( BUTTON_RIGHT , BUTTON_MODE_EXTI );
/* Initialize SPI */
STM_EVAL_SPI_Init();
printf("\ntest tracing from embedded code\n");
/* Handle buttons */
xTaskCreate( HandleButtons_task, (const signed char* const)"BTN", configMINIMAL_STACK_SIZE, NULL, BTN_TASK_PRIO, NULL );
/* Start scheduler */
vTaskStartScheduler();
/* We should never get here as control is now taken by the scheduler */
for(;;);
}
示例2: prvSetupHardware
static void prvSetupHardware( void )
{
/* Ensure that all 4 interrupt priority bits are used as the pre-emption
priority. */
NVIC_PriorityGroupConfig( NVIC_PriorityGroup_4 );
/* Initialise the LEDs. */
vParTestInitialise();
/* Initialise the joystick inputs. */
STM_EVAL_PBInit( BUTTON_UP, BUTTON_MODE_GPIO );
STM_EVAL_PBInit( BUTTON_DOWN, BUTTON_MODE_GPIO );
STM_EVAL_PBInit( BUTTON_LEFT, BUTTON_MODE_GPIO );
STM_EVAL_PBInit( BUTTON_RIGHT, BUTTON_MODE_GPIO );
/* The select button in the middle of the joystick is configured to generate
an interrupt. The Eval board library will configure the interrupt
priority to be the lowest priority available so the priority need not be
set here explicitly. It is important that the priority is equal to or
below that set by the configMAX_SYSCALL_INTERRUPT_PRIORITY value set in
FreeRTOSConfig.h. */
STM_EVAL_PBInit( BUTTON_SEL, BUTTON_MODE_EXTI );
/* Initialize the LCD */
STM32L152_LCD_Init();
LCD_Clear( Blue );
LCD_SetBackColor( Blue );
LCD_SetTextColor( White );
LCD_DisplayStringLine( Line0, " www.FreeRTOS.org" );
}
示例3: StopMode_Measure
/**
* @brief This function configures the system to enter Stop mode for
* current consumption measurement purpose.
* STOP Mode
* =========
* - Regulator in LP mode
* - LSI, HSI and HSE OFF
* - No IWDG
* - Current Consumption ~0.5uA
* - Wakeup using EXTI Line (Key Button PA.00)
* @param None
* @retval None
*/
void StopMode_Measure(void)
{
/* Configure all GPIO as analog to reduce current consumption on non used IOs */
/* Enable GPIOs clock */
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA | RCC_AHBPeriph_GPIOB | RCC_AHBPeriph_GPIOC |
RCC_AHBPeriph_GPIOD | RCC_AHBPeriph_GPIOE | RCC_AHBPeriph_GPIOH |
RCC_AHBPeriph_GPIOF | RCC_AHBPeriph_GPIOG, ENABLE);
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AN;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_40MHz;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_All;
GPIO_Init(GPIOC, &GPIO_InitStructure);
GPIO_Init(GPIOD, &GPIO_InitStructure);
GPIO_Init(GPIOE, &GPIO_InitStructure);
GPIO_Init(GPIOH, &GPIO_InitStructure);
GPIO_Init(GPIOF, &GPIO_InitStructure);
GPIO_Init(GPIOG, &GPIO_InitStructure);
GPIO_Init(GPIOA, &GPIO_InitStructure);
GPIO_Init(GPIOB, &GPIO_InitStructure);
/* Disable GPIOs clock */
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA | RCC_AHBPeriph_GPIOB | RCC_AHBPeriph_GPIOC |
RCC_AHBPeriph_GPIOD | RCC_AHBPeriph_GPIOE | RCC_AHBPeriph_GPIOH |
RCC_AHBPeriph_GPIOF | RCC_AHBPeriph_GPIOG, DISABLE);
/* Configure Key Button*/
STM_EVAL_PBInit(BUTTON_KEY, BUTTON_MODE_GPIO);
/* Wait Until Key button pressed */
while(STM_EVAL_PBGetState(BUTTON_KEY) == RESET)
{
}
/* Wait Until Key button pressed */
while(STM_EVAL_PBGetState(BUTTON_KEY) != RESET)
{
}
/* Configure Key Button*/
STM_EVAL_PBInit(BUTTON_KEY, BUTTON_MODE_EXTI);
/* Enable Ultra low power mode */
PWR_UltraLowPowerCmd(ENABLE);
/* Enter Stop Mode */
PWR_EnterSTOPMode(PWR_Regulator_LowPower, PWR_STOPEntry_WFI);
/* Initialize LED1 on STM32L152-EVAL board */
STM_EVAL_LEDInit(LED1);
/* Infinite loop */
while (1)
{
/* Toggle The LED1 */
STM_EVAL_LEDToggle(LED1);
/* Inserted Delay */
for(index = 0; index < 0x5FF; index++);
}
}
示例4: STM_EVAL_JOYInit
void STM_EVAL_JOYInit(void)
{
STM_EVAL_PBInit(BUTTON_SEL, BUTTON_MODE_GPIO);
STM_EVAL_PBInit(BUTTON_UP, BUTTON_MODE_GPIO);
STM_EVAL_PBInit(BUTTON_DOWN, BUTTON_MODE_GPIO);
STM_EVAL_PBInit(BUTTON_RIGHT, BUTTON_MODE_GPIO);
STM_EVAL_PBInit(BUTTON_LEFT, BUTTON_MODE_GPIO);
}
示例5: main
/**
* @brief Main program.
* @param None
* @retval None
*/
void main(void)
{
/* CLK configuration -------------------------------------------*/
CLK_Config();
/* Init TIM2 to generate 1 ms time base update interrupt */
TimingDelay_Init();
/* Enable Interrupts */
enableInterrupts();
/* Initialize LEDs mounted on STM8L152X-EVAL board */
STM_EVAL_LEDInit(LED1);
STM_EVAL_LEDInit(LED2);
STM_EVAL_LEDInit(LED3);
STM_EVAL_LEDInit(LED4);
/* Turn on LED1 and LED3 */
STM_EVAL_LEDOn(LED1);
STM_EVAL_LEDOn(LED3);
/* Initialize push-buttons mounted on STM8L152X-EVAL board */
STM_EVAL_PBInit(BUTTON_RIGHT, BUTTON_MODE_EXTI);
STM_EVAL_PBInit(BUTTON_LEFT, BUTTON_MODE_EXTI);
STM_EVAL_PBInit(BUTTON_UP, BUTTON_MODE_EXTI);
STM_EVAL_PBInit(BUTTON_DOWN, BUTTON_MODE_EXTI);
/* Init the Eval board LCD */
STM8_EVAL_LCD_Init();
/* Clear LCD */
LCD_Clear();
/* Enable general interrupts */
enableInterrupts();
LCD_SetCursorPos(LCD_LINE1, 0);
LCD_Print(" System Clock ");
LCD_SetCursorPos(LCD_LINE2, 0);
LCD_Print(" Source: HSE ");
while (1)
{
/* Toggle LED2 and LED4 */
STM_EVAL_LEDToggle(LED2);
STM_EVAL_LEDToggle(LED4);
/* Insert a delay */
Delay(10);
/* Toggle LED1 and LED3 */
STM_EVAL_LEDToggle(LED1);
STM_EVAL_LEDToggle(LED3);
/* Insert a delay */
Delay(10);
}
}
示例6: main
/**
* @brief Main program.
* @param None
* @retval None
*/
int main(void)
{
/*!< At this stage the microcontroller clock setting is already configured,
this is done through SystemInit() function which is called from startup
files (startup_stm32f40_41xxx.s/startup_stm32f427_437xx.s/startup_stm32f429_439xx.s)
before to branch to application main.
*/
/* Initialize the LCD */
LCD_Init();
/* Clear the LCD */
LCD_Clear(White);
/* Set the LCD Back Color */
LCD_SetBackColor(Blue);
/* Set the LCD Text Color */
LCD_SetTextColor(White);
/* Displays MESSAGE1 on line 0 */
LCD_DisplayStringLine(LINE(0), (uint8_t *)MESSAGE1);
/* RTC configuration */
RTC_Config();
/* Set the LCD Text Color */
LCD_SetTextColor(Red);
/* Displays a rectangle on the LCD */
LCD_DrawRect(80, 290, 25, 240 );
/* Configure the external interrupt "KEY", "WAKEUP" and "TAMPER" buttons */
STM_EVAL_PBInit(BUTTON_KEY, BUTTON_MODE_EXTI);
STM_EVAL_PBInit(BUTTON_WAKEUP, BUTTON_MODE_EXTI);
STM_EVAL_PBInit(BUTTON_TAMPER, BUTTON_MODE_EXTI);
/* Configure RTC alarm A register to generate 8 interrupts per 1 Second */
RTC_AlarmConfig();
/* set LCD Font */
LCD_SetFont(&Font12x12);
/* Set the LCD Back Color */
LCD_SetBackColor(White);
/* Set the LCD Text Color */
LCD_SetTextColor(Black);
/* Displays MESSAGE2 and MESSAGE3 on the LCD */
LCD_DisplayStringLine(LINE(18), (uint8_t *)MESSAGE2);
LCD_DisplayStringLine(LINE(19), (uint8_t *)MESSAGE3);
/* Infinite loop */
while (1)
{}
}
示例7: main
/**
* @brief Main program.
* @param None
* @retval None
*/
void main(void)
{
/* Initialize LED1 and LED2 mounted on STM8L152X-EVAL board */
STM_EVAL_LEDInit(LED1);
STM_EVAL_LEDInit(LED2);
/* Initialize Key and Joystick down push-buttons mounted on STM8L152X-EVAL board */
STM_EVAL_PBInit(BUTTON_KEY, BUTTON_MODE_EXTI);
STM_EVAL_PBInit(BUTTON_DOWN, BUTTON_MODE_EXTI);
/* enable interrupts */
enableInterrupts();
/* Check if the MCU has resumed from WWDG reset */
if (RST_GetFlagStatus(RST_FLAG_WWDGF) != RESET)
{
/* WWDGF flag set */
/* Toggle LED1 */
for (Index = 7; Index != 0; Index--)
{
STM_EVAL_LEDToggle(LED1);
Delay(0x7FFF);
}
/* Clear WWDGF Flag */
RST_ClearFlag(RST_FLAG_WWDGF);
}
/* WWDG Configuration */
WWDG_Config();
while (1)
{
/* Check if WWDG counter refresh is allowed in Allowed window */
if (AllowedRefresh != DISABLE)
{
/* get WWDG counter value */
/* wait until WWDG counter becomes lower than window value */
while ((WWDG_GetCounter() & 0x7F) > WINDOW_VALUE);
/* Refresh WWDG counter during allowed window so no MCU reset will occur */
WWDG_SetCounter(COUNTER_INIT);
}
/* Check if WWDG counter refresh is allowed in non Allowed window */
if (NonAlowedRefresh != DISABLE)
{
/* wait until WWDG counter becomes higher than window value */
while ((WWDG_GetCounter() & 0x7F) < WINDOW_VALUE);
/* Refresh WWDG counter during non allowed window so MCU reset will occur */
WWDG_SetCounter(COUNTER_INIT);
}
/* Toggle LED2 */
STM_EVAL_LEDToggle(LED2);
Delay(0x6FFF);
}
}
示例8: main
/**
* @brief Main program
* @param None
* @retval None
*/
int main(void)
{
/*!< At this stage the microcontroller clock setting is already configured,
this is done through SystemInit() function which is called from startup
file (startup_stm32l1xx_xx.s) before to branch to application main.
To reconfigure the default setting of SystemInit() function, refer to
system_stm32l1xx.c file
*/
/* Initialize Leds mounted on STM32L1xx-EVAL board */
STM_EVAL_LEDInit(LED1);
STM_EVAL_LEDInit(LED2);
STM_EVAL_LEDInit(LED3);
STM_EVAL_LEDInit(LED4);
/* Initialize the KEY and SEL buttons mounted on STM32L1xx-EVAL board */
STM_EVAL_PBInit(BUTTON_KEY, BUTTON_MODE_GPIO);
STM_EVAL_PBInit(BUTTON_SEL, BUTTON_MODE_EXTI);
/* TIM configuration -------------------------------------------------------*/
TIM_Config();
while (1)
{
/* Wait until KEY button is pressed. */
while(STM_EVAL_PBGetState(BUTTON_KEY) == RESET)
{
}
while(STM_EVAL_PBGetState(BUTTON_KEY) != RESET)
{
}
/* This instruction raises the execution priority to 0. This prevents all
exceptions with configurable priority from activating, other than through
the HardFault fault escalation mechanism. */
__disable_irq();
/* Turn LED4 ON */
STM_EVAL_LEDOn(LED4);
/* Wait until KEY button is pressed. */
while(STM_EVAL_PBGetState(BUTTON_KEY) == RESET)
{
}
while(STM_EVAL_PBGetState(BUTTON_KEY) != RESET)
{
}
/* This instruction will allow all exceptions with configurable priority to
be activated. */
__enable_irq();
/* Turn LED4 OFF */
STM_EVAL_LEDOff(LED4);
}
}
示例9: GPIO_Config
/**
* @brief Configure GPIO for buttons available on the evaluation board
* @param None
* @retval None
*/
static void GPIO_Config(void)
{
/* Configure GPIO used to drive the joystick
JOYSTICK_UP --> PB6
JOYSTICK_DOWN --> PB7
JOYSTICK_RIGHT --> PB5
*/
STM_EVAL_PBInit(BUTTON_UP, BUTTON_MODE_EXTI);
STM_EVAL_PBInit(BUTTON_DOWN, BUTTON_MODE_EXTI);
STM_EVAL_PBInit(BUTTON_RIGHT, BUTTON_MODE_EXTI);
}
示例10: main
/**
* @brief Main program
* @param None
* @retval None
*/
int main(void)
{
/*!< At this stage the microcontroller clock setting is already configured,
this is done through SystemInit() function which is called from startup
files (startup_stm32f40_41xxx.s/startup_stm32f427_437xx.s/startup_stm32f429_439xx.s)
before to branch to application main.
To reconfigure the default setting of SystemInit() function, refer to
system_stm32f4xx.c file
*/
/* NVIC configuration ------------------------------------------------------*/
NVIC_Config();
/* Initialize LEDs mounted on EVAL board */
STM_EVAL_LEDInit(LED1);
STM_EVAL_LEDInit(LED2);
STM_EVAL_LEDInit(LED3);
STM_EVAL_LEDInit(LED4);
/* Initialize the KEY/Tamper and Wakeup buttons mounted on EVAL board */
STM_EVAL_PBInit(BUTTON_KEY_TAMPER, BUTTON_MODE_EXTI);
STM_EVAL_PBInit(BUTTON_WAKEUP, BUTTON_MODE_EXTI);
/* Configure the SysTick Handler Priority: Preemption priority and subpriority */
NVIC_SetPriority(SysTick_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(), !ubPreemptionPriorityValue, 0));
while (1)
{
if(ubPreemptionOccurred != 0)
{
/* Toggle LED1 */
STM_EVAL_LEDToggle(LED1);
/* Insert delay Time */
Delay(0x5FFFF);
/* Toggle LED2 */
STM_EVAL_LEDToggle(LED2);
Delay(0x5FFFF);
/* Toggle LED3 */
STM_EVAL_LEDToggle(LED3);
Delay(0x5FFFF);
/* Toggle LED4 */
STM_EVAL_LEDToggle(LED4);
Delay(0x5FFFF);
}
}
}
示例11: main
/**
* @brief Main program.
* @param None
* @retval None
*/
int main(void)
{
/*!< At this stage the microcontroller clock setting is already configured,
this is done through SystemInit() function which is called from startup
file (startup_stm32f10x_xx.s) before to branch to application main.
To reconfigure the default setting of SystemInit() function, refer to
system_stm32f10x.c file
*/
/* Initialize LED1..LED4, Key and Wakeup Buttons mounted on STM3210X-EVAL
board */
STM_EVAL_LEDInit(LED1);
STM_EVAL_LEDInit(LED2);
STM_EVAL_LEDInit(LED3);
STM_EVAL_LEDInit(LED4);
STM_EVAL_PBInit(BUTTON_KEY, BUTTON_MODE_EXTI);
STM_EVAL_PBInit(BUTTON_WAKEUP, BUTTON_MODE_EXTI);
/* Configure one bit for preemption priority */
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_1);
/* Enable the WAKEUP_BUTTON_EXTI_IRQn Interrupt */
NVIC_InitStructure.NVIC_IRQChannel = WAKEUP_BUTTON_EXTI_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = PreemptionPriorityValue;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
/* Enable the KEY_BUTTON_EXTI_IRQn Interrupt */
NVIC_InitStructure.NVIC_IRQChannel = KEY_BUTTON_EXTI_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
/* Configure the SysTick Handler Priority: Preemption priority and subpriority */
NVIC_SetPriority(SysTick_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(), !PreemptionPriorityValue, 0));
while (1)
{
if(PreemptionOccured != FALSE)
{
STM_EVAL_LEDToggle(LED1);
Delay(0x5FFFF);
STM_EVAL_LEDToggle(LED2);
Delay(0x5FFFF);
STM_EVAL_LEDToggle(LED3);
Delay(0x5FFFF);
STM_EVAL_LEDToggle(LED4);
Delay(0x5FFFF);
}
}
}
示例12: main
/**
* @brief Main program.
* @param None
* @retval None
*/
int main(void)
{
/*!< At this stage the microcontroller clock setting is already configured,
this is done through SystemInit() function which is called from startup
file (startup_stm32f10x_xx.s) before to branch to application main.
To reconfigure the default setting of SystemInit() function, refer to
system_stm32f10x.c file
*/
/* NVIC configuration ------------------------------------------------------*/
NVIC_Config();
/* Initialize LED1..LED4, Key and Sel Joystick Buttons mounted on STM3210X-EVAL
board */
STM_EVAL_LEDInit(LED1);
STM_EVAL_LEDInit(LED2);
STM_EVAL_LEDInit(LED3);
STM_EVAL_LEDInit(LED4);
STM_EVAL_PBInit(BUTTON_KEY, BUTTON_MODE_EXTI);
STM_EVAL_PBInit(BUTTON_WAKEUP, BUTTON_MODE_EXTI);
/* Configure the SysTick Handler Priority: Preemption priority and subpriority */
NVIC_SetPriority(SysTick_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(), !PreemptionPriorityValue, 0));
while (1)
{
if(PreemptionOccured != 0)
{
/* Toggel The lED1 */
STM_EVAL_LEDToggle(LED1);
/* Insert delay Time */
Delay(0x5FFFF);
STM_EVAL_LEDToggle(LED2);
Delay(0x5FFFF);
STM_EVAL_LEDToggle(LED3);
Delay(0x5FFFF);
STM_EVAL_LEDToggle(LED4);
Delay(0x5FFFF);
}
}
}
示例13: main
/**
* @brief Main program.
* @param None
* @retval None
*/
int main(void)
{
/*!< At this stage the microcontroller clock setting is already configured,
this is done through SystemInit() function which is called from startup
file (startup_stm32f0xx.s) before to branch to application main.
To reconfigure the default setting of SystemInit() function, refer to
system_stm32f0xx.c file
*/
/* LCD Display init */
Display_Init();
/* Key button and Tamper button configuration */
#ifdef USE_STM320518_EVAL
STM_EVAL_PBInit(BUTTON_KEY, BUTTON_MODE_GPIO);
#else
STM_EVAL_PBInit(BUTTON_TAMPER, BUTTON_MODE_GPIO);
#endif /* USE_STM320518_EVAL */
/* Configures LED1 GPIO */
STM_EVAL_LEDInit(LED1);
/* Configure ADC1 */
ADC_Config();
/* Configure TIM3 */
TIM_Config();
/* Infinite loop */
while (1)
{
/* Press Key button for STM320518_EVAL and Tamper button for STM32072B_EVAL to get the converted data */
#ifdef USE_STM320518_EVAL
while(STM_EVAL_PBGetState(BUTTON_KEY) != RESET);
#else
while(STM_EVAL_PBGetState(BUTTON_TAMPER) != RESET);
#endif /* USE_STM320518_EVAL */
/* Get ADC1 converted data */
ADC1ConvertedValue =ADC_GetConversionValue(ADC1);
/* Compute the voltage */
ADC1ConvertedVoltage = (ADC1ConvertedValue *3300)/0xFFF;
/* Display converted data on the LCD */
Display();
}
}
示例14: main
/**
* @brief Main program
* @param None
* @retval None
*/
int main(void)
{
/*!< At this stage the microcontroller clock setting is already configured,
this is done through SystemInit() function which is called from startup
files (startup_stm32f40_41xxx.s/startup_stm32f427_437xx.s/startup_stm32f429_439xx.s)
before to branch to application main.
To reconfigure the default setting of SystemInit() function, refer to
system_stm32f4xx.c file
*/
/* Initialize LEDs mounted on EVAL board */
STM_EVAL_LEDInit(LED1);
STM_EVAL_LEDInit(LED2);
/* Initialize Key Button mounted on EVAL board */
STM_EVAL_PBInit(BUTTON_KEY, BUTTON_MODE_EXTI);
/* RTC configuration */
RTC_Config();
/* Turn on LED1 */
STM_EVAL_LEDOn(LED1);
/* Enable WKUP pin */
PWR_WakeUpPinCmd(ENABLE);
/* Configure the SysTick to generate an interrupt each 250 ms */
SysTick_Configuration();
while (1)
{
}
}
示例15: pushbutton_init
/** @brief button interrupt initialization */
void
pushbutton_init (void)
{
/* Initialize USER Buttons with interrupt capability */
// Pressing the button causes an interrupt
STM_EVAL_PBInit (BUTTON_USER, BUTTON_MODE_EXTI);
}