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

C++ pvPortMalloc函数代码示例

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

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



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

示例1: vCompetingMathTask3

static void vCompetingMathTask3( void *pvParameters )
{
    volatile double *pdArray, dTotal1, dTotal2, dDifference;
    volatile unsigned short *pusTaskCheckVariable;
    const size_t xArraySize = 10;
    size_t xPosition;
    short sError = pdFALSE;

    /* The variable this task increments to show it is still running is passed
    in as the parameter. */
    pusTaskCheckVariable = ( unsigned short * ) pvParameters;

    /* Allocate memory for use as an array. */
    pdArray = ( double * ) pvPortMalloc( xArraySize * sizeof( double ) );

    /* Keep filling an array, keeping a running total of the values placed in
    the array.  Then run through the array adding up all the values.  If the two
    totals do not match, stop the check variable from incrementing. */
    for( ;; )
    {
        dTotal1 = 0.0;
        dTotal2 = 0.0;

        for( xPosition = 0; xPosition < xArraySize; xPosition++ )
        {
            pdArray[ xPosition ] = ( double ) xPosition + 5.5;
            dTotal1 += ( double ) xPosition + 5.5;
        }

        for( xPosition = 0; xPosition < xArraySize; xPosition++ )
        {
            dTotal2 += pdArray[ xPosition ];
        }

        dDifference = dTotal1 - dTotal2;
        if( fabs( dDifference ) > 0.001 )
        {
            sError = pdTRUE;
        }

        if( sError == pdFALSE )
        {
            /* If the calculation has always been correct, increment the check
            variable so we know	this task is still running okay. */
            ( *pusTaskCheckVariable )++;
        }
    }
}
开发者ID:sean93park,项目名称:freertos,代码行数:48,代码来源:flop.c


示例2: b_ledb2_get_value

/*!
 *  \brief Get the ledb2 current value.
 *
 *  \param pxLog a Log structure.
 *
 *  \return true upon success, false if error.
 */
bool b_ledb2_get_value( xLogDef *pxLog )
{
   // Alloc memory for the log string.
   pxLog->pcStringLog = pvPortMalloc( 8*sizeof( char ) );
   if( NULL == pxLog->pcStringLog )
   {
      return( false );
   }
   pxLog->pfFreeStringLog = vPortFree; // Because pvPortMalloc() was used to
                                       // alloc the log string.
   // Build the log string.
   sprintf( pxLog->pcStringLog, "%d,%d", LED_Get_Intensity( LEDB2G ),
            LED_Get_Intensity( LEDB2R ) );

   return( true );
}
开发者ID:ThucVD2704,项目名称:femto-usb-blink-example,代码行数:23,代码来源:cpled.c


示例3:

static struct pios_gcsrcvr_dev *PIOS_gcsrcvr_alloc(void)
{
	struct pios_gcsrcvr_dev * gcsrcvr_dev;

	gcsrcvr_dev = (struct pios_gcsrcvr_dev *)pvPortMalloc(sizeof(*gcsrcvr_dev));
	if (!gcsrcvr_dev) return(NULL);

	gcsrcvr_dev->magic = PIOS_GCSRCVR_DEV_MAGIC;
	gcsrcvr_dev->Fresh = FALSE;
	gcsrcvr_dev->supv_timer = 0;

	/* The update callback cannot receive the device pointer, so set it in a global */
	global_gcsrcvr_dev = gcsrcvr_dev;

	return(gcsrcvr_dev);
}
开发者ID:ICRS,项目名称:OpenPilot-Clone,代码行数:16,代码来源:pios_gcsrcvr.c


示例4: e_potentiometer_get_config

/*!
 *  \brief Get the potentiometer sensor config.
 *
 *  \param ppcStringReply Input/Output. The response string. NEVER NULL AS INPUT.
 *                        A malloc for the response string is performed here;
 *                        the caller must free this string.
 *
 *  \return the status of the command execution.
 */
eExecStatus e_potentiometer_get_config( signed portCHAR **ppcStringReply )
{
   // Alloc space for the reply.
   *ppcStringReply = (signed portCHAR *)pvPortMalloc( POT_GETCONF_MAXLEN );
   if( NULL == *ppcStringReply )
   {
      *ppcStringReply = (signed portCHAR *)SHELL_ERRMSG_MEMALLOC;
      return( SHELL_EXECSTATUS_KO );
   }

   // Build the string.
   sprintf( (char *)*ppcStringReply, "lograte=%d\r\n""min=%d%%\r\n""max=%d%%\r\n""alarm=%s\r\n",
            ul_pot_lograte, ul_pot_min, ul_pot_max, ((b_pot_alarm == pdTRUE) ? "on" : "off"));

   return( SHELL_EXECSTATUS_OK );
}
开发者ID:InSoonPark,项目名称:asf,代码行数:25,代码来源:potentiometer.c


示例5: xEventGroupCreate

EventGroupHandle_t xEventGroupCreate( void )
{
	EventGroup_t *pxEventBits;

	pxEventBits = pvPortMalloc( sizeof( EventGroup_t ) );
	if( pxEventBits != NULL ) {
		pxEventBits->uxEventBits = 0;
		vListInitialise( &( pxEventBits->xTasksWaitingForBits ) );
		traceEVENT_GROUP_CREATE( pxEventBits );
	}
	else {
		traceEVENT_GROUP_CREATE_FAILED();
	}

	return ( EventGroupHandle_t ) pxEventBits;
}
开发者ID:KISSMonX,项目名称:FreeRTOS_F3Discovery_TEST,代码行数:16,代码来源:event_groups.c


示例6: vFullDemoIdleFunction

/* Called from vApplicationIdleHook(), which is defined in main.c. */
void vFullDemoIdleFunction( void )
{
const unsigned long ulMSToSleep = 15;
const unsigned char ucConstQueueNumber = 0xaaU;
void *pvAllocated;

/* These three functions are only meant for use by trace code, and not for
direct use from application code, hence their prototypes are not in queue.h. */
extern void vQueueSetQueueNumber( xQueueHandle pxQueue, unsigned char ucQueueNumber );
extern unsigned char ucQueueGetQueueNumber( xQueueHandle pxQueue );
extern unsigned char ucQueueGetQueueType( xQueueHandle pxQueue );
extern void vTaskSetTaskNumber( xTaskHandle xTask, unsigned portBASE_TYPE uxHandle );
extern unsigned portBASE_TYPE uxTaskGetTaskNumber( xTaskHandle xTask );

	/* Sleep to reduce CPU load, but don't sleep indefinitely in case there are
	tasks waiting to be terminated by the idle task. */
	Sleep( ulMSToSleep );

	/* Demonstrate a few utility functions that are not demonstrated by any of
	the standard demo tasks. */
	prvDemonstrateTaskStateAndHandleGetFunctions();

	/* If xMutexToDelete has not already been deleted, then delete it now.
	This is done purely to demonstrate the use of, and test, the 
	vSemaphoreDelete() macro.  Care must be taken not to delete a semaphore
	that has tasks blocked on it. */
	if( xMutexToDelete != NULL )
	{
		/* Before deleting the semaphore, test the function used to set its
		number.  This would normally only be done from trace software, rather
		than application code. */
		vQueueSetQueueNumber( xMutexToDelete, ucConstQueueNumber );

		/* Before deleting the semaphore, test the functions used to get its
		type and number.  Again, these would normally only be done from trace
		software, rather than application code. */
		configASSERT( ucQueueGetQueueNumber( xMutexToDelete ) == ucConstQueueNumber );
		configASSERT( ucQueueGetQueueType( xMutexToDelete ) == queueQUEUE_TYPE_MUTEX );
		vSemaphoreDelete( xMutexToDelete );
		xMutexToDelete = NULL;
	}

	/* Exercise heap_4 a bit.  The malloc failed hook will trap failed 
	allocations so there is no need to test here. */
	pvAllocated = pvPortMalloc( ( rand() % 100 ) + 1 );
	vPortFree( pvAllocated );
}
开发者ID:ptracton,项目名称:experimental,代码行数:48,代码来源:main_full.c


示例7: vFullDemoIdleFunction

/* Called from vApplicationIdleHook(), which is defined in main.c. */
void vFullDemoIdleFunction( void )
{
const unsigned long ulMSToSleep = 15;
void *pvAllocated;

	/* Sleep to reduce CPU load, but don't sleep indefinitely in case there are
	tasks waiting to be terminated by the idle task. */
	Sleep( ulMSToSleep );

	/* Demonstrate a few utility functions that are not demonstrated by any of
	the standard demo tasks. */
	prvDemonstrateTaskStateAndHandleGetFunctions();

	/* Demonstrate the use of xTimerPendFunctionCall(), which is not
	demonstrated by any of the standard demo tasks. */
	prvDemonstratePendingFunctionCall();

	/* Demonstrate the use of functions that query information about a software
	timer. */
	prvDemonstrateTimerQueryFunctions();


	/* If xMutexToDelete has not already been deleted, then delete it now.
	This is done purely to demonstrate the use of, and test, the
	vSemaphoreDelete() macro.  Care must be taken not to delete a semaphore
	that has tasks blocked on it. */
	if( xMutexToDelete != NULL )
	{
		/* For test purposes, add the mutex to the registry, then remove it
		again, before it is deleted - checking its name is as expected before
		and after the assertion into the registry and its removal from the
		registry. */
		configASSERT( pcQueueGetName( xMutexToDelete ) == NULL );
		vQueueAddToRegistry( xMutexToDelete, "Test_Mutex" );
		configASSERT( strcmp( pcQueueGetName( xMutexToDelete ), "Test_Mutex" ) == 0 );
		vQueueUnregisterQueue( xMutexToDelete );
		configASSERT( pcQueueGetName( xMutexToDelete ) == NULL );

		vSemaphoreDelete( xMutexToDelete );
		xMutexToDelete = NULL;
	}

	/* Exercise heap_5 a bit.  The malloc failed hook will trap failed
	allocations so there is no need to test here. */
	pvAllocated = pvPortMalloc( ( rand() % 500 ) + 1 );
	vPortFree( pvAllocated );
}
开发者ID:AlexShiLucky,项目名称:freertos,代码行数:48,代码来源:main_full.c


示例8: gsm_query_imsi

uint8_t gsm_query_imsi(void)
{
	// Query IMSI
	modem_out("AT+CIMI\r");

	// Read 4 lines
	gsm_read(	4,
				gsm.line);

	// trim and store IMSI
	line_trim(gsm.line[1], ' ');
	network.imsi = (char *)pvPortMalloc(40);
	strcpy(network.imsi, gsm.line[1]);

	// TODO: Check for errors
	return 0;	
}
开发者ID:just4chill,项目名称:SIM900,代码行数:17,代码来源:gsm.c


示例9: ftp_ram_upload

ftp_return_t ftp_ram_upload(void * state, const char const * path, uint32_t memaddr, uint32_t size, uint32_t chunk_size) {

	file_mem_addr = memaddr;
	file_size = size;
	file_chunk_size = chunk_size;
	file_chunks = (size + chunk_size - 1) / chunk_size;

	/* Allocate map */
	ram_map = pvPortMalloc(file_chunks);
	if (ram_map == NULL)
		return FTP_RET_NOSPC;

	memset(ram_map, 0, file_chunks);

	return FTP_RET_OK;

}
开发者ID:lirihe,项目名称:arm,代码行数:17,代码来源:backend_ram.c


示例10: PIOS_USART_alloc

static struct pios_usart_dev * PIOS_USART_alloc(void)
{
	struct pios_usart_dev * usart_dev;

	usart_dev = (struct pios_usart_dev *)pvPortMalloc(sizeof(*usart_dev));
	if (!usart_dev) return(NULL);

	usart_dev->rx_in_cb = 0;
	usart_dev->rx_in_context = 0;
	usart_dev->tx_out_cb = 0;
	usart_dev->tx_out_context = 0;
	usart_dev->magic = PIOS_USART_DEV_MAGIC;

	usart_dev->error_overruns = 0;

	return(usart_dev);
}
开发者ID:Crash1,项目名称:TauLabs,代码行数:17,代码来源:pios_usart.c


示例11: ringbuf_deinit

int
IIS328DQ::init()
{
	int ret = ERROR;
	
	if (probe() != OK)
		goto out;

	/* do SPI init (and probe) first */
	if (CDev::init() != OK)
		goto out;

	/* allocate basic report buffers */
	if (_reports != NULL) {
        ringbuf_deinit(_reports);
		vPortFree(_reports);
		_reports = NULL;
	}
	/* allocate basic report buffers */
	_reports = (ringbuf_t *) pvPortMalloc (sizeof(ringbuf_t));
	ringbuf_init(_reports, 2, sizeof(accel_report));

	if (_reports == NULL)
		goto out;

	_class_instance = register_class_devname(ACCEL_BASE_DEVICE_PATH);

	reset();

	measure();

	/* advertise sensor topic, measure manually to initialize valid report */
	struct accel_report arp;
	ringbuf_get(_reports, &arp, sizeof(arp));

	_accel_topic = orb_advertise_multi(ORB_ID(sensor_accel), &arp,
		&_orb_class_instance, (is_external()) ? ORB_PRIO_VERY_HIGH : ORB_PRIO_DEFAULT);

	if (_accel_topic == NULL) {
		DEVICE_DEBUG("failed to create sensor_accel publication");
	}

	ret = OK;
out:
	return ret;
}
开发者ID:SovietUnion1997,项目名称:PhenixPro_Devkit,代码行数:46,代码来源:iis328dq.cpp


示例12: PIOS_L3GD20_alloc

/**
 * @brief Allocate a new device
 */
static struct l3gd20_dev * PIOS_L3GD20_alloc(void)
{
	struct l3gd20_dev * l3gd20_dev;

	l3gd20_dev = (struct l3gd20_dev *)pvPortMalloc(sizeof(*l3gd20_dev));
	if (!l3gd20_dev) return (NULL);

	l3gd20_dev->magic = PIOS_L3GD20_DEV_MAGIC;

	l3gd20_dev->queue = xQueueCreate(PIOS_L3GD20_MAX_DOWNSAMPLE, sizeof(struct pios_sensor_gyro_data));
	if(l3gd20_dev->queue == NULL) {
		vPortFree(l3gd20_dev);
		return NULL;
	}

	return(l3gd20_dev);
}
开发者ID:Crash1,项目名称:TauLabs,代码行数:20,代码来源:pios_l3gd20.c


示例13: xGetLabelWidget

tWidget* xGetLabelWidget(void *akt, int row)
{

	basicDisplayLine *line = (basicDisplayLine*) akt;
	if (line->labelWidget != NULL)
	{
		vPortFree(line->labelWidget);
	}
	line->labelWidget = pvPortMalloc(sizeof(tCanvasWidget));

	if (line->type == xTagList + TAG_INDEX_GROUP)
	{
		((tCanvasWidget*) line->labelWidget)->pFont = DISPLAY_LABEL_GROUP_FONT;
	}
	else
	{
		((tCanvasWidget*) line->labelWidget)->pFont = DISPLAY_LABEL_FONT;
	}
	((tCanvasWidget*) line->labelWidget)->pcText = line->label;
	((tCanvasWidget*) line->labelWidget)->pucImage = NULL;
	((tCanvasWidget*) line->labelWidget)->ulFillColor
			= DISPLAY_LABEL_BACKGROUND_COLOR;
	((tCanvasWidget*) line->labelWidget)->ulOutlineColor = ClrBlack;
	((tCanvasWidget*) line->labelWidget)->ulStyle = DISPLAY_LABEL_STYLE;
	((tCanvasWidget*) line->labelWidget)->ulTextColor = DISPLAY_LABEL_COLOR;

	((tCanvasWidget*) line->labelWidget)->sBase.lSize = sizeof(tCanvasWidget);
	((tCanvasWidget*) line->labelWidget)->sBase.pChild = NULL;
	((tCanvasWidget*) line->labelWidget)->sBase.pDisplay = DISPLAY_DRIVER;
	((tCanvasWidget*) line->labelWidget)->sBase.pNext = NULL;
	((tCanvasWidget*) line->labelWidget)->sBase.pParent = NULL;
	((tCanvasWidget*) line->labelWidget)->sBase.pfnMsgProc = CanvasMsgProc;
	((tCanvasWidget*) line->labelWidget)->sBase.sPosition.sXMin
			= DISPLAY_LABEL_LEFT;
	((tCanvasWidget*) line->labelWidget)->sBase.sPosition.sYMin = (row
			* (DISPLAY_LINE_HEIGHT + DISPLAY_LINE_MARGIN))
			+ (DISPLAY_TOP_OFFSET);
	((tCanvasWidget*) line->labelWidget)->sBase.sPosition.sXMax
			= DISPLAY_LABEL_LEFT + DISPLAY_LABEL_WIDTH - 1;
	((tCanvasWidget*) line->labelWidget)->sBase.sPosition.sYMax = (row
			* (DISPLAY_LINE_HEIGHT + DISPLAY_LINE_MARGIN))
			+ (DISPLAY_TOP_OFFSET) + DISPLAY_LINE_HEIGHT - 1;

	return line->labelWidget;
}
开发者ID:hitubaldaniya,项目名称:lumweb,代码行数:45,代码来源:displayDraw.c


示例14: vPortFree

void *pvPortRealloc(void *mem, size_t newsize, const char *file, unsigned line)
{
    if (newsize == 0) {
        vPortFree(mem, file, line);
        return NULL;
    }

    void *p;
    p = pvPortMalloc(newsize, file, line, false);
    if (p) {
        /* zero the memory */
        if (mem != NULL) {
            memcpy(p, mem, newsize);
            vPortFree(mem, file, line);
        }
    }
    return p;
}
开发者ID:karawin,项目名称:Ka-Radio,代码行数:18,代码来源:heap_5.c


示例15: xEventGroupGenericCreate

EventGroupHandle_t xEventGroupGenericCreate( StaticEventGroup_t *pxStaticEventGroup )
{
EventGroup_t *pxEventBits;

	if( pxStaticEventGroup == NULL )
	{
		/* The user has not provided a statically allocated event group, so
		create on dynamically. */
		pxEventBits = ( EventGroup_t * ) pvPortMalloc( sizeof( EventGroup_t ) );
	}
	else
	{
		/* The user has provided a statically allocated event group - use it. */
		pxEventBits = ( EventGroup_t * ) pxStaticEventGroup; /*lint !e740 EventGroup_t and StaticEventGroup_t are guaranteed to have the same size and alignment requirement - checked by configASSERT(). */
	}

	if( pxEventBits != NULL )
	{
		pxEventBits->uxEventBits = 0;
		vListInitialise( &( pxEventBits->xTasksWaitingForBits ) );

		#if( configSUPPORT_STATIC_ALLOCATION == 1 )
		{
			if( pxStaticEventGroup == NULL )
			{
				pxEventBits->ucStaticallyAllocated = pdFALSE;
			}
			else
			{
				pxEventBits->ucStaticallyAllocated = pdTRUE;
			}
		}
		#endif /* configSUPPORT_STATIC_ALLOCATION */

		traceEVENT_GROUP_CREATE( pxEventBits );
	}
	else
	{
		traceEVENT_GROUP_CREATE_FAILED();
	}

	return ( EventGroupHandle_t ) pxEventBits;
}
开发者ID:mattmanj17,项目名称:freertos,代码行数:43,代码来源:event_groups.c


示例16: IpcTask

static void IpcTask (void * pvParameters)
{
	unsigned int msg, *local_vq_buf;
	int ret;
	struct virtqueue_buf virtq_buf;

	virtqueue_init();
	nvic_enable_irq(MAILBOX_IRQ);
	enable_mailbox_irq();

	for (;;) {
		xQueueReceive(MboxQueue, &msg, portMAX_DELAY);
		trace_printf("msg from mailbox : ");
		trace_value(msg);

		switch(msg) {

		case RP_MBOX_ECHO_REQUEST :
			mailbox_send(M3_TO_HOST_MBX, RP_MBOX_ECHO_REPLY);
			break;

		case HOST_TO_M3_VRING :
			ret = virtqueue_get_avail_buf(&virtqueue_list[msg], &virtq_buf);

			/* make a local copy of the buffer */
			local_vq_buf = pvPortMalloc(RP_MSG_BUF_SIZE);
			memcpy(local_vq_buf, virtq_buf.buf_ptr, RP_MSG_BUF_SIZE);

			virtqueue_add_used_buf(&virtqueue_list[msg], virtq_buf.head);

			/* dispatch to the service queue */
			rpmsg_dispatch_msg(local_vq_buf);

			break;

		case M3_TO_HOST_VRING :
			trace_printf("kick on vq0, dropping it \n");
			xSemaphoreGive(InitDoneSemaphore);
			break;
		}
	}
	vTaskDelete(NULL);
}
开发者ID:vstehle,项目名称:ducati_FreeRTOS,代码行数:43,代码来源:main.c


示例17: Satellite_CreateReceiverTask

/*void create_satellite_receiver_task(void)
 * Spectrum satellite receiver task. Initialize the USART instance
 * and create the task.
 */ 
void Satellite_CreateReceiverTask(  QueueHandle_t eventMaster, FlightModeHandler_t* stateHandler, SpHandler_t* setPointHandler, CtrlModeHandler_t * CtrlModeHandler)
{
  uint8_t* receiver_buffer_driver = pvPortMalloc(
      sizeof(uint8_t) * SATELLITE_MESSAGE_LENGTH*2 );

  Satellite_t *SatelliteParam = Satellite_Init(eventMaster, stateHandler, setPointHandler, CtrlModeHandler);


  if(!SatelliteParam || !receiver_buffer_driver)
  {
    for ( ;; );
  }

  QuadFC_SerialOptions_t opt = {
      BAUD_SATELLITE,
      EightDataBits,
      NoParity,
      OneStopBit,
      NoFlowControl,
      receiver_buffer_driver,
      SATELLITE_MESSAGE_LENGTH*2
  };

  uint8_t rsp = QuadFC_SerialInit(SATELITE_USART, &opt);
  if(!rsp)
  {
    /*Error - Could not create serial interface.*/

    for ( ;; )
    {

    }
  }


  /*Create the worker task*/
  xTaskCreate(  Satellite_ReceiverTask,   /* The task that implements the test. */
      "Satellite",                        /* Text name assigned to the task.  This is just to assist debugging.  The kernel does not use this name itself. */
      500,                                /* The size of the stack allocated to the task. */
      (void *) SatelliteParam,            /* The parameter is used to pass the already configured USART port into the task. */
      configMAX_PRIORITIES-2,             /* The priority allocated to the task. */
      NULL);                              /* Used to store the handle to the created task - in this case the handle is not required. */
}
开发者ID:mlundh,项目名称:QuadFC,代码行数:47,代码来源:satellite_receiver_task.c


示例18: reader_task

static void reader_task(){
	
	struct Message *pmessage = (struct Message*)pvPortMalloc(sizeof(struct Message));

	while (1) {
		xQueueReceive(xQueue, &pmessage, portMAX_DELAY);

		printf("\n...Message received!\n\n");
		fflush(stdout);

		for (int x = 0; x < ROW; x++) {
			for (int y = 0; y < COL; y++) {
				printf("%.1f, ", pmessage->Data[x, y]);
			}
			printf("\n");
			fflush(stdout);
		}
	}
}
开发者ID:JavierIH,项目名称:ejercicios_de_freertos,代码行数:19,代码来源:main.c


示例19: fifo__init

/*
成功 0
失败 -1
*/
int fifo__init(fifo_t *fifo,int size)
{
  fifo->buf=(uint8_t *)pvPortMalloc(size);
	MO_ASSERT((fifo->buf!=NULL));

  fifo->size=size;
  fifo->p_w=0;
  fifo->p_r=0;

	if(fifo->buf==NULL)
	{
		return -1;
	}
	else
	{
		return 0;
	}

}
开发者ID:HitszChen,项目名称:intorobot-firmware,代码行数:23,代码来源:lib_fifo.cpp


示例20: xQueueCreate

/**
 * @brief Allocate a new device
 */
static struct mpu6000_dev *PIOS_MPU6000_alloc(void)
{
    struct mpu6000_dev *mpu6000_dev;

    mpu6000_dev = (struct mpu6000_dev *)pvPortMalloc(sizeof(*mpu6000_dev));
    if (!mpu6000_dev) {
        return NULL;
    }

    mpu6000_dev->magic = PIOS_MPU6000_DEV_MAGIC;

    mpu6000_dev->queue = xQueueCreate(PIOS_MPU6000_MAX_DOWNSAMPLE, sizeof(struct pios_mpu6000_data));
    if (mpu6000_dev->queue == NULL) {
        vPortFree(mpu6000_dev);
        return NULL;
    }

    return mpu6000_dev;
}
开发者ID:Alex-Rongzhen-Huang,项目名称:OpenPilot,代码行数:22,代码来源:pios_mpu6000.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ pvTimerGetTimerID函数代码示例发布时间:2022-05-30
下一篇:
C++ pv函数代码示例发布时间: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