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

C++ CHECK_PARAM函数代码示例

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

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



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

示例1: PWM_PinConfig

/*********************************************************************//**
 * @brief		Set pin used as PWM function corresponding to each channel.
 * @param[in]	PWMx: PWM peripheral, should be LPC_PWM1.
 * @param[in]	PWM_Channel PWM channel number, should be in range from
 * 							1 to 6
 * @param[in]	PinselOption PWM pin selection option, PinselOption depends
 * 				on which selected channel as following:
 * 				- PWM_Channel = 1:
 *					+ PWM1_1_P1_18
 *					+ PWM1_1_P2_0
 * 				- PWM_Channel = 2:
 *					+ PWM1_2_P1_20
 *					+ PWM1_2_P2_1
 * 				- PWM_Channel = 3:
 *					+ PWM1_3_P1_21
 *					+ PWM1_3_P2_2
 * 				- PWM_Channel = 4:
 *					+ PWM1_4_P1_23
 *					+ PWM1_4_P2_3
 * 				- PWM_Channel = 5:
 *					+ PWM1_5_P1_24
 *					+ PWM1_5_P2_4
 * 				- PWM_Channel = 6:
 *					+ PWM1_6_P1_26
 *					+ PWM1_6_P2_5
 * @return 		None
 **********************************************************************/
void PWM_PinConfig(LPC_PWM_TypeDef *PWMx, uint8_t PWM_Channel, uint8_t PinselOption)
{
	CHECK_PARAM(PARAM_PWMx(PWMx));

	if (PWMx == LPC_PWM1)
	{
		CHECK_PARAM(PARAM_PWM1_CHANNEL(PWM_Channel));
		switch (PWM_Channel)
		{
		case 1:
			CHECK_PARAM(PARAM_PWM1_1_PIN(PinselOption));
			PINSEL_ConfigPin((PINSEL_CFG_Type *)(&pwm1_1_pinsel[PinselOption]));
			break;
		case 2:
			CHECK_PARAM(PARAM_PWM1_2_PIN(PinselOption));
			PINSEL_ConfigPin((PINSEL_CFG_Type *)(&pwm1_2_pinsel[PinselOption]));
			break;
		case 3:
			CHECK_PARAM(PARAM_PWM1_3_PIN(PinselOption));
			PINSEL_ConfigPin((PINSEL_CFG_Type *)(&pwm1_3_pinsel[PinselOption]));
			break;
		case 4:
			CHECK_PARAM(PARAM_PWM1_4_PIN(PinselOption));
			PINSEL_ConfigPin((PINSEL_CFG_Type *)(&pwm1_4_pinsel[PinselOption]));
			break;
		case 5:
			CHECK_PARAM(PARAM_PWM1_5_PIN(PinselOption));
			PINSEL_ConfigPin((PINSEL_CFG_Type *)(&pwm1_5_pinsel[PinselOption]));
			break;
		case 6:
			CHECK_PARAM(PARAM_PWM1_6_PIN(PinselOption));
			PINSEL_ConfigPin((PINSEL_CFG_Type *)(&pwm1_6_pinsel[PinselOption]));
			break;
		}
	}
}
开发者ID:leoarcu,项目名称:Electroestimulador,代码行数:63,代码来源:lpc17xx_pwm.c


示例2: IpappGetSocketId

//Ö§³Öhost name
//ÄÚ²¿º¯Êý ͨ¹ý½Ó¿Ú½á¹¹Ìå»ñÈ¡SOCKET ID
//Èë²Î thisÖ¸Õ룬 ·µ»ØÖµ SOCKET ID (OR INVALID SOCKET)
SOCKET IpappGetSocketId(IPAPP_USER_S* pThis)
{
  //Èë²Î¼ì²é
  CHECK_PARAM(pThis);
  
  UINT32 uiRet = VOS_OK;
  char* pcAddr = NULL;
  //SOCKET soSocket = 0;
  struct hostent *remoteHost = NULL;
  
  if (!pThis->bsocketid)
  {
    
    if(!pThis->bip)
    {
      remoteHost = gethostbyname(pThis->hostname);
      
      if (remoteHost == NULL)
      {
        uiRet = WSAGetLastError();
        printf("Function failed with error: %ld\n", uiRet);
        return VOS_ERROR;
      }
      
      pcAddr = inet_ntoa (*(struct in_addr *)*remoteHost->h_addr_list);
      
    }
    else
    {
      pcAddr = pThis->ip;
    }
    
    return CreateConnectSocket(pThis->usPort, (const char *) pcAddr);
  }
  
  return pThis->socketid;
  
}
开发者ID:bluesummer,项目名称:demo,代码行数:41,代码来源:Ipapp.cpp


示例3: SPI_Init

/********************************************************************//**
 * @brief		Initializes the SPIx peripheral according to the specified
*               parameters in the UART_ConfigStruct.
 * @param[in]	SPIx	SPI peripheral selected, should be SPI
 * @param[in]	SPI_ConfigStruct Pointer to a SPI_CFG_Type structure
*                    that contains the configuration information for the
*                    specified SPI peripheral.
 * @return 		None
 *********************************************************************/
void SPI_Init(SPI_TypeDef *SPIx, SPI_CFG_Type *SPI_ConfigStruct)
{
	SPI_PinCFG_Type defaultSPIPinCfg;
	uint32_t tmp;

	CHECK_PARAM(PARAM_SPIx(SPIx));

	if(SPIx == SPI)
	{
		/* Set up clock and power for UART module */
		CLKPWR_ConfigPPWR (CLKPWR_PCONP_PCSPI, ENABLE);
		/* As default, peripheral clock for UART0 module
		 * is set to FCCLK / 2 */
		CLKPWR_SetPCLKDiv(CLKPWR_PCLKSEL_SPI, CLKPWR_PCLKSEL_CCLK_DIV_2);
		// Set UART0 function pin as default
		defaultSPIPinCfg.SCK_Pin = SPI_SCK_P0_15;
		defaultSPIPinCfg.SSEL_Pin = SPI_SSEL_P0_16;
		defaultSPIPinCfg.MISO_Pin = SPI_MISO_P0_17;
		defaultSPIPinCfg.MOSI_Pin = SPI_MOSI_P0_18;
		SPI_PinConfig(SPIx, &defaultSPIPinCfg, SPI_ConfigStruct->Mode);
	}

	// Configure SPI, interrupt is disable as default
	tmp = ((SPI_ConfigStruct->CPHA) | (SPI_ConfigStruct->CPOL) \
		| (SPI_ConfigStruct->DataOrder) | (SPI_ConfigStruct->Databit) \
		| (SPI_ConfigStruct->Mode) | SPI_SPCR_BIT_EN) & SPI_SPCR_BITMASK;
	// write back to SPI control register
	SPIx->SPCR = tmp;

	// Set clock rate for SPI peripheral
	SPI_SetClock(SPIx, SPI_ConfigStruct->ClockRate);

	// If interrupt flag is set, Write '1' to Clear interrupt flag
	if (SPIx->SPINT & SPI_SPINT_INTFLAG)
	{
		SPIx->SPINT = SPI_SPINT_INTFLAG;
	}
}
开发者ID:m3y54m,项目名称:32bitmicro,代码行数:47,代码来源:lpc17xx_spi.c


示例4: SCT_Config

/*********************************************************************//**
 * @brief 		Select 16/32 bit SCT counter
 * @param[in]	value 	configuration value for SCT
 * 					- SCT_CONFIG_16BIT_COUNTER	:16-bit counter
 * 					- SCT_CONFIG_32BIT_COUNTER	:32-bit counter
 * @return 		None
 **********************************************************************/
void SCT_Config(uint32_t value)
{
	CHECK_PARAM(PARAM_SCT_CONFIG_COUNTER_TYPE(value));

	LPC_SCT->CONFIG = value;
}
开发者ID:NeuronRobotics,项目名称:microcontroller-sample,代码行数:13,代码来源:lpc43xx_sct.c


示例5: I2C_Init

/********************************************************************//**
 * @brief		Initializes the I2Cx peripheral with specified parameter.
 * @param[in]	I2Cx	I2C peripheral selected, should be
 * 				- LPC_I2C0
 * 				- LPC_I2C1
 * 				- LPC_I2C2
 * @param[in]	clockrate Target clock rate value to initialized I2C
 * 				peripheral (Hz)
 * @return 		None
 *********************************************************************/
void I2C_Init(LPC_I2C_TypeDef *I2Cx, uint32_t clockrate)
{
	CHECK_PARAM(PARAM_I2Cx(I2Cx));

	if (I2Cx==LPC_I2C0)
	{
		/* Set up clock and power for I2C0 module */
		CLKPWR_ConfigPPWR (CLKPWR_PCONP_PCI2C0, ENABLE);
		/* As default, peripheral clock for I2C0 module
		 * is set to FCCLK / 2 */
		CLKPWR_SetPCLKDiv(CLKPWR_PCLKSEL_I2C0, CLKPWR_PCLKSEL_CCLK_DIV_2);
	}
	else if (I2Cx==LPC_I2C1)
	{
		/* Set up clock and power for I2C1 module */
		CLKPWR_ConfigPPWR (CLKPWR_PCONP_PCI2C1, ENABLE);
		/* As default, peripheral clock for I2C1 module
		 * is set to FCCLK / 2 */
		CLKPWR_SetPCLKDiv(CLKPWR_PCLKSEL_I2C1, CLKPWR_PCLKSEL_CCLK_DIV_2);
	}
	else if (I2Cx==LPC_I2C2)
	{
		/* Set up clock and power for I2C2 module */
		CLKPWR_ConfigPPWR (CLKPWR_PCONP_PCI2C2, ENABLE);
		/* As default, peripheral clock for I2C2 module
		 * is set to FCCLK / 2 */
		CLKPWR_SetPCLKDiv(CLKPWR_PCLKSEL_I2C2, CLKPWR_PCLKSEL_CCLK_DIV_2);
	}
	else {
		// Up-Support this device
		return;
	}

    /* Set clock rate */
    I2C_SetClock(I2Cx, clockrate);
    /* Set I2C operation to default */
    I2Cx->I2CONCLR = (I2C_I2CONCLR_AAC | I2C_I2CONCLR_STAC | I2C_I2CONCLR_I2ENC);
}
开发者ID:Martin-P,项目名称:lpc1768-control-bluetooth-dongle,代码行数:48,代码来源:lpc17xx_i2c.c


示例6: CRC_WriteData

void CRC_WriteData( uint8_t * data, uint8_t bitlen )
{
    uint16_t * data_word = (uint16_t *)data;
    uint32_t * data_dword = (uint32_t *)data;

    CHECK_PARAM(( bitlen == 8 ) || ( bitlen == 16 ) || ( bitlen == 32 ));

    switch ( bitlen )
    {
        case 32:
        	LPC_CRC->WR_DATA_DWORD = *data_dword;
        	break;
        case 16:
        	LPC_CRC->WR_DATA_WORD = *data_word;
        	break;
        case 8:
       		LPC_CRC->WR_DATA_BYTE = *data;
        	break;
        default:
        	break;
    }
    return;
}
开发者ID:jiankangshiye,项目名称:DJYOS,代码行数:23,代码来源:lpc12xx_crc.c


示例7: I2C_DeInit

/*********************************************************************//**
 * @brief		De-initializes the I2C peripheral registers to their
 *                  default reset values.
 * @param[in]	I2Cx	I2C peripheral selected, should be
 *  			- LPC_I2C0
 * 				- LPC_I2C1
 * 				- LPC_I2C2
 * @return 		None
 **********************************************************************/
void I2C_DeInit(LPC_I2C_TypeDef* I2Cx)
{
	CHECK_PARAM(PARAM_I2Cx(I2Cx));

	/* Disable I2C control */
	I2Cx->I2CONCLR = I2C_I2CONCLR_I2ENC;

	if (I2Cx==LPC_I2C0)
	{
		/* Disable power for I2C0 module */
		CLKPWR_ConfigPPWR (CLKPWR_PCONP_PCI2C0, DISABLE);
	}
	else if (I2Cx==LPC_I2C1)
	{
		/* Disable power for I2C1 module */
		CLKPWR_ConfigPPWR (CLKPWR_PCONP_PCI2C1, DISABLE);
	}
	else if (I2Cx==LPC_I2C2)
	{
		/* Disable power for I2C2 module */
		CLKPWR_ConfigPPWR (CLKPWR_PCONP_PCI2C2, DISABLE);
	}
}
开发者ID:Martin-P,项目名称:lpc1768-control-bluetooth-dongle,代码行数:32,代码来源:lpc17xx_i2c.c


示例8: TIM_UpdateMatchValue

/*********************************************************************//**
 * @brief 		Update Match value
 * @param[in]	TIMx Pointer to timer device, should be:
 *   			- LPC_TIM0: TIMER0 peripheral
 * 				- LPC_TIM1: TIMER1 peripheral
 * 				- LPC_TIM2: TIMER2 peripheral
 * 				- LPC_TIM3: TIMER3 peripheral
 * @param[in]	MatchChannel	Match channel, should be: 0..3
 * @param[in]	MatchValue		updated match value
 * @return 		None
 **********************************************************************/
void TIM_UpdateMatchValue(LPC_TIM_TypeDef *TIMx,uint8_t MatchChannel, uint32_t MatchValue)
{
	CHECK_PARAM(PARAM_TIMx(TIMx));
	switch(MatchChannel)
	{
	case 0:
		TIMx->MR0 = MatchValue;
		break;
	case 1:
		TIMx->MR1 = MatchValue;
		break;
	case 2:
		TIMx->MR2 = MatchValue;
		break;
	case 3:
		TIMx->MR3 = MatchValue;
		break;
	default:
		//Error Loop
		while(1);
	}

}
开发者ID:zhuhuijia0001,项目名称:eload,代码行数:34,代码来源:lpc17xx_timer.c


示例9: I2C_SetClock

/*********************************************************************//**
 * @brief 		Setup clock rate for I2C peripheral
 * @param[in] 	I2Cx	I2C peripheral selected, should be:
 * 				- LPC_I2C0
 * 				- LPC_I2C1
 * 				- LPC_I2C2
 * @param[in]	target_clock : clock of SSP (Hz)
 * @return 		None
 ***********************************************************************/
static void I2C_SetClock (LPC_I2C_TypeDef *I2Cx, uint32_t target_clock)
{
	uint32_t temp;

	CHECK_PARAM(PARAM_I2Cx(I2Cx));

	// Get PCLK of I2C controller
	if (I2Cx == LPC_I2C0)
	{
		temp = CLKPWR_GetPCLK (CLKPWR_PCLKSEL_I2C0) / target_clock;
	}
	else if (I2Cx == LPC_I2C1)
	{
		temp = CLKPWR_GetPCLK (CLKPWR_PCLKSEL_I2C1) / target_clock;
	}
	else if (I2Cx == LPC_I2C2)
	{
		temp = CLKPWR_GetPCLK (CLKPWR_PCLKSEL_I2C2) / target_clock;
	}

	/* Set the I2C clock value to register */
	I2Cx->I2SCLH = (uint32_t)(temp / 2);
	I2Cx->I2SCLL = (uint32_t)(temp - I2Cx->I2SCLH);
}
开发者ID:Martin-P,项目名称:lpc1768-control-bluetooth-dongle,代码行数:33,代码来源:lpc17xx_i2c.c


示例10: GPT_CounterReset

/****************************************************************************//**
 * @brief      Reset GPT counter 
 *
 * @param[in]  gptID:  Select the GPT module
 *
 * @return reset status
 *  
 * Reset the GPT counter
 *******************************************************************************/
Status GPT_CounterReset(GPT_ID_Type gptID)
{  
  gpt_reg_t * GPTx = (gpt_reg_t *)(gptAddr[gptID]);
  volatile uint32_t cnt = 0;
  
  CHECK_PARAM(IS_GPT_PERIPH(gptID));
    
  /* Reset the GPT counter */
  GPTx->CNT_EN.BF.CNT_RESET = 0x1;
  
  /* Wating until the counter reset is done */
  while(cnt < 0x300000)
  {
    /* Read the counter reset status */
    if(GPTx->CNT_EN.BF.CNT_RST_DONE)
    {
      return DSUCCESS;
    }
    
    cnt++;
  }
  
  return DERROR;
}
开发者ID:tomsparrow25,项目名称:wifisdk_for_wm,代码行数:33,代码来源:mc200_gpt.c


示例11: SSP_SendData

/*********************************************************************//**
 * @brief		Transmit a single data through SSPx peripheral
 * @param[in]	SSPx	SSP peripheral selected, should be:
 * 						- LPC_SSP0: SSP0 peripheral
 * 						- LPC_SSP1: SSP1 peripheral
 * @param[in]	Data	Data to transmit (must be 16 or 8-bit long,
 * 						this depend on SSP data bit number configured)
 * @return 		none
 **********************************************************************/
void SSP_SendData(LPC_SSP_TypeDef* SSPx, uint16_t Data)
{
	CHECK_PARAM(PARAM_SSPx(SSPx));

	SSPx->DR = SSP_DR_BITMASK(Data);
}
开发者ID:DanMills,项目名称:j4cDAC,代码行数:15,代码来源:lpc17xx_ssp.c


示例12: SSP_GetDataSize

/*****************************************************************************//**
* @brief		Get data size bit selected
* @param[in]	SSPx pointer to LPC_SSP_TypeDef structure, should be:
* 				- LPC_SSP0: SSP0 peripheral
* 				- LPC_SSP1: SSP1 peripheral
* @return		Data size, could be:
*				- SSP_DATABIT_4: 4 bit transfer
*				- SSP_DATABIT_5: 5 bit transfer
*				...
*				- SSP_DATABIT_16: 16 bit transfer
*******************************************************************************/
uint8_t SSP_GetDataSize(LPC_SSP_TypeDef* SSPx)
{
	CHECK_PARAM(PARAM_SSPx(SSPx));
	return (SSPx->CR0 & (0xF));
}
开发者ID:DanMills,项目名称:j4cDAC,代码行数:16,代码来源:lpc17xx_ssp.c


示例13: ATIMER_ClearIntStatus

/*********************************************************************//**
 * @brief 		Clear ATIMER Interrupt Status
 * @param[in]	ATIMERx Pointer to timer device, should be: LPC_ATIMER
 * @return 		None
 **********************************************************************/
void ATIMER_ClearIntStatus(LPC_ATIMER_Type *ATIMERx)
{
	CHECK_PARAM(PARAM_ATIMERx(ATIMERx));
	ATIMERx->CLR_STAT = 1;
	while((ATIMERx->STATUS & 1) == 1);
}
开发者ID:AlexShiLucky,项目名称:freertos,代码行数:11,代码来源:lpc18xx_atimer.c


示例14: ATIMER_GetPresetValue

/*********************************************************************//**
 * @brief 		Read value of preset register
 * @param[in]	ATIMERx Pointer to timer/counter device, should be: LPC_ATIMER
 * @return 		Value of capture register
 **********************************************************************/
uint32_t ATIMER_GetPresetValue(LPC_ATIMER_Type *ATIMERx)
{
	CHECK_PARAM(PARAM_ATIMERx(ATIMERx));
	return ATIMERx->PRESET;
}
开发者ID:AlexShiLucky,项目名称:freertos,代码行数:10,代码来源:lpc18xx_atimer.c


示例15: ATIMER_UpdatePresetValue

/*********************************************************************//**
 * @brief 		Update Preset value
 * @param[in]	ATIMERx Pointer to timer device, should be: LPC_ATIMER
 * @param[in]	PresetValue	updated preset value
 * @return 		None
 **********************************************************************/
void ATIMER_UpdatePresetValue(LPC_ATIMER_Type *ATIMERx,uint32_t PresetValue)
{
	CHECK_PARAM(PARAM_ATIMERx(ATIMERx));
	ATIMERx->PRESET = PresetValue;
}
开发者ID:AlexShiLucky,项目名称:freertos,代码行数:11,代码来源:lpc18xx_atimer.c


示例16: main


//.........这里部分代码省略.........
        if (debug)
            printf("using policy file %s\n", policyFile);
        rc = InitWSSEC(stub->env, stub->stub, policyFile);
        if (rc) {
            fprintf(stderr, "ERROR: cannot initialize WS-SEC policy from %s\n", policyFile);
            exit(1);
        }
    }

    char *image_url = NULL;
    if (image_manifest) {
        char t[BUFSIZE];
        snprintf(t, BUFSIZE, "http://%s%s/%s", walrus_hostport, WALRUS_ENDPOINT, image_manifest);
        image_url = strdup(t);
    }

    char *kernel_url = NULL;
    if (kernel_manifest) {
        char t[BUFSIZE];
        snprintf(t, BUFSIZE, "http://%s%s/%s", walrus_hostport, WALRUS_ENDPOINT, kernel_manifest);
        kernel_url = strdup(t);
    }

    char *ramdisk_url = NULL;
    if (ramdisk_manifest) {
        char t[BUFSIZE];
        snprintf(t, BUFSIZE, "http://%s%s/%s", walrus_hostport, WALRUS_ENDPOINT, ramdisk_manifest);
        ramdisk_url = strdup(t);
    }

    /***********************************************************/
    if (!strcmp(command, "runInstance")) {
        if (params.virtualBootRecordLen < 1) {
            CHECK_PARAM(image_id, "image ID and manifest path");
            CHECK_PARAM(kernel_id, "kernel ID and manifest path");
        }

        char *privMac, *pubMac, *privIp;
        char *platform = NULL;
        int vlan = 3;
        privMac = strdup(mac_addr);
        mac_addr[0] = 'b';
        mac_addr[1] = 'b';
        privIp = strdup("10.0.0.202");
        srand(time(NULL));

        /* generate random IDs if they weren't specified */
#define C rand()%26 + 97

        while (count--) {
            char *iid, *rid, *uuid;

            char ibuf[8];
            if (instance_id == NULL || count > 1) {
                snprintf(ibuf, 8, "i-%c%c%c%c%c", C, C, C, C, C);
                iid = ibuf;
            } else {
                iid = instance_id;
            }

            char rbuf[8];
            if (reservation_id == NULL || count > 1) {
                snprintf(rbuf, 8, "r-%c%c%c%c%c", C, C, C, C, C);
                rid = rbuf;
            } else {
                rid = reservation_id;
开发者ID:sangmin,项目名称:eucalyptus,代码行数:67,代码来源:NCclient.c


示例17: IOCON_DCDLocate

/*********************************************************************//**
 * @brief 		Selects pin location for DCD pin
 * @param[in]	sck SCK0 pin position, it can be :
 *                -DCD_PIO2_2 : PIO2_2/DCD/MISO1     
 *                -DCD_PIO3_2 : PIO3_2/DCD
 * @param[in]	None
 * @return 		None
 **********************************************************************/
void IOCON_DCDLocate(DCD_Position_Typedef dcd)
{
    CHECK_PARAM(PARAM_DCD(dcd));
    LPC_IOCON->DCDLOC = dcd;
}
开发者ID:inf3ct3d,项目名称:fmtr,代码行数:13,代码来源:lpc11xx_iocon.c


示例18: IOCON_SCK0Locate

/*********************************************************************//**
 * @brief 		Selects pin location for SCK0 pin
 * @param[in]	sck SCK0 pin position, it can be :
 *                -SCK_PIO0_10 : SWCLK/PIO0_10/SCK0/CT16B0_MAT2        
 *                -SCK_PIO2_11 : PIO2_11/SCK0
 *                -SCK_PIO0_6  : PIO0_6/SCK0
 * @param[in]	None
 * @return 		None
 **********************************************************************/
void IOCON_SCK0Locate(SCK0_Position_Typedef sck)
{
    CHECK_PARAM(PARAM_SCK(sck));
    LPC_IOCON->SCKLOC = sck;
}
开发者ID:inf3ct3d,项目名称:fmtr,代码行数:14,代码来源:lpc11xx_iocon.c


示例19: unload


//.........这里部分代码省略.........
        std::string missileParticle = XML::getProperty(node, "missile-particle", "");

        SpriteDisplay display;
        display.image = image;

        ItemInfo *itemInfo = new ItemInfo;
        itemInfo->setId(id);
        itemInfo->setName(name.empty() ? _("unnamed") : name);
        itemInfo->setDescription(description);
        itemInfo->setType(itemTypeFromString(typeStr));
        itemInfo->setView(view);
        itemInfo->setWeight(weight);
        itemInfo->setAttackAction(attackAction);
        itemInfo->setAttackRange(attackRange);
        itemInfo->setMissileParticle(missileParticle);

        std::string effect;
        for (int i = 0; i < int(sizeof(fields) / sizeof(fields[0])); ++i)
        {
            int value = XML::getProperty(node, fields[i][0], 0);
            if (!value) continue;
            if (!effect.empty()) effect += " / ";
            effect += strprintf(gettext(fields[i][1]), value);
        }
        for (std::list<Stat>::iterator it = extraStats.begin();
                it != extraStats.end(); it++)
        {
            int value = XML::getProperty(node, it->tag.c_str(), 0);
            if (!value) continue;
            if (!effect.empty()) effect += " / ";
            effect += strprintf(it->format.c_str(), value);
        }
        std::string temp = XML::getProperty(node, "effect", "");
        if (!effect.empty() && !temp.empty())
            effect += " / ";
        effect += temp;
        itemInfo->setEffect(effect);

        for_each_xml_child_node(itemChild, node)
        {
            if (xmlStrEqual(itemChild->name, BAD_CAST "sprite"))
            {
                std::string attackParticle = XML::getProperty(
                    itemChild, "particle-effect", "");
                itemInfo->setParticleEffect(attackParticle);

                loadSpriteRef(itemInfo, itemChild);
            }
            else if (xmlStrEqual(itemChild->name, BAD_CAST "sound"))
            {
                loadSoundRef(itemInfo, itemChild);
            }
            else if (xmlStrEqual(itemChild->name, BAD_CAST "floor"))
            {
                loadFloorSprite(&display, itemChild);
            }
        }

        itemInfo->setDisplay(display);

        mItemInfos[id] = itemInfo;
        if (!name.empty())
        {
            std::string temp = normalized(name);

            NamedItemInfos::const_iterator itr = mNamedItemInfos.find(temp);
            if (itr == mNamedItemInfos.end())
            {
                mNamedItemInfos[temp] = itemInfo;
            }
            else
            {
                logger->log("ItemDB: Duplicate name of item found item %d", id);
            }
        }

        if (!attackAction.empty())
            if (attackRange == 0)
                logger->log("ItemDB: Missing attack range from weapon %i!", id);

#define CHECK_PARAM(param, error_value) \
        if (param == error_value) \
            logger->log("ItemDB: Missing " #param " attribute for item %i!",id)

        if (id >= 0)
        {
            CHECK_PARAM(name, "");
            CHECK_PARAM(description, "");
            CHECK_PARAM(image, "");
        }
        // CHECK_PARAM(effect, "");
        // CHECK_PARAM(type, 0);
        // CHECK_PARAM(weight, 0);
        // CHECK_PARAM(slot, 0);

#undef CHECK_PARAM
    }

    mLoaded = true;
}
开发者ID:Ablu,项目名称:invertika,代码行数:101,代码来源:itemdb.cpp


示例20: I2C_MonitorGetDatabuffer

/*********************************************************************//**
 * @brief		Get data from I2C data buffer in monitor mode.
 * @param[in]	I2Cx	I2C peripheral selected, should be
 *    			- LPC_I2C0
 * 				- LPC_I2C1
 * 				- LPC_I2C2
 * @return		None
 * Note:	In monitor mode, the I2C module may lose the ability to stretch
 * the clock (stall the bus) if the ENA_SCL bit is not set. This means that
 * the processor will have a limited amount of time to read the contents of
 * the data received on the bus. If the processor reads the I2DAT shift
 * register, as it ordinarily would, it could have only one bit-time to
 * respond to the interrupt before the received data is overwritten by
 * new data.
 **********************************************************************/
uint8_t I2C_MonitorGetDatabuffer(LPC_I2C_TypeDef *I2Cx)
{
	CHECK_PARAM(PARAM_I2Cx(I2Cx));
	return ((uint8_t)(I2Cx->I2DATA_BUFFER));
}
开发者ID:Martin-P,项目名称:lpc1768-control-bluetooth-dongle,代码行数:20,代码来源:lpc17xx_i2c.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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