本文整理汇总了C++中CHECK_PARAM函数的典型用法代码示例。如果您正苦于以下问题:C++ CHECK_PARAM函数的具体用法?C++ CHECK_PARAM怎么用?C++ CHECK_PARAM使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CHECK_PARAM函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
}
}
示例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;
}
示例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;
}
}
示例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;
}
示例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);
}
示例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;
}
示例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);
}
}
示例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);
}
}
示例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);
}
示例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;
}
示例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);
}
示例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));
}
示例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);
}
示例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;
}
示例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;
}