本文整理汇总了C++中STM_EVAL_PBGetState函数的典型用法代码示例。如果您正苦于以下问题:C++ STM_EVAL_PBGetState函数的具体用法?C++ STM_EVAL_PBGetState怎么用?C++ STM_EVAL_PBGetState使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了STM_EVAL_PBGetState函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: userTask
void userTask(void *param)
{
NetInterface* nif = param;
//Endless loop
while(1)
{
// was DHCP succesfull and is link up?
if(nif->ipv4Config.addr != 0 && nif->linkState)
{
STM_EVAL_LEDOn(LED4);
}
else
{
STM_EVAL_LEDOff(LED4);
}
//User button pressed?
if(STM_EVAL_PBGetState(BUTTON_USER))
{
STM_EVAL_LEDOn(LED3);
//HTTP client test routine
httpClientTest();
STM_EVAL_LEDOff(LED3);
//Wait for the user button to be released
while(STM_EVAL_PBGetState(BUTTON_USER));
}
//100ms delay
osDelay(100);
}
}
示例2: 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++);
}
}
示例3: StandbyMode_Measure
/**
* @brief This function configures the system to enter Standby mode for
* current consumption measurement purpose.
* STANDBY Mode
* ============
* - IWDG and LSI OFF
* - Current Consumption ~0.3uA
* - Wakeup using WakeUp Pin 1 (PA.00)
* @param None
* @retval None
*/
void StandbyMode_Measure(void)
{
/* 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)
{
}
/* Enable Ultra low power mode */
PWR_UltraLowPowerCmd(ENABLE);
/* Clear PWR WakeUp flag */
PWR_ClearFlag(PWR_FLAG_WU);
/* Enable WKUP pin 1 */
PWR_WakeUpPinCmd(PWR_WakeUpPin_1, ENABLE);
/* Request to enter STANDBY mode */
PWR_EnterSTANDBYMode();
/* Infinite loop */
while (1)
{
}
}
示例4: userTask
void userTask(void *param)
{
char_t buffer[40];
//Point to the network interface
NetInterface *interface = &netInterface[0];
//Initialize LCD display
lcdSetCursor(2, 0);
printf("IPv4 Addr\r\n");
lcdSetCursor(5, 0);
printf("Press user button\r\nto run test\r\n");
//Endless loop
while(1)
{
//Display IPv4 host address
lcdSetCursor(3, 0);
printf("%-16s\r\n", ipv4AddrToString(interface->ipv4Config.addr, buffer));
//User button pressed?
if(!STM_EVAL_PBGetState(BUTTON_KEY))
{
//FTP client test routine
ftpClientTest();
//Wait for the user button to be released
while(!STM_EVAL_PBGetState(BUTTON_KEY));
}
//Loop delay
osDelayTask(100);
}
}
示例5: LTS_Test
/**
* @brief configure linear touch sensor (LTS),
* Leds On corresponding to the current LTS TouchKey pointed
* @param None
* @retval None
*/
void LTS_Test(void)
{
while ((STM_EVAL_PBGetState(BUTTON_USER) != Bit_SET))
{
/* Execute STMTouch Driver state machine */
if (TSL_user_Action() == TSL_STATUS_OK)
{
ProcessSensors(); // Execute sensors related tasks
}
}
/* Wait for User button is released */
while (STM_EVAL_PBGetState(BUTTON_USER) != Bit_RESET)
{}
/* Turn Off Leds */
STM_EVAL_LEDOff(LED3);
STM_EVAL_LEDOff(LED4);
STM_EVAL_LEDOff(LED5);
STM_EVAL_LEDOff(LED6);
/* SysTick time base was modified during TLS Test, for this we reconfigure
the SysTick to have a time base of 1ms */
if (SysTick_Config(SystemCoreClock / 1000))
{
/* Capture error */
while (1);
}
}
示例6: JoyState
/**
* @brief JoyState
* @param None
* @retval The direction value
*/
uint8_t JoyState(void)
{
/* "right" key is pressed */
if (STM_EVAL_PBGetState(Button_RIGHT))
{
return JOY_RIGHT;
}
/* "left" key is pressed */
if (STM_EVAL_PBGetState(Button_LEFT))
{
return JOY_LEFT;
}
/* "up" key is pressed */
if (STM_EVAL_PBGetState(Button_UP))
{
return JOY_UP;
}
/* "down" key is pressed */
if (STM_EVAL_PBGetState(Button_DOWN))
{
return JOY_DOWN;
}
/* No key is pressed */
else
{
return 0;
}
}
示例7: USB_Demo
/**
* @brief USB recognized as a standard mouse
* cursor moving according to discovery moving
* @param None
* @retval None
*/
void USB_Demo(void)
{
uint8_t *buf;
STM_EVAL_LEDOn(LED3);
STM_EVAL_LEDOff(LED6);
while ((STM_EVAL_PBGetState(BUTTON_USER) != Bit_SET))
{
buf = USBD_HID_GetPos();
if((buf[1] != 0) ||(buf[2] != 0))
{
USBD_HID_SendReport (&USB_Device_dev,
buf,
4);
/* Insert 50ms delay */
Delay (5);
}
}
/* Wait for User button is released */
while (STM_EVAL_PBGetState(BUTTON_USER) != Bit_RESET)
{}
/* Turn Off Leds */
STM_EVAL_LEDOff(LED3);
STM_EVAL_LEDOff(LED4);
STM_EVAL_LEDOff(LED5);
STM_EVAL_LEDOff(LED6);
}
示例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: 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();
/* Configures LED 1..4 */
STM_EVAL_LEDInit(LED1);
STM_EVAL_LEDInit(LED2);
STM_EVAL_LEDInit(LED3);
STM_EVAL_LEDInit(LED4);
/* Configure Push button key */
STM_EVAL_PBInit(BUTTON_KEY, BUTTON_MODE_GPIO);
/* CAN configuration */
CAN_Config();
CAN_ITConfig(CANx, CAN_IT_FMP0, ENABLE);
/* turn off all leds*/
STM_EVAL_LEDOff(LED1);
STM_EVAL_LEDOff(LED2);
STM_EVAL_LEDOff(LED3);
STM_EVAL_LEDOff(LED4);
/* Infinite loop */
while(1)
{
while(STM_EVAL_PBGetState(BUTTON_KEY) == KEY_PRESSED)
{
if(KeyNumber == 0x4)
{
KeyNumber = 0x00;
}
else
{
LED_Display(++KeyNumber);
TxMessage.Data[0] = KeyNumber;
CAN_Transmit(CANx, &TxMessage);
Delay();
while(STM_EVAL_PBGetState(BUTTON_KEY) != KEY_NOT_PRESSED)
{
}
}
}
}
}
示例10: GAME_EventHandler1
void
GAME_EventHandler1()
{
if( STM_EVAL_PBGetState( BUTTON_USER ) ){
player1IsReversed = 0;
while( STM_EVAL_PBGetState( BUTTON_USER ) );
player1IsReversed = 1;
}
}
示例11: ButtonEventTask
static void ButtonEventTask(void *pvParameters)
{
while (1) {
if( STM_EVAL_PBGetState( BUTTON_USER ) ){
while( STM_EVAL_PBGetState( BUTTON_USER ) );
xSemaphoreTake(t_mutex, portMAX_DELAY);
button_change_traffic = 1;
xSemaphoreGive(t_mutex);
}
}
}
示例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
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 Key Button mounted on EVAL board */
STM_EVAL_PBInit(BUTTON_KEY, BUTTON_MODE_GPIO);
/* CAN configuration */
CAN_Config();
while(1)
{
while(STM_EVAL_PBGetState(BUTTON_KEY) == KEY_PRESSED)
{
if(ubKeyNumber == 0x4)
{
ubKeyNumber = 0x00;
}
else
{
LED_Display(++ubKeyNumber);
TxMessage.Data[0] = ubKeyNumber;
CAN_Transmit(CANx, &TxMessage);
/* Wait until one of the mailboxes is empty */
while((CAN_GetFlagStatus(CANx, CAN_FLAG_RQCP0) !=RESET) || \
(CAN_GetFlagStatus(CANx, CAN_FLAG_RQCP1) !=RESET) || \
(CAN_GetFlagStatus(CANx, CAN_FLAG_RQCP2) !=RESET));
while(STM_EVAL_PBGetState(BUTTON_KEY) != KEY_NOT_PRESSED)
{
}
}
}
}
}
示例13: ReadKey
/*******************************************************************************
* Function Name : ReadKey
* Description : Reads key from demoboard.
* Input : None
* Output : None
* Return : Return RIGHT, LEFT, SEL, UP, DOWN or NOKEY
*******************************************************************************/
u8 ReadKey(void)
{
/* "right" key is pressed */
if(STM_EVAL_PBGetState(BUTTON_RIGHT))
{
return RIGHT;
}
/* "left" key is pressed */
if(STM_EVAL_PBGetState(BUTTON_LEFT))
{
return LEFT;
}
/* "up" key is pressed */
if(STM_EVAL_PBGetState(BUTTON_UP))
{
return UP;
}
/* "down" key is pressed */
if(STM_EVAL_PBGetState(BUTTON_DOWN))
{
return DOWN;
}
/* "sel" key is pressed */
if(STM_EVAL_PBGetState(BUTTON_SEL))
{
return SEL;
}
/* "Tamper" key is pressed */
if(!STM_EVAL_PBGetState(BUTTON_TAMPER))
{
GLCD_TextSetPos(0,6);
GLCD_print("TAMPER Key pressed\n");
return Tamper ;
}
/* "Wake up" key is pressed */
if(STM_EVAL_PBGetState(BUTTON_WAKEUP))
{
GLCD_TextSetPos(0,6);
GLCD_print("Wakeup Key pressed\n");
return Wakeup ;
}
/* "User" key is pressed */
if(!STM_EVAL_PBGetState(BUTTON_USER))
{
return User ;
}
else
{
return NOKEY;
}
}
示例14: main
/**
* @brief Main program
* @param None
* @retval None
*/
int main(void)
{
uint32_t random32bit = 0;
uint32_t counter = 0;
/*!< 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
*/
/* Display init (LCD or/and USART)*/
Display_Init();
/* Key Button configuration */
STM_EVAL_PBInit(BUTTON_KEY, BUTTON_MODE_GPIO);
/* RNG configuration */
RNG_Config();
while (1)
{
/* Wait until Key button is pressed */
while(STM_EVAL_PBGetState(BUTTON_KEY) != RESET)
{
}
/* Loop while Key button is maintained pressed */
while(STM_EVAL_PBGetState(BUTTON_KEY) == RESET)
{
}
for(counter = 0; counter < 8; counter++)
{
/* Wait until one RNG number is ready */
while(RNG_GetFlagStatus(RNG_FLAG_DRDY)== RESET)
{
}
/* Get a 32bit Random number */
random32bit = RNG_GetRandomNumber();
/* Display the Random number value on the LCD or/and USART */
Display(random32bit, counter+1);
}
}
}
示例15: 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();
}
}