当前位置: 首页>>代码示例>>C++>>正文


C++ osSignalSet函数代码示例

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


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

示例1: Th_HighPrioJob

/*-----------------------------------------------------------------------------
 * High priority job used for priority inversion test
 *----------------------------------------------------------------------------*/
void Th_HighPrioJob (void const *arg) {
  osThreadId *ctrl_id = (osThreadId *)arg;
  uint32_t    i;
  osStatus    stat;
  
  /* Allow control thread to be executed while this thread waits */
  osSignalSet (*ctrl_id, 0x01);
  
  /* Wait for a mutex object */
  stat = osMutexWait (G_MutexId, 200);
  ASSERT_TRUE (stat == osOK);
  
  if (stat == osOK) {
    /* Set mark into execution array */
    for (i = 0; i < 3; i++) {
      if (G_ExecArr[i] == 0) {
        G_ExecArr[i] = 'H';             /* H as High priority job             */

        /* Inform control thread */
        osSignalSet (*ctrl_id, (1 << 3));
        break;
      }
    }
  }
}
开发者ID:Goodjamp,项目名称:ble_app_template,代码行数:28,代码来源:RV_Mutex.c

示例2: gimbal_cali_msg_hook

static void gimbal_cali_msg_hook(uint8_t cur_type, uint8_t last_type)
{
  gimbal_cali_hook(moto_pit.ecd, moto_yaw.ecd);
  
  if ((last_type == GIMBAL_CALI_START) && (cur_type == GIMBAL_CALI_END))
  {
    cali_param.gim_cali_data[CALI_GIMBAL_CENTER].cali_cmd = 1;
    gimbal_cali_hook(moto_pit.ecd, moto_yaw.ecd);
    
    pc_send_mesg.cali_response_data.type = 0x01;
    pc_send_mesg.cali_response_data.pitch_offset = moto_pit.ecd;
    pc_send_mesg.cali_response_data.yaw_offset   = moto_yaw.ecd;
    data_packet_pack(CALI_RESPONSE_ID, (uint8_t *)&pc_send_mesg.cali_response_data,
                     sizeof(cali_response_t), UP_REG_ID);
    osSignalSet(pc_unpack_task_t, PC_UART_TX_SIGNAL);
  }
  
  if ((last_type == CAMERA_CALI_START) && (cur_type == CAMERA_CALI_END))
  {
    cali_param.gim_cali_data[CALI_CAMERA_CENTER].cali_cmd = 1;
    gimbal_cali_hook(moto_pit.ecd, moto_yaw.ecd);
    
    pc_send_mesg.cali_response_data.type = 0x02;
    pc_send_mesg.cali_response_data.pitch_offset = moto_pit.ecd;
    pc_send_mesg.cali_response_data.yaw_offset   = moto_yaw.ecd;
    data_packet_pack(CALI_RESPONSE_ID, (uint8_t *)&pc_send_mesg.cali_response_data,
                     sizeof(cali_response_t), UP_REG_ID);
    osSignalSet(pc_unpack_task_t, PC_UART_TX_SIGNAL);
  }
}
开发者ID:SyndicateYe,项目名称:Robomaster_Referee,代码行数:30,代码来源:info_interactive.c

示例3: Th_LowPrioJob

/*-----------------------------------------------------------------------------
 * Low priority job used for priority inversion test
 *----------------------------------------------------------------------------*/
void Th_LowPrioJob (void const *arg) {
  osThreadId *ctrl_id = (osThreadId *)arg;
  osStatus    stat;
  uint32_t    i;

  /* Obtain a mutex object */
  stat = osMutexWait (G_MutexId, 0);
  ASSERT_TRUE (stat == osOK);

  if (stat == osOK) {
    /* Mutex acquired, inform control thread */
    osSignalSet (*ctrl_id, (1 << 0));
    
    /* Set mark into execution array */
    for (i = 0; i < 3; i++) {
      if (G_ExecArr[i] == 0) {
        G_ExecArr[i] = 'L';             /* L as Low priority job              */

        /* Inform control thread */
        osSignalSet (*ctrl_id, (1 << 1));
        break;
      }
    }
    ASSERT_TRUE (osMutexRelease (G_MutexId) == osOK);
  }
}
开发者ID:Goodjamp,项目名称:ble_app_template,代码行数:29,代码来源:RV_Mutex.c

示例4: HAL_TIM_PeriodElapsedCallback

/**
  * @brief  The period elapsed callback is called when the counter underflows (UEV Update event).
  * @param  TIM_HandleTypeDef *htim: handle to TIM configuration struct
  * @retval None
  */
void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
{
    if (htim->Instance == TIM3) {
        osSignalSet(tid_Thread_SEGMENT, SEGMENT_SIGNAL);
    } else if (htim->Instance == TIM4) {
        osSignalSet(tid_Thread_TEMPERATURE, TEMPERATURE_SIGNAL);
    }
}
开发者ID:Lone-L,项目名称:MicroP_Labs,代码行数:13,代码来源:hardware_timer.c

示例5: signal_func

/*----------------------------------------------------------------------------
  Function 'signal_func' called from multiple tasks
 *---------------------------------------------------------------------------*/
void signal_func (osThreadId tid) {
  osSignalSet(tid_clock, 0x0100);           /* set signal to clock thread    */
  osDelay(500);                             /* delay 500ms                   */
  osSignalSet(tid_clock, 0x0100);           /* set signal to clock thread    */
  osDelay(500);                             /* delay 500ms                   */
  osSignalSet(tid, 0x0001);                 /* set signal to thread 'thread' */
  osDelay(500);                             /* delay 500ms                   */
}
开发者ID:ADARSHBU,项目名称:LPC11U_LPC13U_CodeBase,代码行数:11,代码来源:Blinky.c

示例6: sigio_handler

static void sigio_handler(SInfo *info)
{
    if (info->getReceiverThreadId()) {
        osSignalSet(info->getReceiverThreadId(), SIGNAL_SIGIO);
    }
    if (info->getSenderThreadId()) {
        osSignalSet(info->getSenderThreadId(), SIGNAL_SIGIO);
    }
}
开发者ID:MarceloSalazar,项目名称:mbed-os,代码行数:9,代码来源:cmd_socket.cpp

示例7: Signal_Gen_Thread

/**
  * @brief  Signal generator thread
  * @param  Thread not used
  * @retval None
  */
static void Signal_Gen_Thread(void const *argument)
{
  (void) argument;
  
  for(;;)
  {
    osSignalSet( LED1_ThreadId, BIT_0 );
    osDelay(500);
    osSignalSet( LED2_ThreadId, BIT_1 | BIT_2 );
    osDelay(500);     
  }
}
开发者ID:dazuo78,项目名称:TBall,代码行数:17,代码来源:main.c

示例8: uart_idle_interrupt_signal

void uart_idle_interrupt_signal(UART_HandleTypeDef *huart)
{
  if (huart == &JUDGE_HUART)
  {
    err_detector_hook(JUDGE_SYS_OFFLINE);
    osSignalSet(judge_unpack_task_t, JUDGE_UART_IDLE_SIGNAL);
  }
  else if (huart == &COMPUTER_HUART)
  {
    err_detector_hook(PC_SYS_OFFLINE);
    osSignalSet(pc_unpack_task_t, PC_UART_IDLE_SIGNAL);
  }
}
开发者ID:SyndicateYe,项目名称:Robomaster_Referee,代码行数:13,代码来源:info_interactive.c

示例9: TRACE

	void DispatcherPrivate::task_main_imp(volatile PROCESS_ENTRY_STATE* process)
	{
		const PROCESS_ENTRY_DATA* pdata = process->data;
		PROCESS_ENTRY* pcb = process->process;

		TRACE(("[%s] task_main_imp(): starting\r\n", process->data->name));
		process->thread->mutex.lock();
		if (pcb->process_start != NULL)
			pcb->process_start(pcb);

		STATE_ENTRY* state = pdata->initstate;
		enter_state(process, state);
		process->state = ProcessRunning;
		process->thread->mutex.unlock();
		osSignalSet(_dispid, SIGNAL_CHANGED);

		for (;;)
		{
			//TRACE(("[%s] task_main_imp(): waiting for signal.\r\n", process->data->name));
			process->state = ProcessWaiting;
			DelayedThread::signal_wait(SIGNAL_RUN_TASKS);
			process->state = ProcessRunning;
			//TRACE(("[%s] task_main_imp(): woken up.\r\n", process->data->name));

			process->thread->mutex.lock();
			//TRACE(("DispatcherPrivate::run_tasks(): locked\r\n"));

			do
			{
				//TRACE(("[%s:%s] task_main_imp(): current state type is %i.\r\n", process->data->name, process->current->data->name, process->current->data->mode));
				TRANSITION_ENTRY* transition = find_valid_transition(process);
				if (transition != NULL)
				{
					take_transition(process, transition);
				}
				else
				{
					process->stepped = false;
					//TRACE(("[%s:%s] task_main_imp(): no transitions found.\r\n", process->data->name, process->current->data->name));
					break;
				}

			} while (process->current->data->mode == StateCommited);

			//TRACE(("DispatcherPrivate::run_tasks(): unlocking\r\n"));
			process->thread->mutex.unlock();
			osSignalSet(_dispid, SIGNAL_CHANGED);
		}

	}
开发者ID:arieleiz,项目名称:VerifiedPacemaker,代码行数:50,代码来源:ModelImpl.cpp

示例10: Toggle_Leds

/**
  * @brief  Toggles LEDs to show user input state.
  * @param  None
  * @retval None
  */
void Toggle_Leds(void)
{
   static uint32_t ticks = 0;
   if(ticks == 400) 
   {
     osSignalSet( LED_ThreadId, BIT_1); 
   }
   else if(ticks == 1000) 
   {
     osSignalSet( LED_ThreadId, BIT_1 | BIT_2 );
     ticks = 0; 
   } 
   ticks++;
 }
开发者ID:pengphei,项目名称:STM32Cube_L0,代码行数:19,代码来源:main.c

示例11: ledOn

/*----------------------------------------------------------------------------
  Task 1 'ledOn': switches the LED on
 *---------------------------------------------------------------------------*/
 void ledOn (void const *argument) {
  for (;;) {
    LED_On(0);                          /* Turn LED On                       */
    osSignalSet(t_ledOff, 0x0001);      /* send event to task 'ledoff'       */
    osDelay(500);                       /* delay 500ms                       */
  }
}
开发者ID:ggajoch,项目名称:stm32-sudoku,代码行数:10,代码来源:Blinky.c

示例12: TC_MutexTimeout

/**
\brief Test case: TC_MutexTimeout
\details
- Create and initialize a mutex object
- Create a thread that acquires a mutex but never release it
- Wait for mutex release until timeout
*/
void TC_MutexTimeout (void) {
  osThreadId ctrl_id, lock_id;
  osEvent    evt;

  /* Get control thread id */
  ctrl_id = osThreadGetId ();
  ASSERT_TRUE (ctrl_id != NULL);
  
  if (ctrl_id != NULL) {
    /* - Create and initialize a mutex object */
    G_MutexId = osMutexCreate (osMutex (MutexTout));
    ASSERT_TRUE (G_MutexId != NULL);
    
    if (G_MutexId != NULL) {
      /* - Create a thread that acquires a mutex but never release it */
      lock_id = osThreadCreate (osThread (Th_MutexLock), &ctrl_id);
      ASSERT_TRUE (lock_id != NULL);
      
      if (lock_id != NULL) {
        /* - Wait for mutex release until timeout */
        ASSERT_TRUE (osMutexWait (G_MutexId, 10) == osErrorTimeoutResource);
        /* - Release a mutex */
        osSignalSet (lock_id, 0x01);
        evt = osSignalWait (0x01, 100);
        ASSERT_TRUE (evt.status == osEventSignal);
        /* - Terminate locking thread */
        ASSERT_TRUE (osThreadTerminate (lock_id)  == osOK);
      }
      /* Delete mutex object */
      ASSERT_TRUE (osMutexDelete (G_MutexId)  == osOK);
    }
  }
}
开发者ID:Goodjamp,项目名称:ble_app_template,代码行数:40,代码来源:RV_Mutex.c

示例13: dnsCBack

// This function is called by the DNS client when dns event occurs.
static void dnsCBack (dnsClientEvent event, const uint8_t *ip_addr)
{
  switch (event)
	{
    case dnsClientSuccess:
      // Host Address successfully resolved.
			ntpHostIP[0] = ip_addr[0];
			ntpHostIP[1] = ip_addr[1];
			ntpHostIP[2] = ip_addr[2];
			ntpHostIP[3] = ip_addr[3];
      break;
		/*
    case dnsClientNotResolved:
      // Host Name does not exist in DNS record database.
      break;
    case dnsClientTimeout:
      // All DNS Resolver retries used up and timeouts expired.
      break;
    case dnsClientError:
      // DNS Protocol Error, invalid or corrupted reply received.
      break;
		*/
		default:
			ntpHostIP[0] = 0;
			ntpHostIP[1] = 0;
			ntpHostIP[2] = 0;
			ntpHostIP[3] = 0;
			break;
  }
	osSignalSet (netTaskId, FLAG_DNS_RESOLVED);
}
开发者ID:maximvarentsov,项目名称:eclock,代码行数:32,代码来源:net_task.c

示例14: ENET_IRQHandler

/** \brief  LPC EMAC interrupt handler.
 *
 *  This function handles the transmit, receive, and error interrupt of
 *  the LPC177x_8x. This is meant to be used when NO_SYS=0.
 */
void ENET_IRQHandler(void)
{
#if NO_SYS == 1
	/* Interrupts are not used without an RTOS */
    NVIC_DisableIRQ(ENET_IRQn);
#else
	uint32_t ints;

	/* Interrupts are of 2 groups - transmit or receive. Based on the
	   interrupt, kick off the receive or transmit (cleanup) task */

	/* Get pending interrupts */
	ints = LPC_EMAC->IntStatus;

	if (ints & RXINTGROUP) {
        /* RX group interrupt(s): Give signal to wakeup RX receive task.*/
        osSignalSet(lpc_enetdata.RxThread->id, RX_SIGNAL);
    }

    if (ints & TXINTGROUP) {
        /* TX group interrupt(s): Give semaphore to wakeup TX cleanup task. */
        sys_sem_signal(&lpc_enetdata.TxCleanSem);
    }

	/* Clear pending interrupts */
	LPC_EMAC->IntClear = ints;
#endif
}
开发者ID:mgramli1,项目名称:pyelixys,代码行数:33,代码来源:lpc17_emac.c

示例15: ESC

/*----------------------------------------------------------------------------
  Thread 5 'get_escape': check if ESC (escape character) was entered
 *---------------------------------------------------------------------------*/
void get_escape (void const *argument) {
  while (1)  {                                /* endless loop                */
    if (SER_GetChar () == ESC) {              /* If ESC entered, set flag    */ 
      escape = true;                          /* 'escape', set event flag of */
      osSignalSet(tid_command, 0x0002);       /* thread 'command'            */
    }
  }
}
开发者ID:EnergyMicro,项目名称:RTX,代码行数:11,代码来源:Traffic.c


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