• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ osMessagePut函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: send_thread

/*----------------------------------------------------------------------------
 *  Thread 1: Send thread
 *---------------------------------------------------------------------------*/
void send_thread (void const *argument) {
  T_MEAS    *mptr;

  mptr = osPoolAlloc(mpool);          /* Allocate memory for the message     */
  mptr->voltage = 223.72;             /* Set the message content             */
  mptr->current = 17.54;
  mptr->counter = 120786;
  osMessagePut(MsgBox, (uint32_t)mptr, osWaitForever);  /* Send Message      */
  osDelay(100);

  mptr = osPoolAlloc(mpool);          /* Allocate memory for the message     */
  mptr->voltage = 227.23;             /* Prepare a 2nd message               */
  mptr->current = 12.41;
  mptr->counter = 170823;
  osMessagePut(MsgBox, (uint32_t)mptr, osWaitForever);  /* Send Message      */
  osThreadYield();                    /* Cooperative multitasking            */
  osDelay(100);

  mptr = osPoolAlloc(mpool);          /* Allocate memory for the message     */
  mptr->voltage = 229.44;             /* Prepare a 3rd message               */
  mptr->current = 11.89;
  mptr->counter = 237178;
  osMessagePut(MsgBox, (uint32_t)mptr, osWaitForever);  /* Send Message      */
  osDelay(100);
                                      /* We are done here, exit this thread  */
}
开发者ID:AndreMiras,项目名称:EFM32-Library,代码行数:29,代码来源:Message.c


示例2: BSP_SD_DetectCallback

/**
  * @brief  SD detect callback
  * @param  None
  * @retval None
  */ 
void BSP_SD_DetectCallback(void)
{
  if(BSP_SD_IsDetected())
  {
    osMessagePut ( StorageEvent, MSDDISK_CONNECTION_EVENT, 0);
  }
  else
  {
    osMessagePut ( StorageEvent, MSDDISK_DISCONNECTION_EVENT, 0);
  }
}
开发者ID:Bosvark,项目名称:STM32Cube_FW_F4_V1.1.0,代码行数:16,代码来源:k_storage.c


示例3: MSC_Application

/**
  * @brief  Main routine for Mass Storage Class
  * @param  None
  * @retval None
  */
static void MSC_Application(void)
{
  FRESULT res;                                          /* FatFs function common result code */
  uint32_t byteswritten;                                /* File write count */
  uint8_t wtext[] = "This is STM32 working with FatFs"; /* File write buffer */
  
  /* Register the file system object to the FatFs module */
  if(f_mount(&USBDISKFatFs, (TCHAR const*)USBDISKPath, 0) != FR_OK)
  {
    /* FatFs Initialization Error */
    Error_Handler();
  }
  else
  {
    /* Create and Open a new text file object with write access */
    if(f_open(&MyFile1, "STM32_1.TXT", FA_CREATE_ALWAYS | FA_WRITE) != FR_OK) 
    {
      /* 'STM32_1.TXT' file Open for write Error */
      Error_Handler();
    }
    else
    {
      /* Allow Second task to have access to FatFs */
      osMessagePut(DiskEvent, DISK_READY_EVENT, 0);
      
      /* Write data to the text file */
      res = f_write(&MyFile1, wtext, sizeof(wtext), (void *)&byteswritten);
      
      if((byteswritten == 0) || (res != FR_OK))
      {
        /* 'STM32_1.TXT' file Write or EOF Error */
        Error_Handler();
      }
      else
      {
        /* Close the open text file */
        f_close(&MyFile1);
        
        /* If last access to Disk, unlink drive */
        if(disk_op == 2)
        {
          osMessagePut(DiskEvent, DISK_REMOVE_EVENT, 0);
        }
        
        disk_op = 1;
        
        /* Success of the demo: no error occurrence */
        BSP_LED_On(LED1);        
      }
    }
  }
}
开发者ID:eemei,项目名称:library-stm32f4,代码行数:57,代码来源:main.c


示例4: BSP_SD_DetectCallback

/**
  * @brief  SD detect callback
  * @param  None
  * @retval None
  */ 
void BSP_SD_DetectCallback(void)
{
  if((BSP_SD_IsDetected()))
  {  
    /* After sd disconnection, a SD Init is required */
    BSP_SD_Init();
        
    osMessagePut ( StorageEvent, MSDDISK_CONNECTION_EVENT, 0);
  }
  else
  {
    osMessagePut ( StorageEvent, MSDDISK_DISCONNECTION_EVENT, 0);
  }
}
开发者ID:pierreroth64,项目名称:STM32Cube_FW_F4,代码行数:19,代码来源:k_storage.c


示例5: HAL_UART_RxCpltCallback

/**
  * @brief  接收完成回调函数
  * @param  huart: 指向串口实例.
  * @retval None
  */
void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart)
{
  if(  USART1 == huart->Instance )
  {
      osMessagePut( ReceiveDataQueueHandle, gUSART1_RX_TMP , 0);  // 发送数据到缓冲区
  }
}
开发者ID:zichongde1989,项目名称:VehicleAutoLandingControl_useRC,代码行数:12,代码来源:main.c


示例6: main

/**************************************************************************//**
 * @brief
 *   Main function is a CMSIS RTOS thread in itself
 *
 * @note
 *   This example uses threads, memory pool and message queue to demonstrate the
 *   usage of these CMSIS RTOS features. In this simple example, the same
 *   functionality could more easily be achieved by doing everything in the main
 *   loop.
 *****************************************************************************/
int main(void)
{
  int count = 0;

  /* Chip errata */
  CHIP_Init();

  /* Initialize CMSIS RTOS structures */
  /* create memory pool */
  mpool = osPoolCreate(osPool(mpool));
  /* create msg queue */
  msgBox = osMessageCreate(osMessageQ(msgBox), NULL);
  /* create thread 1 */
  osThreadCreate(osThread(PrintLcdThread), NULL);

  /* Infinite loop */
  while (1)
  {
    count = (count + 1) & 0xF;

    /* Send message to PrintLcdThread */
    /* Allocate memory for the message */
    lcdText_t *mptr = osPoolAlloc(mpool);
    /* Set the message content */
    (*mptr)[0] = count >= 10 ? '1' : '0';
    (*mptr)[1] = count % 10 + '0';
    (*mptr)[2] = '\0';
    /* Send message */
    osMessagePut(msgBox, (uint32_t) mptr, osWaitForever);

    /* Wait now for half a second */
    osDelay(500);
  }
}
开发者ID:EnergyMicro,项目名称:EFM32_Gxxx_STK,代码行数:44,代码来源:rtx_tickless.c


示例7: USBH_UserProcess

/**
  * @brief  User Process
  * @param  phost: Host handle
  * @param  id:    Host Library user message ID
  * @retval None
  */
static void USBH_UserProcess  (USBH_HandleTypeDef *phost, uint8_t id)
{  
  switch (id)
  { 
  case HOST_USER_SELECT_CONFIGURATION:
    break;
    
  case HOST_USER_DISCONNECTION:
    osMessagePut ( StorageEvent, USBDISK_DISCONNECTION_EVENT, 0);
    break;
    
  case HOST_USER_CLASS_ACTIVE:
    osMessagePut ( StorageEvent, USBDISK_CONNECTION_EVENT, 0);
    break;
  }
}
开发者ID:451506709,项目名称:automated_machine,代码行数:22,代码来源:k_storage.c


示例8: USBH_LL_Disconnect

/**
  * @brief  USBH_LL_Disconnect 
  *         Handle USB Host disconnection event
  * @param  phost: Host Handle
  * @retval USBH_Status
  */
USBH_StatusTypeDef  USBH_LL_Disconnect  (USBH_HandleTypeDef *phost)
{
  /*Stop Host */ 
  USBH_LL_Stop(phost);  
  
  /* FRee Control Pipes */
  USBH_FreePipe  (phost, phost->Control.pipe_in);
  USBH_FreePipe  (phost, phost->Control.pipe_out);  
   
  phost->device.is_connected = 0; 
   
  if(phost->pUser != NULL)
  {    
    phost->pUser(phost, HOST_USER_DISCONNECTION);
  }
  USBH_UsrLog("USB Device disconnected"); 
  
  /* Start the low level driver  */
  USBH_LL_Start(phost);
  
  phost->gState = HOST_DEV_DISCONNECTED;
  
#if (USBH_USE_OS == 1)
  osMessagePut ( phost->os_event, USBH_PORT_EVENT, 0);
#endif 
  
  return USBH_OK;
}
开发者ID:MIDMX,项目名称:RaVisual,代码行数:34,代码来源:usbh_core.c


示例9: USBH_MTP_ClassRequest

/**
  * @brief  USBH_MTP_ClassRequest 
  *         The function is responsible for handling Standard requests
  *         for MTP class.
  * @param  phost: Host handle
  * @retval USBH Status
  */
static USBH_StatusTypeDef USBH_MTP_ClassRequest (USBH_HandleTypeDef *phost)
{  
#if (USBH_USE_OS == 1)
        osMessagePut ( phost->os_event, USBH_STATE_CHANGED_EVENT, 0);
#endif    
  return USBH_OK;;
}
开发者ID:451506709,项目名称:automated_machine,代码行数:14,代码来源:usbh_mtp.c


示例10: k_StorageInit

/**
  * @brief  Storage drives initialization
  * @param  None 
  * @retval None
  */
void k_StorageInit(void)
{
  /* Link the USB Host disk I/O driver */
   FATFS_LinkDriver(&USBH_Driver, USBDISK_Drive);
  
  /* Link the micro SD disk I/O driver */
   FATFS_LinkDriver(&SD_Driver, mSDDISK_Drive);  

  /* Create USB background task */
  osThreadDef(STORAGE_Thread, StorageThread, osPriorityBelowNormal, 0, 2 * configMINIMAL_STACK_SIZE);
  osThreadCreate (osThread(STORAGE_Thread), NULL);
  
  /* Create Storage Message Queue */
  osMessageQDef(osqueue, 10, uint16_t);
  StorageEvent = osMessageCreate (osMessageQ(osqueue), NULL);
  
  /* Init Host Library */
  USBH_Init(&hUSB_Host, USBH_UserProcess, 0);
  
  /* Add Supported Class */
  USBH_RegisterClass(&hUSB_Host, USBH_MSC_CLASS);
  
  /* Start Host Process */
  USBH_Start(&hUSB_Host);
  
  /* Enable SD Interrupt mode */
  BSP_SD_Init();
  BSP_SD_ITConfig();
  
  if(BSP_SD_IsDetected())
  {
    osMessagePut ( StorageEvent, MSDDISK_CONNECTION_EVENT, 0);
  }
}
开发者ID:451506709,项目名称:automated_machine,代码行数:39,代码来源:k_storage.c


示例11: sendCommand

/**
* @brief Send a generic message which packages a command
* @param msgQ: Message Q to send the message to
* @param source: Where the message is being sent from
* @param command: The command to send
* @param timeout: How long the operating system must wait until the message is successfully placed in message Q msgQ
*/
void sendCommand(osMessageQId msgQ, msgSource_t source, msgCommand_t command, uint32_t timeout) {
  uint8_t dataLength;
  msg_genericMessage_t *messageTxPtr;
  data_command_t *commandStructTxPtr;

  // Allocate a block of memory in the global memory pool for the generic message
  messageTxPtr = osPoolAlloc(genericMPool);

  // Identify the size of the data that will be linked in based on the data struct used
  dataLength = sizeof(data_command_t);

  // Allocated memory for the data
  commandStructTxPtr = pvPortMalloc(dataLength);

  // Fill the data into the allocated memory block
  commandStructTxPtr->messageType = MSG_TYPE_COMMAND;
  commandStructTxPtr->command = command;

  // Pass the pointer to the generic message
  messageTxPtr->pData = commandStructTxPtr;

  // Polpulate the generic message
  messageTxPtr->mRsp = MRSP_HANDLE;
  messageTxPtr->messageType = MSG_TYPE_COMMAND;
  messageTxPtr->messageSource = source;
  messageTxPtr->dataLength = dataLength;

  // Send the message!
  osMessagePut(msgQ, (uint32_t) messageTxPtr, timeout);
  
}
开发者ID:WoodyWoodsta,项目名称:ESP8266-STM32F0-WifiComms,代码行数:38,代码来源:genericMessaging_lib.c


示例12: BSP_AUDIO_OUT_HalfTransfer_CallBack

/**
  * @brief  Manages the DMA Half Transfer complete interrupt.
  * @param  None
  * @retval None
  */
void BSP_AUDIO_OUT_HalfTransfer_CallBack(void)
{ 
  if(haudio.state == AUDIOPLAYER_PLAY)
  {
    BSP_AUDIO_OUT_ChangeBuffer((uint16_t*)&haudio.buffer[AUDIO_BUFFER_SIZE /2], AUDIO_BUFFER_SIZE /2);
    osMessagePut ( AudioEvent, BUFFER_OFFSET_HALF, 0);    
  }
}
开发者ID:Lembed,项目名称:STM32CubeF4-mirrors,代码行数:13,代码来源:audioplayer_app.c


示例13: BSP_AUDIO_OUT_TransferComplete_CallBack

/**
  * @brief  Manages the DMA Transfer complete interrupt.
  * @param  None
  * @retval None
  */
void BSP_AUDIO_OUT_TransferComplete_CallBack(void)
{
  if(haudio.state == AUDIOPLAYER_PLAY)
  {
    BSP_AUDIO_OUT_ChangeBuffer((uint16_t*)&haudio.buffer[0], AUDIO_BUFFER_SIZE /2);
    osMessagePut ( AudioEvent, BUFFER_OFFSET_FULL, 0);    
  }
}
开发者ID:Lembed,项目名称:STM32CubeF4-mirrors,代码行数:13,代码来源:audioplayer_app.c


示例14: on_ble_evt

/**@brief Function for receiving the Application's BLE Stack events.
 *
 * @param[in]   p_ble_evt   Bluetooth stack event.
 */
static void on_ble_evt(ble_evt_t * p_ble_evt)
{
    ble_evt_t * mptr;

    mptr  = osPoolAlloc(ble_evt_pool);
    *mptr = *p_ble_evt;
    (void)osMessagePut(ble_stack_msg_box, (uint32_t)mptr, 0);
}
开发者ID:IOIOI,项目名称:nRF51,代码行数:12,代码来源:main.c


示例15: AUDIO_HalfTransfer_CallBack

/**
  * @brief  Manages the DMA Half Transfer complete interrupt.
  * @param  None
  * @retval None
  */
static void AUDIO_HalfTransfer_CallBack(void)
{ 
  if(haudio.in.state == AUDIO_RECORDER_PLAYING)
  {
    BSP_AUDIO_OUT_ChangeBuffer((uint16_t*)&haudio.buff[AUDIO_OUT_BUFFER_SIZE /2], AUDIO_OUT_BUFFER_SIZE /2);
    osMessagePut ( AudioEvent, PLAY_BUFFER_OFFSET_HALF, 0);    
  }
}
开发者ID:nguyenvuhung,项目名称:STM32Cube_FW_F4,代码行数:13,代码来源:audio_recorder_app.c


示例16: BSP_AUDIO_IN_HalfTransfer_CallBack

/**
  * @brief  Manages the DMA Half Transfer complete interrupt.
  * @param  None
  * @retval None
  */
void BSP_AUDIO_IN_HalfTransfer_CallBack(void)
{ 
  /* PDM to PCM data convert */
  BSP_AUDIO_IN_PDMToPCM((uint16_t*)&haudio.pdm[0], 
                        (uint16_t*)&haudio.buff[haudio.ppcm]);
  
  haudio.ppcm += AUDIO_IN_PDM_BUFFER_SIZE/4;
  
  if (haudio.ppcm == AUDIO_IN_BUFFER_SIZE/2)
  {
    osMessagePut ( AudioEvent, REC_BUFFER_OFFSET_HALF, 0); 
  }
  else if (haudio.ppcm >= AUDIO_IN_BUFFER_SIZE)
  {
    osMessagePut ( AudioEvent, REC_BUFFER_OFFSET_FULL, 0); 
    haudio.ppcm = 0;    
  }
}
开发者ID:nguyenvuhung,项目名称:STM32Cube_FW_F4,代码行数:23,代码来源:audio_recorder_app.c


示例17: HAL_GPIO_EXTI_Callback

/**
  * @brief EXTI line detection callbacks.
  * @param GPIO_Pin: Specifies the pins connected EXTI line
  * @retval None
  */
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
{
  if(GPIO_Pin == MFX_IRQOUT_PIN)
  {   
    if(BSP_SD_IsDetected())
    {
      if(CAMERA_Configured == 0)
      {
        BSP_SD_Init();
      }
        osMessagePut ( StorageEvent, MSDDISK_CONNECTION_EVENT, 0);     
    }
    else
    {
      osMessagePut ( StorageEvent, MSDDISK_DISCONNECTION_EVENT, 0);
    }
  }
}
开发者ID:451506709,项目名称:automated_machine,代码行数:23,代码来源:k_storage.c


示例18: StartTask_Uart1Reception

void StartTask_Uart1Reception (void const *argument) 
{
	extern osMessageQId Q_CmdReceptionHandle;
	
	uint32_t reclen;
	osStatus qretval;								/*!< The return value which indicates the osMessagePut() implementation result */
	uint8_t* ptrdata;								/*!< Pointer to any byte in the uart buffer */
	uint8_t (*ptr_bufhead)[1],			/*!< Pointer to the head of the uart buffer */
					(*ptr_buftail)[1];			/*!< Pointer to the tail of the uart buffer */
	
  while (1) 
	{
    osSignalWait (0x01, osWaitForever);
		
		reclen = MAX_DEPTH_UART1_BUF - huart1.hdmarx->Instance->NDTR;
		ptrdata = *uart_buf + reclen - 1;		// point to the last char received
		ptr_bufhead = (uint8_t(*)[1])uart1_buf[0];
		ptr_buftail = (uint8_t(*)[1])uart1_buf[MAX_COUNT_UART1_BUF - 2];
		
		if(*ptrdata == '\n')
		{
			/* Insert a terminal into the string */
			*(ptrdata + 1) = 0x0;
			
			if(*(--ptrdata) == '\r')	// A command has been received
			{
				/*
				* The current buffer has been used and post to the working thread
				* switch to the next uart1 queue buffer to recevie the furture data
				*/
				qretval = osMessagePut(Q_CmdReceptionHandle, (uint32_t)(uart_buf), 0);	// Put the pointer of the data container to the queue
				if(qretval != osOK)
				{
					__breakpoint(0);
						//printk(KERN_ERR "It's failed to put the command into the message queue!\r\n");
				}

				/* Move to the next row of the buffer */
				uart_buf++;
				if(uart_buf > (uint8_t(*)[50])ptr_buftail)
				{
						uart_buf = (uint8_t(*)[50])ptr_bufhead;
				}
			}
			/* Reset DMA_EN bit can result in the TCIF interrupt.
			The interrupt raises the HAL_UART_RxCpltCallback() event, the DMA_Rx will be restarted in it */
			HAL_DMA_Abort(huart1.hdmarx);
			USART_Start_Receive_DMA(&huart1);
		
		}
		else	/* Continue recepition if the last char is not '\n' */
		{
			__HAL_UART_ENABLE_IT(&huart1, UART_IT_IDLE);
		}
	}
}
开发者ID:35408EF66CCE4377B1E3C2495CA1C18A,项目名称:freerots_console,代码行数:56,代码来源:usart_common.c


示例19: USBH_UserProcess

/**
  * @brief  User Process
  * @param  phost: Host Handle
  * @param  id: Host Library user message ID
  * @retval None
  */
static void USBH_UserProcess(USBH_HandleTypeDef *phost, uint8_t id)
{  
  switch(id)
  { 
  case HOST_USER_SELECT_CONFIGURATION:
    break;
    
  case HOST_USER_DISCONNECTION:
    osMessagePut(AppliEvent, APPLICATION_DISCONNECT, 0);
    break;
    
  case HOST_USER_CLASS_ACTIVE:
    osMessagePut(AppliEvent, APPLICATION_READY, 0);
    break;
    
  default:
    break; 
  }
}
开发者ID:eemei,项目名称:library-stm32f4,代码行数:25,代码来源:main.c


示例20: UARTThread

void UARTThread(void const *argument) {
  uint16_t delay = 0;

  while(1) {
    printf("Specify the LD2 LED blink period: ");
    scanf("%hu", &delay);
    printf("\r\nSpecified period: %hu\n\r", delay);
    osMessagePut(MsgBox, delay, osWaitForever);
  }
}
开发者ID:Shreeyak,项目名称:mastering-stm32,代码行数:10,代码来源:main-ex3.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ osMutexRelease函数代码示例发布时间:2022-05-30
下一篇:
C++ osMessageGet函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap