本文整理汇总了C++中LOOP_FOREVER函数的典型用法代码示例。如果您正苦于以下问题:C++ LOOP_FOREVER函数的具体用法?C++ LOOP_FOREVER怎么用?C++ LOOP_FOREVER使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了LOOP_FOREVER函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main() {
long lRetVal = -1;
val=0;
BoardInit();
PinMuxConfig();
LedInit();
//create OS tasks
lRetVal = osi_TaskCreate(PushButtonHandler,
(signed char*) "PushButtonHandler",
OSI_STACK_SIZE, NULL, 2, &g_PushButtonTask);
if(lRetVal < 0)
{
ERR_PRINT(lRetVal);
LOOP_FOREVER();
}
lRetVal = osi_TaskCreate(MainLoop, (signed char*)"MainLoop",
OSI_STACK_SIZE, NULL, 1, NULL );
if(lRetVal < 0)
{
ERR_PRINT(lRetVal);
LOOP_FOREVER();
}
osi_start();
for(;;) {
}
return 0;
}
示例2: Init
static void Init()
{
long lRetVal = -1;
BoardInit();
UDMAInit();
PinMuxConfig();
InitTerm();
InitializeAppVariables();
//
// Following function configure the device to default state by cleaning
// the persistent settings stored in NVMEM (viz. connection profiles &
// policies, power policy etc)
//
// Applications may choose to skip this step if the developer is sure
// that the device is in its default state at start of applicaton
//
// Note that all profiles and persistent settings that were done on the
// device will be lost
//
lRetVal = ConfigureSimpleLinkToDefaultState();
if (lRetVal < 0) {
if (DEVICE_NOT_IN_STATION_MODE == lRetVal)
UART_PRINT(
"Failed to configure the device in its default state \n\r");
LOOP_FOREVER()
;
}
//
// Asumption is that the device is configured in station mode already
// and it is in its default state
//
lRetVal = sl_Start(0, 0, 0);
if (lRetVal < 0) {
UART_PRINT("Failed to start the device \n\r");
LOOP_FOREVER()
;
}
UART_PRINT("Connecting to AP: '%s'...\r\n", SSID_NAME);
// Connecting to WLAN AP - Set with static parameters defined at common.h
// After this call we will be connected and have IP address
lRetVal = WlanConnect();
if (lRetVal < 0) {
UART_PRINT("Connection to AP failed \n\r");
LOOP_FOREVER()
;
}
UART_PRINT("Connected to AP: '%s' \n\r", SSID_NAME);
#ifdef NEW_ID
iobeam_Reset();
#endif
}
示例3: main
int main(void) {
// init the hardware
initBoard();
UART_PRINT("[Blink] Start application\r\n");
// create the main application message queue
// this call properly enables the OSI scheduler to function
short status = osi_MsgQCreate(&g_ApplicationMessageQueue, "ApplicationMessageQueue", sizeof(ApplicationMessage), 1);
if (status < 0) {
UART_PRINT("[Blink] Create application message queue error\r\n");
ERR_PRINT(status);
LOOP_FOREVER();
}
// start the main application task
// this is necessary because SimpleLink host driver is started by sl_Start(),
// which cannot be called on before the OSI scheduler is started
status = osi_TaskCreate(startApplication, (signed char *)"Blink", OSI_STACK_SIZE, NULL, OOB_TASK_PRIORITY, NULL);
if (status < 0) {
UART_PRINT("[Blink] Start application error\r\n");
ERR_PRINT(status);
LOOP_FOREVER();
}
// start the OSI scheduler
osi_start();
return 0;
}
示例4: DSPCeateInstance
tDSPInstance* DSPCeateInstance(uint32_t signalSize, uint32_t Fs) {
tDSPInstance* tempInstance;
tempInstance = (tDSPInstance*)malloc(sizeof(tDSPInstance));
if (tempInstance == NULL){
UART_PRINT("DSPCreate malloc error!");
LOOP_FOREVER(); //malloc error. heap too small?
return NULL;
}
tempInstance->signalSize = signalSize;
tempInstance->Fs = Fs;
tempInstance->ucpSignal = (unsigned char*)malloc(sizeof(unsigned char)*signalSize);
tempInstance->fpSignal = (float32_t*)malloc(sizeof(float32_t)*signalSize/2);
tempInstance->fftSize = signalSize / 4;
tempInstance->FFTResults = (float32_t*)malloc(sizeof(float32_t)*tempInstance->fftSize);
if (tempInstance->ucpSignal==NULL || \
tempInstance->fpSignal==NULL || \
tempInstance->FFTResults==NULL) {
UART_PRINT("DSPCreate malloc error!");
LOOP_FOREVER(); //malloc error. heap too small?
return NULL;
}
tempInstance->maxEnergyBinIndex = 0;
tempInstance->maxEnergyBinValue = 0;
return tempInstance;
}
示例5: main
int main()
{
/*
* Preparation
*/
// Board Initialization
BoardInit();
// Configuring UART
InitTerm();
// Connect to AP
// Put your SSID and password in common.h
long lRetVal = ConnectToAP();
if(lRetVal < 0)
{
UART_PRINT("Connection to AP failed\n\r");
LOOP_FOREVER();
}
UART_PRINT("Connected to AP\n\r");
if(lRetVal < 0)
{
LOOP_FOREVER();
}
// Declare thing
Thing_Struct thing;
// Connect to thethingsiO server
lRetVal = ConnectTo_thethingsiO(&thing.thing_client);
if(lRetVal < 0)
{
LOOP_FOREVER();
}
UART_PRINT("Thing client connected\n\r");
// In order to initialize the thing correctly you have to use one of
// following two methods:
// 1. If you have already activated your thing you should set the token
thing.token = "YOUR TOKEN HERE";
// 2. Or if not copy the provided activation code here
// and uncomment the following line
// char *act_code = "YOUR ACTIVATION CODE HERE";
// and activate the thing (uncomment the following line)
// char *token = thing_activate(&thing, act_code);
/* Intializes random number generator */
// time_t t;
// srand((unsigned) time(&t));
while(1)
{
char *sub = thing_subscribe(&thing);
if (strlen(sub) > 0)
{
UART_PRINT(sub);
UART_PRINT("\n\r");
}
// Free memory
free(sub);
}
}
示例6: main
//****************************************************************************
//
//! Main function
//!
//! \param none
//!
//! This function
//! 1. Invokes the SLHost task
//! 2. Invokes the GetNTPTimeTask
//!
//! \return None.
//
//****************************************************************************
void main()
{
long lRetVal = -1;
//
// Initialize Board configurations
//
BoardInit();
//
// Enable and configure DMA
//
UDMAInit();
//
// Pinmux for UART
//
PinMuxConfig();
//
// Configuring UART
//
InitTerm();
//
// Display Application Banner
//
DisplayBanner(APP_NAME);
//
// Start the SimpleLink Host
//
lRetVal = VStartSimpleLinkSpawnTask(SPAWN_TASK_PRIORITY);
if(lRetVal < 0)
{
ERR_PRINT(lRetVal);
LOOP_FOREVER();
}
//
// Start the GetNTPTime task
//
lRetVal = osi_TaskCreate(GetNTPTimeTask,
(const signed char *)"Get NTP Time",
OSI_STACK_SIZE,
NULL,
1,
NULL );
if(lRetVal < 0)
{
ERR_PRINT(lRetVal);
LOOP_FOREVER();
}
//
// Start the task scheduler
//
osi_start();
}
示例7: WlanStationMode
//****************************************************************************
//
//! \brief Start simplelink, connect to the ap and run the ping test
//!
//! This function starts the simplelink, connect to the ap and start the ping
//! test on the default gateway for the ap
//!
//! \param[in] pvParameters - Pointer to the list of parameters that
//! can bepassed to the task while creating it
//!
//! \return None
//
//****************************************************************************
void WlanStationMode( void *pvParameters )
{
long lRetVal = -1;
InitializeAppVariables();
//
// Following function configure the device to default state by cleaning
// the persistent settings stored in NVMEM (viz. connection profiles &
// policies, power policy etc)
//
// Applications may choose to skip this step if the developer is sure
// that the device is in its default state at start of applicaton
//
// Note that all profiles and persistent settings that were done on the
// device will be lost
//
lRetVal = ConfigureSimpleLinkToDefaultState();
if(lRetVal < 0)
{
if (DEVICE_NOT_IN_STATION_MODE == lRetVal)
{
UART_PRINT("Failed to configure the device in its default state\n\r");
}
LOOP_FOREVER();
}
UART_PRINT("Device is configured in default state \n\r");
//
// Assumption is that the device is configured in station mode already
// and it is in its default state
//
lRetVal = sl_Start(0, 0, 0);
if (lRetVal < 0 || ROLE_STA != lRetVal)
{
UART_PRINT("Failed to start the device \n\r");
LOOP_FOREVER();
}
UART_PRINT("Device started as STATION \n\r");
//
//Connecting to WLAN AP
//
lRetVal = WlanConnect();
if(lRetVal < 0)
{
UART_PRINT("Failed to establish connection w/ an AP \n\r");
LOOP_FOREVER();
}
UART_PRINT("Connection established w/ AP and IP is aquired \n\r");
gizwits_main();
}
示例8: HTTPServerTask
//****************************************************************************
//
//! \brief Handles HTTP Server Task
//!
//! \param[in] pvParameters is the data passed to the Task
//!
//! \return None
//
//****************************************************************************
static void HTTPServerTask(void *pvParameters)
{
long lRetVal = -1;
InitializeAppVariables();
//
// Following function configure the device to default state by cleaning
// the persistent settings stored in NVMEM (viz. connection profiles &
// policies, power policy etc)
//
// Applications may choose to skip this step if the developer is sure
// that the device is in its default state at start of applicaton
//
// Note that all profiles and persistent settings that were done on the
// device will be lost
//
lRetVal = ConfigureSimpleLinkToDefaultState();
if(lRetVal < 0)
{
if (DEVICE_NOT_IN_STATION_MODE == lRetVal)
UART_PRINT("Failed to configure the device in its default state\n\r");
LOOP_FOREVER();
}
UART_PRINT("Device is configured in default state \n\r");
memset(g_ucSSID,'\0',AP_SSID_LEN_MAX);
//Read Device Mode Configuration
ReadDeviceConfiguration();
//Connect to Network
lRetVal = ConnectToNetwork();
//Stop Internal HTTP Server
lRetVal = sl_NetAppStop(SL_NET_APP_HTTP_SERVER_ID);
if(lRetVal < 0)
{
ERR_PRINT(lRetVal);
LOOP_FOREVER();
}
//Start Internal HTTP Server
lRetVal = sl_NetAppStart(SL_NET_APP_HTTP_SERVER_ID);
if(lRetVal < 0)
{
ERR_PRINT(lRetVal);
LOOP_FOREVER();
}
//Handle Async Events
while(1)
{
}
}
示例9: main
//****************************************************************************
// MAIN FUNCTION
//****************************************************************************
int main()
{
long lRetVal = -1;
//
// Board Initialization
//
BoardInit();
//
// Enable and configure DMA
//
UDMAInit();
//
// Pinmux for UART
//
PinMuxConfig();
//
// Configuring UART
//
InitTerm();
//
// Display Application Banner
//
DisplayBanner(APP_NAME);
//
// Start the SimpleLink Host
//
lRetVal = VStartSimpleLinkSpawnTask(SPAWN_TASK_PRIORITY);
if(lRetVal < 0)
{
ERR_PRINT(lRetVal);
LOOP_FOREVER();
}
//
// Start the Receiving file
//
lRetVal = osi_TaskCreate(cmd_dispatcher,
(const signed char *)"TFTP",
OSI_STACK_SIZE,
NULL,
1,
NULL );
if(lRetVal < 0)
{
ERR_PRINT(lRetVal);
LOOP_FOREVER();
}
//
// Start the task scheduler
//
osi_start();
return 0;
}
示例10: initBoard
void initBoard() {
#ifndef USE_TIRTOS
#if defined(ccs) || defined(gcc)
MAP_IntVTableBaseSet((unsigned long) &g_pfnVectors[0]);
#endif
#if defined(ewarm)
MAP_IntVTableBaseSet((unsigned long)&__vector_table);
#endif
#endif
MAP_IntMasterEnable();
MAP_IntEnable(FAULT_SYSTICK);
PRCMCC3200MCUInit();
PinMuxConfig();
GPIO_IF_LedConfigure(LED1);
GPIO_IF_LedOff(MCU_RED_LED_GPIO);
InitTerm();
ClearTerm();
UART_PRINT("Blink - Parse for IoT sample application\r\n");
UART_PRINT("----------------------------------------\r\n");
UART_PRINT("\r\n");
UART_PRINT("[Blink] Board init\r\n");
// start the spawn task
short status = VStartSimpleLinkSpawnTask(SPAWN_TASK_PRIORITY);
if (status < 0) {
UART_PRINT("[Blink] Spawn task failed\r\n");
ERR_PRINT(status);
LOOP_FOREVER();
}
// initialize the I2C bus
status = I2C_IF_Open(I2C_MASTER_MODE_FST);
if (status < 0) {
UART_PRINT("[Blink] I2C opening error\r\n");
ERR_PRINT(status);
LOOP_FOREVER();
}
UART_PRINT("[Blink] Device : TI SimpleLink CC3200\r\n");
#ifdef USE_TIRTOS
UART_PRINT("[Blink] Operating system : TI-RTOS\r\n");
#endif
#ifdef USE_FREERTOS
UART_PRINT("[Blink] Operating system : FreeRTOS\r\n");
#endif
#ifndef SL_PLATFORM_MULTI_THREADED
UART_PRINT("[Blink] Operating system : None\r\n");
#endif
}
示例11: main
int main(void)
{
long lRetVal = -1;
//
// initialize board configurations
//
BoardInit();
//
// Pinmux GPIO for LEDs
//
PinMuxConfig();
#ifndef NOTERM
//
// Configuring UART
//
InitTerm();
#endif
//
// Configure LEDs
//
GPIO_IF_LedConfigure(LED1|LED2|LED3);
GPIO_IF_LedOff(MCU_ALL_LED_IND);
//
// Simplelinkspawntask
//
lRetVal = VStartSimpleLinkSpawnTask(SPAWN_TASK_PRIORITY);
if(lRetVal < 0)
{
ERR_PRINT(lRetVal);
LOOP_FOREVER();
}
lRetVal = osi_TaskCreate(XmppClient, (const signed char*)"XmppClient",\
OSI_STACK_SIZE, NULL, 1, NULL );
if(lRetVal < 0)
{
ERR_PRINT(lRetVal);
LOOP_FOREVER();
}
osi_start();
while(1)
{
}
}
示例12: main
//****************************************************************************
//
//! Main function
//!
//! \param none
//!
//! This function
//! 1. Invokes the SLHost task
//! 2. Invokes the LPDSTCPServerTask
//!
//! \return None.
//
//****************************************************************************
void main()
{
long lRetVal = -1;
//
// Initialize the board
//
BoardInit();
//
// Configure the pinmux settings for the peripherals exercised
//
PinMuxConfig();
#ifndef NOTERM
//
// Configuring UART
//
InitTerm();
ClearTerm();
#endif
//
// Start the SimpleLink Host
//
lRetVal = VStartSimpleLinkSpawnTask(SPAWN_TASK_PRIORITY);
if(lRetVal < 0)
{
ERR_PRINT(lRetVal);
LOOP_FOREVER();
}
//
// Start the TCPServer task
//
lRetVal = osi_TaskCreate(TCPServerTask,
(const signed char *)"DeepSleep TCP",
OSI_STACK_SIZE,
NULL,
1,
NULL );
if(lRetVal < 0)
{
ERR_PRINT(lRetVal);
LOOP_FOREVER();
}
//
// Start the task scheduler
//
osi_start();
}
示例13: main
//*****************************************************************************
//
//! Main
//!
//! \param none
//!
//! This function
//! 1. Invokes the SLHost task
//! 2. Invokes the MqttClient
//!
//! \return None
//!
//*****************************************************************************
void main()
{
long lRetVal = -1;
//
// Initialize the board configurations
//
BoardInit();
//
// Pinmux for UART
//
PinMuxConfig();
//
// Configuring UART
//
InitTerm();
//
// Display Application Banner
//
DisplayBanner("MQTT_Client");
//
// Start the SimpleLink Host
//
lRetVal = VStartSimpleLinkSpawnTask(SPAWN_TASK_PRIORITY);
if(lRetVal < 0)
{
ERR_PRINT(lRetVal);
LOOP_FOREVER();
}
//
// Start the MQTT Client task
//
osi_MsgQCreate(&g_PBQueue,"PBQueue",sizeof(event_msg),10);
lRetVal = osi_TaskCreate(MqttClient,
(const signed char *)"Mqtt Client App",
OSI_STACK_SIZE, NULL, 2, NULL );
if(lRetVal < 0)
{
ERR_PRINT(lRetVal);
LOOP_FOREVER();
}
//
// Start the task scheduler
//
osi_start();
}
示例14: SimpleEmail
//*****************************************************************************
//
//! \brief Email Application Main Task - Initializes SimpleLink Driver
//! and Handles UART Commands
//!
//! \param pvParameters - pointer to the task parameter
//!
//! \return void
//! \note
//! \warning
//
//*****************************************************************************
static void SimpleEmail(void *pvParameters)
{
long lRetVal = -1;
// Initialize Network Processor
lRetVal = Network_IF_InitDriver(ROLE_STA);
if(lRetVal < 0)
{
UART_PRINT("Failed to start SimpleLink Device\n\r");
LOOP_FOREVER();
}
//Glow GreenLED to indicate successful initialization
GPIO_IF_LedOn(MCU_ON_IND);
//Set Default Parameters for Email
lRetVal = SetDefaultParameters();
if(lRetVal < 0)
{
UART_PRINT("Failed to set default params for Email\r\n");
LOOP_FOREVER();
}
//Initialize Push Botton Switch
Button_IF_Init(SmartConfigInterruptHandler,SendEmailInterruptHandler);
while(1)
{
UART_PRINT("Cmd#");
//
// Get command from UART
//
memset(ucUARTBuffer,0,200);
uiUartCmd=GetCmd(&ucUARTBuffer[0], 200);
if(uiUartCmd)
{
//
// Parse the command
//
lRetVal = UARTCommandHandler(ucUARTBuffer);
if(lRetVal < 0)
{
UART_PRINT("Failed to parse the command.\r\n");
LOOP_FOREVER();
}
}
}
}
示例15: SimpleLinkHttpServerCallback
//*****************************************************************************
//
//! This function gets triggered when HTTP Server receives Application
//! defined GET and POST HTTP Tokens.
//!
//! \param pHttpServerEvent Pointer indicating http server event
//! \param pHttpServerResponse Pointer indicating http server response
//!
//! \return None
//!
//*****************************************************************************
void SimpleLinkHttpServerCallback(SlHttpServerEvent_t *pSlHttpServerEvent,
SlHttpServerResponse_t *pSlHttpServerResponse)
{
if((pSlHttpServerEvent == NULL) || (pSlHttpServerResponse == NULL))
{
UART_PRINT("Null pointer\n\r");
LOOP_FOREVER();
}
switch (pSlHttpServerEvent->Event)
{
case SL_NETAPP_HTTPPOSTTOKENVALUE_EVENT:
{
if (0 == memcmp (pSlHttpServerEvent->
EventData.httpPostData.token_name.data, "__SL_P_U.C",
pSlHttpServerEvent->EventData.httpPostData.token_name.len))
{
if(0 == memcmp (pSlHttpServerEvent->EventData.httpPostData.token_value.data, \
"start", \
pSlHttpServerEvent->EventData.httpPostData.token_value.len))
{
g_CaptureImage = 1;
}
else
{
g_CaptureImage = 0;
}
}
}
break;
default:
break;
}
}