本文整理汇总了C++中osMessageGet函数的典型用法代码示例。如果您正苦于以下问题:C++ osMessageGet函数的具体用法?C++ osMessageGet怎么用?C++ osMessageGet使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了osMessageGet函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: ble_stack_thread
/**@brief Thread for handling the Application's BLE Stack events.
*
* @details This thread is responsible for handling BLE Stack events sent from on_ble_evt().
*
* @param[in] arg Pointer used for passing some arbitrary information (context) from the
* osThreadCreate() call to the thread.
*/
void ble_stack_thread(void const * arg)
{
uint32_t err_code;
osEvent evt;
ble_evt_t * p_ble_evt;
UNUSED_PARAMETER(arg);
while (1)
{
evt = osMessageGet(ble_stack_msg_box, osWaitForever); // wait for message
if (evt.status == osEventMessage)
{
p_ble_evt = evt.value.p;
switch (p_ble_evt->header.evt_id)
{
case BLE_GAP_EVT_CONNECTED:
err_code = bsp_indication_set(BSP_INDICATE_CONNECTED);
APP_ERROR_CHECK(err_code);
m_conn_handle = p_ble_evt->evt.gap_evt.conn_handle;
break;
default:
// No implementation needed.
break;
}
(void)osPoolFree(ble_evt_pool, p_ble_evt);
}
}
}
开发者ID:IOIOI,项目名称:nRF51,代码行数:40,代码来源:main.c
示例2: ecg_2_lead_gui_tick
static void ecg_2_lead_gui_tick(state_ptr state)
{
uint32_t i = 0;
osEvent event;
uint32_t bpm = 0;
char str_bpm[4] = "-?-";
int32_t lead_I = 0, lead_II = 0;
/* Do transition actions */
/* Get bpm data */
event = osMessageGet(queue_ecg_bpm_screenHandle, 0);
if (event.status == osEventMessage)
{
/* Retrieve value */
bpm = (((uint32_t) event.value.v) >> 10);
sprintf(str_bpm, "%u", bpm);
item_area_set_text(&menu_ecg.items[1].item.area, str_bpm);
while (osMailPut(queue_lcdHandle, (void *) &menu_ecg.items[1]) != osOK)
{
osDelay(1);
}
}
开发者ID:outsidersdelaelectronica,项目名称:tiic-2015,代码行数:25,代码来源:state_ecg_2_lead.c
示例3: StorageThread
/**
* @brief Storage Thread
* @param argument: pointer that is passed to the thread function as start argument.
* @retval None
*/
static void StorageThread(void const * argument)
{
osEvent event;
for( ;; )
{
event = osMessageGet( StorageEvent, osWaitForever );
if( event.status == osEventMessage )
{
switch(event.value.v)
{
case USBDISK_CONNECTION_EVENT:
f_mount(&USBDISK_FatFs,USBDISK_Drive, 0);
StorageStatus[USB_DISK_UNIT] = 1;
break;
case USBDISK_DISCONNECTION_EVENT:
f_mount(0, USBDISK_Drive, 0);
StorageStatus[USB_DISK_UNIT] = 0;
break;
}
}
}
}
开发者ID:acrepina,项目名称:STM32F7_serverWEB,代码行数:30,代码来源:k_storage.c
示例4: commandProcessingThread
// Handle command event processing.
void commandProcessingThread(void const *argument)
{
UINT8 currentIndex;
for (;;)
{
// Wait for a command message.
osEvent commandEvent = osMessageGet(commandQueue, osWaitForever);
// Is this a command event?
if (commandEvent.status == osEventMessage)
{
// Point to the message.
commandMessage *message = (commandMessage *) commandEvent.value.p;
// Execute all the commands
currentIndex = 0;
while (currentIndex < message->length) {
currentIndex += handleCommand(message, currentIndex);
}
// Free the message.
osPoolFree(commandMemPool, message);
}
}
}
开发者ID:robgarbanati,项目名称:P9_proto,代码行数:27,代码来源:Command.c
示例5: MessageQueueConsumer
/**
* @brief Message Queue Consumer Thread.
* @param argument: Not used
* @retval None
*/
static void MessageQueueConsumer (const void *argument)
{
osEvent event;
for(;;)
{
/* Get the message from the queue */
event = osMessageGet(osQueue, 100);
if(event.status == osEventMessage)
{
if(event.value.v != ConsumerValue)
{
/* Catch-up. */
ConsumerValue = event.value.v;
/* Toggle LED3 to indicate error */
BSP_LED_Toggle(LED3);
}
else
{
/* Increment the value we expect to remove from the queue next time
round. */
++ConsumerValue;
}
}
}
}
开发者ID:z80,项目名称:stm32f429,代码行数:33,代码来源:main.c
示例6: sys_arch_mbox_tryfetch
/*---------------------------------------------------------------------------*
* Routine: sys_arch_mbox_tryfetch
*---------------------------------------------------------------------------*
* Description:
* Similar to sys_arch_mbox_fetch, but if message is not ready
* immediately, we'll return with SYS_MBOX_EMPTY. On success, 0 is
* returned.
* Inputs:
* sys_mbox_t mbox -- Handle of mailbox
* void **msg -- Pointer to pointer to msg received
* Outputs:
* u32_t -- SYS_MBOX_EMPTY if no messages. Otherwise,
* return ERR_OK.
*---------------------------------------------------------------------------*/
u32_t sys_arch_mbox_tryfetch(sys_mbox_t *mbox, void **msg) {
osEvent event = osMessageGet(mbox->id, 0);
if (event.status != osEventMessage)
return SYS_MBOX_EMPTY;
*msg = (void *)event.value.v;
return ERR_OK;
}
开发者ID:brucetsao,项目名称:arduino-ameba,代码行数:23,代码来源:sys_arch.c
示例7: MainTask
void MainTask()
{
for(;;)
{
// Wait for adc result and write it to the UART connected to the PC.
osEvent result = osMessageGet(mainTaskMessageQId, osWaitForever);
HAL_UART_Transmit(&huart2, (uint8_t*)&result.value.v, 4, 100);
}
}
开发者ID:wolfsberger,项目名称:STMCube-TempSensor,代码行数:9,代码来源:mainTask.cpp
示例8: Audio_Thread
/**
* @brief Audio task
* @param argument: pointer that is passed to the thread function as start argument.
* @retval None
*/
static void Audio_Thread(void const * argument)
{
uint32_t numOfReadBytes;
osEvent event;
for(;;)
{
event = osMessageGet(AudioEvent, 100 );
if( event.status == osEventMessage )
{
if(haudio.state == AUDIOPLAYER_PLAY)
{
switch(event.value.v)
{
case BUFFER_OFFSET_HALF:
if(f_read(&wav_file,
&haudio.buffer[0],
AUDIO_BUFFER_SIZE/2,
(void *)&numOfReadBytes) == FR_OK)
{
if(numOfReadBytes == 0)
{
haudio.state = AUDIOPLAYER_EOF;
}
}
else
{
haudio.state = AUDIOPLAYER_ERROR;
}
break;
case BUFFER_OFFSET_FULL:
if(f_read(&wav_file,
&haudio.buffer[AUDIO_BUFFER_SIZE/2],
AUDIO_BUFFER_SIZE/2,
(void *)&numOfReadBytes) == FR_OK)
{
if(numOfReadBytes == 0)
{
haudio.state = AUDIOPLAYER_EOF;
}
}
else
{
haudio.state = AUDIOPLAYER_ERROR;
}
break;
default:
break;
}
}
}
}
}
开发者ID:EarnestHein89,项目名称:STM32Cube_FW_F4,代码行数:61,代码来源:audioplayer_app.c
示例9: ble_stack_thread
/**@brief Thread for handling the Application's BLE Stack events.
*
* @details This thread is responsible for handling BLE Stack events sended from on_ble_evt().
*
* @param[in] arg Pointer used for passing some arbitrary information (context) from the
* osThreadCreate() call to the thread.
*/
void ble_stack_thread(void const * arg)
{
uint32_t err_code;
osEvent evt;
ble_evt_t * p_ble_evt;
UNUSED_PARAMETER(arg);
while (1)
{
evt = osMessageGet(ble_stack_msg_box, osWaitForever); // wait for message
if (evt.status == osEventMessage)
{
p_ble_evt = evt.value.p;
switch (p_ble_evt->header.evt_id)
{
case BLE_GAP_EVT_CONNECTED:
err_code = bsp_indication_set(BSP_INDICATE_CONNECTED);
APP_ERROR_CHECK(err_code);
m_conn_handle = p_ble_evt->evt.gap_evt.conn_handle;
break;
case BLE_GAP_EVT_DISCONNECTED:
err_code = bsp_indication_set(BSP_INDICATE_IDLE);
APP_ERROR_CHECK(err_code);
advertising_start();
break;
case BLE_GAP_EVT_TIMEOUT:
if (p_ble_evt->evt.gap_evt.params.timeout.src ==
BLE_GAP_TIMEOUT_SRC_ADVERTISING)
{
err_code = bsp_indication_set(BSP_INDICATE_IDLE);
APP_ERROR_CHECK(err_code);
// enable buttons to wake-up from power off
bsp_buttons_enable( (1 <<
WAKEUP_BUTTON_ID) | (1 << BOND_DELETE_ALL_BUTTON_ID) );
// Go to system-off mode (this function will not return; wakeup will cause a reset).
err_code = sd_power_system_off();
APP_ERROR_CHECK(err_code);
}
break;
default:
// No implementation needed.
break;
}
(void)osPoolFree(ble_evt_pool, p_ble_evt);
}
}
}
开发者ID:dhruvkakadiya,项目名称:OpenSJ_Bluz,代码行数:62,代码来源:main.c
示例10: sys_arch_mbox_fetch
/*---------------------------------------------------------------------------*
* Routine: sys_arch_mbox_fetch
*---------------------------------------------------------------------------*
* Description:
* Blocks the thread until a message arrives in the mailbox, but does
* not block the thread longer than "timeout" milliseconds (similar to
* the sys_arch_sem_wait() function). The "msg" argument is a result
* parameter that is set by the function (i.e., by doing "*msg =
* ptr"). The "msg" parameter maybe NULL to indicate that the message
* should be dropped.
*
* The return values are the same as for the sys_arch_sem_wait() function:
* Number of milliseconds spent waiting or SYS_ARCH_TIMEOUT if there was a
* timeout.
*
* Note that a function with a similar name, sys_mbox_fetch(), is
* implemented by lwIP.
* Inputs:
* sys_mbox_t mbox -- Handle of mailbox
* void **msg -- Pointer to pointer to msg received
* u32_t timeout -- Number of milliseconds until timeout
* Outputs:
* u32_t -- SYS_ARCH_TIMEOUT if timeout, else number
* of milliseconds until received.
*---------------------------------------------------------------------------*/
u32_t sys_arch_mbox_fetch(sys_mbox_t *mbox, void **msg, u32_t timeout) {
u32_t start = us_ticker_read();
osEvent event = osMessageGet(mbox->id, (timeout != 0)?(timeout):(osWaitForever));
if (event.status != osEventMessage)
return SYS_ARCH_TIMEOUT;
*msg = (void *)event.value.v;
return (us_ticker_read() - start) / 1000;
}
开发者ID:brucetsao,项目名称:arduino-ameba,代码行数:36,代码来源:sys_arch.c
示例11: receive_message
// Receive the 'data' in the Message 'queue'. Returns 1 if a message was received, 0 otherwise.
int receive_message(float * data, osMessageQId queue){
osEvent evt = osMessageGet(queue, 0);
if (evt.status == osEventMessage) {
Message* msg = ((Message *)evt.value.p);
*data = msg->data;
osPoolFree(mem_pool, msg);
return 1;
}
return 0;
}
开发者ID:TheTypoMaster,项目名称:ECSE-426-Microprocessor-System,代码行数:13,代码来源:threads.c
示例12: blinkThread
void blinkThread(void const *argument) {
uint16_t delay = 500; /* Default delay */
osEvent evt;
while(1) {
evt = osMessageGet(MsgBox, 1);
if(evt.status == osEventMessage)
delay = evt.value.v;
HAL_GPIO_TogglePin(LD2_GPIO_Port, LD2_Pin);
osDelay(delay);
}
}
开发者ID:Shreeyak,项目名称:mastering-stm32,代码行数:13,代码来源:main-ex3.c
示例13: demo_task1
static void demo_task1(void *arg)
{
osEvent event;
while (1) {
event = osMessageGet(p_msgqueue, osWaitForever);
if (event.status == osEventMessage) {
printf("demo_task1 get msg %d\n", event.value.v);
} else {
printf("demo_task1 get msg failed\n");
}
};
}
开发者ID:wosayttn,项目名称:aos,代码行数:13,代码来源:msgqueue_test.c
示例14: USBH_Process_OS
/**
* @brief USB Host Thread task
* @param pvParameters not used
* @retval None
*/
static void USBH_Process_OS(void const * argument)
{
osEvent event;
for(;;)
{
event = osMessageGet(((USBH_HandleTypeDef *)argument)->os_event, osWaitForever );
if( event.status == osEventMessage )
{
USBH_Process((USBH_HandleTypeDef *)argument);
}
}
}
开发者ID:MIDMX,项目名称:RaVisual,代码行数:19,代码来源:usbh_core.c
示例15: osMailGet
/// Get a mail from a queue
osEvent osMailGet(osMailQId queue_id, uint32_t millisec)
{
osEvent ret;
if (queue_id == NULL) {
ret.status = osErrorParameter;
return ret;
}
ret = osMessageGet(*((void **)queue_id), millisec);
if (ret.status == osEventMessage) ret.status = osEventMail;
return ret;
}
开发者ID:Paolo-Maffei,项目名称:rt-thread-stm32f4discovery,代码行数:15,代码来源:cmsis_rtthread.c
示例16: USBH_TEMPLATE_Init
/**
* @brief USBH_TEMPLATE_Init
* The function Initialize the TEMPLATE function
* @param phost: Host handle
* @retval USBH Status
*/
USBH_StatusTypeDef USBH_TEMPLATE_Init (USBH_HandleTypeDef *phost)
{
USBH_StatusTypeDef Status = USBH_BUSY;
#if (USBH_USE_OS == 1)
osEvent event;
event = osMessageGet( phost->class_ready_event, osWaitForever );
if( event.status == osEventMessage )
{
if(event.value.v == USBH_CLASS_EVENT)
{
#else
while ((Status == USBH_BUSY) || (Status == USBH_FAIL))
{
/* Host background process */
USBH_Process(phost);
if(phost->gState == HOST_CLASS)
{
#endif
Status = USBH_OK;
}
}
return Status;
}
/**
* @brief USBH_TEMPLATE_IOProcess
* TEMPLATE TEMPLATE process
* @param phost: Host handle
* @retval USBH Status
*/
USBH_StatusTypeDef USBH_TEMPLATE_IOProcess (USBH_HandleTypeDef *phost)
{
if (phost->device.is_connected == 1)
{
if(phost->gState == HOST_CLASS)
{
USBH_TEMPLATE_Process(phost);
}
}
return USBH_OK;
}
开发者ID:gilles951,项目名称:STM32F429_DISCOVERY,代码行数:51,代码来源:usbh_template.c
示例17: recv_thread
/*----------------------------------------------------------------------------
* Thread 2: Receive thread
*---------------------------------------------------------------------------*/
void recv_thread (void const *argument) {
T_MEAS *rptr;
osEvent evt;
for (;;) {
evt = osMessageGet(MsgBox, osWaitForever); /* wait for message */
if (evt.status == osEventMessage) {
rptr = evt.value.p;
printf ("\nVoltage: %.2f V\n",rptr->voltage);
printf ("Current: %.2f A\n",rptr->current);
printf ("Number of cycles: %d\n",(int)rptr->counter);
#ifdef __USE_FFLUSH
fflush (stdout);
#endif
osPoolFree(mpool,rptr); /* free memory allocated for message */
}
}
}
开发者ID:AndreMiras,项目名称:EFM32-Library,代码行数:21,代码来源:Message.c
示例18: PrintLcdThread
/**************************************************************************//**
* @brief
* Thread 1: Print LCD thread - modified to not use LCD
*****************************************************************************/
void PrintLcdThread(void const *argument)
{
lcdText_t *rptr;
osEvent evt;
(void) argument; /* Unused parameter. */
while (1)
{
/* Wait for message */
evt = osMessageGet(msgBox, osWaitForever);
if (evt.status == osEventMessage)
{
rptr = evt.value.p;
/* Free memory allocated for message */
osPoolFree(mpool, rptr);
}
}
}
开发者ID:AndreMiras,项目名称:EFM32-Library,代码行数:22,代码来源:rtx_tickless.c
示例19: StartThread
/**
* @brief Start task
* @param pvParameters not used
* @retval None
*/
static void StartThread(void const * argument)
{
osEvent event;
/* Init MSC Application */
MSC_InitApplication();
/* Init Host Library */
USBH_Init(&hUSBHost, USBH_UserProcess, 0);
/* Add Supported Class */
USBH_RegisterClass(&hUSBHost, USBH_MSC_CLASS);
/* Start Host Process */
USBH_Start(&hUSBHost);
/* Register the file system object to the FatFs module */
if(f_mount(&USBH_fatfs, "", 0) != FR_OK)
{
LCD_ErrLog("ERROR : Cannot Initialize FatFs! \n");
}
for( ;; )
{
event = osMessageGet(AppliEvent, osWaitForever);
if(event.status == osEventMessage)
{
switch(event.value.v)
{
case APPLICATION_DISCONNECT:
Appli_state = APPLICATION_DISCONNECT;
osSemaphoreRelease(MenuEvent);
break;
case APPLICATION_READY:
Appli_state = APPLICATION_READY;
default:
break;
}
}
}
}
开发者ID:pierreroth64,项目名称:STM32Cube_FW_F4,代码行数:49,代码来源:main.c
示例20: LogCollector_Process_OS
static void LogCollector_Process_OS(void const * argument)
{
osEvent event;
for(;;)
{
event = osMessageGet(((EventLogger_Handle_TypeDef *)argument)->os_event, osWaitForever );
//if(((EventLogger_Handle_TypeDef *)argument)-> LogStatus == LOG_BUFFER_FULL)
if( event.status == osEventMessage )
{
((EventLogger_Handle_TypeDef *)argument)->pLogData = &Log_List[event.value.v];
((EventLogger_Handle_TypeDef*) argument)->Interface->WriteLog((EventLogger_Handle_TypeDef*) argument);
((EventLogger_Handle_TypeDef *)argument)->pLogData = 0;
LogIndex_List[event.value.v] = 0;
}
//osDelay(0);
}
}
开发者ID:ntonjeta,项目名称:Nodo-Sensore,代码行数:21,代码来源:EventLogger.c
注:本文中的osMessageGet函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论