当前位置: 首页>>代码示例>>C++>>正文


C++ GPIO_ClearValue函数代码示例

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


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

示例1: LED_Init

void LED_Init (void)
{
	PINSEL_CFG_Type PinCfg;

	uint8_t temp;

	PinCfg.Funcnum = 0;
	PinCfg.OpenDrain = 0;
	PinCfg.Pinmode = 0;
	PinCfg.Portnum = 2;
	for (temp = 2; temp <= 6; temp++){
		PinCfg.Pinnum = temp;
		PINSEL_ConfigPin(&PinCfg);
	}

	PinCfg.Funcnum = 0;
	PinCfg.OpenDrain = 0;
	PinCfg.Pinmode = 0;
	PinCfg.Portnum = 1;
	PinCfg.Pinnum = 28;
	PINSEL_ConfigPin(&PinCfg);
	PinCfg.Pinnum = 29;
	PINSEL_ConfigPin(&PinCfg);
	PinCfg.Pinnum = 31;
	PINSEL_ConfigPin(&PinCfg);

	// Set direction to output
	GPIO_SetDir(2, LED2_MASK, 1);
	GPIO_SetDir(1, LED1_MASK, 1);

	/* Turn off all LEDs */
	GPIO_ClearValue(2, LED2_MASK);
	GPIO_ClearValue(1, LED1_MASK);
}
开发者ID:Frehner1,项目名称:CMSIS_LPC17xx,代码行数:34,代码来源:main.c

示例2: CS_Force1

/*********************************************************************//**
 * @brief 		Drive CS output pin to low/high level to select slave device
 * 				via /CS pin state
 * @param[in]	state State of CS output pin that will be driven:
 * 				- 0: Drive CS pin to low level
 * 				- 1: Drive CS pin to high level
 * @return		None
 ***********************************************************************/
void CS_Force1 (LPC_SSP_TypeDef *SSPx, FunctionalState state)
{
	if (SSPx == LPC_SSP0)
	{
		if (state)
		{
			GPIO_SetValue(0, _BIT(16));
		}
		else
		{
			GPIO_ClearValue(0, _BIT(16));
		}
	}
	else if (SSPx == LPC_SSP1)
	{
		if (state)
		{
			GPIO_SetValue(0, _BIT(6));
		}
		else
		{
			GPIO_ClearValue(0, _BIT(6));
		}
	}
}
开发者ID:bhavindarji,项目名称:LPC17xx-Drivers,代码行数:33,代码来源:lpc17xx_ssp.c

示例3: TIMER0_IRQHandler

/*********************************************************************//**
 * @brief		Timer 0 interrupt handler. This sub-routine will set/clear
 * 				two Phase A-B output pin to their phase state
 * @param[in]	None
 * @return 		None
 **********************************************************************/
void TIMER0_IRQHandler(void)
{
	if (TIM_GetIntStatus(LPC_TIM0,TIM_MR0_INT)) {

		// Set/Clear phase A/B pin corresponding to their state
		switch (PhaseCnt) {
		case 0:
			GPIO_SetValue(0,PHASE_A_PIN);
			GPIO_ClearValue(0,PHASE_B_PIN);
			break;
		case 1:
			GPIO_SetValue(0, PHASE_A_PIN | PHASE_B_PIN);
			break;
		case 2:
			GPIO_SetValue(0, PHASE_B_PIN);
			GPIO_ClearValue(0, PHASE_A_PIN);
			break;
		case 3:
			GPIO_ClearValue(0, PHASE_A_PIN | PHASE_B_PIN);
			break;

		default:
			break;
		}

		// update PhaseCnt
		PhaseCnt = (PhaseCnt + 1) & 0x03;

		// Clear Timer 0 match interrupt pending
		TIM_ClearIntPending(LPC_TIM0,TIM_MR0_INT);
	}
}
开发者ID:readermank,项目名称:kico_si5,代码行数:38,代码来源:qei_test_velo.c

示例4: GSM_Switch

void GSM_Switch(FunctionalState newState)
{

	if(GSM_GetStatus() == newState)
	{
		return;
	}
	else if(newState == ENABLE)
	{
		GPIO_SetValue(GPIO2, (0x01<<gsmPwrPin));
		while(!GSM_GetStatus());
		GPIO_ClearValue(GPIO2, (0x01<<gsmPwrPin));
		delay_ms(2000);
	}
	else if (newState == DISABLE)
	{
		while(GSM_GetStatus())
		{
			GPIO_SetValue(GPIO2, (0x01<<gsmPwrPin));
			delay_ms(800);
			GPIO_ClearValue(GPIO2, (0x01<<gsmPwrPin));
			delay_ms(10000);

		}

	}
}
开发者ID:qermit,项目名称:aprs-firmware,代码行数:27,代码来源:gsmModule.c

示例5: main

//====================================================================================
void main()
{
	volatile uint32_t i;
	uint32_t timer_mark;
	//while(1);
	
	SystemInit();
	CGU_Init();

	scu_pinmux(0xE ,7 , MD_PDN, FUNC4); 	// P8.1 : USB0_IND1 LED

	GPIO_SetDir(LED1_PORT,(1<<LED1_BIT), 1);

	GPIO_ClearValue(LED1_PORT,(1<<LED1_BIT));

	// M3Frequency is automatically set when SetClock(BASE_M3_CLK... was called.
	SysTick_Config(CGU_GetPCLKFrequency(CGU_PERIPHERAL_M4CORE)/1000);  				// Generate interrupt @ 1000 Hz
	
	/*for(;;)
	{
		GPIO_ClearValue(LED1_PORT,(1<<LED1_BIT));
		for(i = 0; i < 200000; i++);
		GPIO_SetValue(LED1_PORT,(1<<LED1_BIT));
		for(i = 0; i < 200000; i++);
	}

	while (1)
	{                           					// Loop forever
		timer_mark = msTicks;					// Take timer snapshot 
		while(msTicks < (timer_mark + 100));	// Wait until 100ms has passed
		GPIO_ClearValue(LED1_PORT,(1<<LED1_BIT));				// Turn the LED off
	
		timer_mark = msTicks;					// Take timer snapshot 
		while(msTicks < (timer_mark + 100));	// Wait until 100ms has passed
		GPIO_SetValue(LED1_PORT,(1<<LED1_BIT));				// Turn the LED on
	}*/

	
	
	// Init on-board LED as output
	//GPIO1->FIODIR |= 1 << 18;
	
	// Init SysTick
	//SysTick_Config(SystemFrequency / 1000);		// Generate interrupt every 1 ms
	
	while (1)
	{                           					// Loop forever
		msec = 100;
		while(msec);
		GPIO_ClearValue(LED1_PORT,(1<<LED1_BIT));
		msec = 100;
		while(msec);
		GPIO_SetValue(LED1_PORT,(1<<LED1_BIT));

	}
}
开发者ID:BlackRamElectronics,项目名称:LPC4357-Blinky,代码行数:57,代码来源:LPC4357-Blinky.c

示例6: LEDs_SetAllLEDs

void LEDs_SetAllLEDs(uint32_t LEDMask)
{
	if(LEDMask&LEDS_LED1)
		GPIO_ClearValue(LED1_GPIO_PORT_NUM,(1<<LED1_GPIO_BIT_NUM));
	else
		GPIO_SetValue(LED1_GPIO_PORT_NUM,(1<<LED1_GPIO_BIT_NUM));
	if(LEDMask&LEDS_LED2)
		GPIO_ClearValue(LED2_GPIO_PORT_NUM,(1<<LED2_GPIO_BIT_NUM));
	else
		GPIO_SetValue(LED2_GPIO_PORT_NUM,(1<<LED2_GPIO_BIT_NUM));
}
开发者ID:magoroku15,项目名称:nxpUSBlib,代码行数:11,代码来源:bsp_NGX.c

示例7: vtInitLED

void vtInitLED()
{
    /* LEDs on ports 1 and 2 to output (1). */
    // Note that all LED access is through the proper LPC library calls
    GPIO_SetDir(1,partstFIO1_BITS,1);
    GPIO_SetDir(2,partstFIO2_BITS,1);

    /* Start will all LEDs off. */
    GPIO_ClearValue(1,partstFIO1_BITS);
    GPIO_ClearValue(2,partstFIO2_BITS);

}
开发者ID:ECEEmbedded,项目名称:ARMCode_vIntegration,代码行数:12,代码来源:vtUtilities.c

示例8: LED_Init

/*********************************************************************//**
 * @brief		Initialize LED
 * @param[in]	None
 * @return 		None
 **********************************************************************/
void LED_Init(void)
{
	//setting two LEDs as output and turn off all
	GPIO_SetDir(PRIVILEGE_LEDPORT,(1<<PRIVILEGE_LED),1);
	GPIO_SetDir(UNPRIVILEGE_LEDPORT,(1<<UNPRIVILEGE_LED),1);
#ifdef MCB_LPC_1768
	GPIO_ClearValue(1,(1<<PRIVILEGE_LED)|(1<<UNPRIVILEGE_LED));
	GPIO_ClearValue(2,(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6));
#elif defined(IAR_LPC_1768)
	GPIO_SetValue(PRIVILEGE_LEDPORT,(1<<PRIVILEGE_LED));
	GPIO_SetValue(UNPRIVILEGE_LEDPORT,(1<<UNPRIVILEGE_LED));
#endif
}
开发者ID:m3y54m,项目名称:32bitmicro,代码行数:18,代码来源:privilege.c

示例9: jtag_init

void jtag_init(void)
{
    uint32_t i=0;

    PinCfg.Funcnum      = 0;    // GPIO
    PinCfg.OpenDrain    = 0;
    PinCfg.Pinmode      = 0;

    puts("");
    printf("Init JTAG port pins: TDO, ");

    PinCfg.Portnum      = JTAG_TDOPORT;
    PinCfg.Pinnum       = JTAG_TDOPIN;
    PINSEL_ConfigPin(&PinCfg);

    printf("TDI, ");
    PinCfg.Portnum      = JTAG_TDIPORT;
    PinCfg.Pinnum       = JTAG_TDIPIN;
    PINSEL_ConfigPin(&PinCfg);

    printf("TMS, ");
    PinCfg.Portnum      = JTAG_TMSPORT;
    PinCfg.Pinnum       = JTAG_TMSPIN;
    PINSEL_ConfigPin(&PinCfg);

    printf("TRST, ");
    PinCfg.Portnum      = JTAG_TRSTPORT;
    PinCfg.Pinnum       = JTAG_TRSTPIN;
    PINSEL_ConfigPin(&PinCfg);

    printf("TCK - done\n");
    PinCfg.Portnum      = JTAG_TCKPORT;
    PinCfg.Pinnum       = JTAG_TCKPIN;
    PINSEL_ConfigPin(&PinCfg);

    GPIO_SetDir(JTAG_TDIPORT, JTAG_TDI, 1);
    GPIO_SetDir(JTAG_TDOPORT, JTAG_TDO, 0);
    GPIO_SetDir(JTAG_TMSPORT, JTAG_TMS, 1);
    GPIO_SetDir(JTAG_TCKPORT, JTAG_TCK, 1);
    GPIO_SetDir(JTAG_TRSTPORT, JTAG_TRST, 1);

    GPIO_ClearValue(JTAG_TDIPORT, JTAG_TDI);

    GPIO_ClearValue(JTAG_TMSPORT, JTAG_TMS);
    GPIO_ClearValue(JTAG_TCKPORT, JTAG_TCK);

    GPIO_ClearValue(JTAG_TRSTPORT, JTAG_TRST);
    GPIO_SetValue(  JTAG_TRSTPORT, JTAG_TRST);

    return;
}
开发者ID:notandy,项目名称:ddk-arm,代码行数:51,代码来源:jtag_1149.c

示例10: main

int main() {
	//Initialize system and clocks
	SystemInit();
	SystemCoreClockUpdate();

	//Turn on peripheral clocks for GPIO and I2S
	CLKPWR_ConfigPPWR(CLKPWR_PCONP_PCGPIO, ENABLE);
	CLKPWR_ConfigPPWR(CLKPWR_PCONP_PCI2S, ENABLE);

	//Set direction for LED pin
	GPIO_SetDir(0, (1 << 22), 1);
	//Set direction for ADC control pins
	GPIO_SetDir(1, (1 << 18) | (1 << 21), 1);

	//Initialize buffer pointers to default value
	processActive = buffer3;
	rxActive = buffer1;
	txActive = buffer2;

	//Init the I2S hardware
	initTX(44100, (uint32_t) txActive, (uint32_t) rxActive);

	//Set and Clear control pins for ADC
	GPIO_SetValue(1, (1 << 18));
	GPIO_ClearValue(1, (1 << 21));

	//infinite loop
	while (1) {
		//If the interrupt has set the flag
		if (needsProcessing) {
			//Turn led on to indicate CPU usage
			GPIO_SetValue(0, (1 << 22));

			//Run filter on current buffers
			firFixed(processActive, TRANSFER_SIZE);

			//Rotate buffers
			uint32_t *tmp = processActive;
			processActive = rxActive;
			rxActive = txActive;
			txActive = tmp;

			//Clear flag
			needsProcessing = 0;

			//Turn led off, if the processing takes longer the LED becomes brighter
			GPIO_ClearValue(0, (1 << 22));
		}
	}
}
开发者ID:Tomwi,项目名称:CortexFilter,代码行数:50,代码来源:main.c

示例11: vtLEDOff

void vtLEDOff(uint8_t mask)
{
    if (mask & 0x80) {
        // LED P1.28
        GPIO_ClearValue(1,0x10000000);
    }
    if (mask & 0x40) {
        // LED P1.29
        GPIO_ClearValue(1,0x20000000);
    }
    if (mask & 0x20) {
        // LED P1.31
        GPIO_ClearValue(1,0x80000000);
    }
    if (mask & 0x10) {
        // LED P2.2
        GPIO_ClearValue(2,0x00000004);
    }
    if (mask & 0x08) {
        // LED P2.3
        GPIO_ClearValue(2,0x00000008);
    }
    if (mask & 0x04) {
        // LED P2.4
        GPIO_ClearValue(2,0x00000010);
    }
    if (mask & 0x02) {
        // LED P2.5
        GPIO_ClearValue(2,0x00000020);
    }
    if (mask & 0x01) {
        // LED P2.6
        GPIO_ClearValue(2,0x00000040);
    }
}
开发者ID:ECEEmbedded,项目名称:ARMCode_vIntegration,代码行数:35,代码来源:vtUtilities.c

示例12: main

int main(void)
{
    SystemInit();
    CGU_Init();


    // Configure GPIO pins connected to LEDs as outputs
    scu_pinmux(D3_SCU_PORT, D3_SCU_PIN, MD_BUK, FUNC4);
    GPIO_SetDir(D3_GPIO_PORT, D3_GPIO_MASK, 1);
    scu_pinmux(D4_SCU_PORT, D4_SCU_PIN, MD_BUK, FUNC4);
    GPIO_SetDir(D4_GPIO_PORT, D4_GPIO_MASK, 1);
    scu_pinmux(D5_SCU_PORT, D5_SCU_PIN, MD_BUK, FUNC4);
    GPIO_SetDir(D5_GPIO_PORT, D5_GPIO_MASK, 1);
    scu_pinmux(D6_SCU_PORT, D6_SCU_PIN, MD_BUK, FUNC4);
    GPIO_SetDir(D6_GPIO_PORT, D6_GPIO_MASK, 1);

    // Configure GPIO pins connected to push buttons as inputs
    scu_pinmux(S1_SCU_PORT, S1_SCU_PIN, MD_BUK | MD_EZI, FUNC4);
    GPIO_SetDir(S1_GPIO_PORT, S1_GPIO_MASK, 0);
    scu_pinmux(S2_SCU_PORT, S2_SCU_PIN, MD_BUK | MD_EZI, FUNC4);
    GPIO_SetDir(S2_GPIO_PORT, S2_GPIO_MASK, 0);
    scu_pinmux(S3_SCU_PORT, S3_SCU_PIN, MD_BUK | MD_EZI, FUNC4);
    GPIO_SetDir(S3_GPIO_PORT, S3_GPIO_MASK, 0);
    scu_pinmux(S4_SCU_PORT, S4_SCU_PIN, MD_BUK | MD_EZI, FUNC4);
    GPIO_SetDir(S4_GPIO_PORT, S4_GPIO_MASK, 0);

    while(1)
    {
        if (GPIO_ReadValue(S1_GPIO_PORT) & S1_GPIO_MASK)
            GPIO_ClearValue(D3_GPIO_PORT, D3_GPIO_MASK);
        else
            GPIO_SetValue(D3_GPIO_PORT, D3_GPIO_MASK);

        if (GPIO_ReadValue(S2_GPIO_PORT) & S2_GPIO_MASK)
            GPIO_ClearValue(D4_GPIO_PORT, D4_GPIO_MASK);
        else
            GPIO_SetValue(D4_GPIO_PORT, D4_GPIO_MASK);

        if (GPIO_ReadValue(S3_GPIO_PORT) & S3_GPIO_MASK)
            GPIO_ClearValue(D5_GPIO_PORT, D5_GPIO_MASK);
        else
            GPIO_SetValue(D5_GPIO_PORT, D5_GPIO_MASK);

        if (GPIO_ReadValue(S4_GPIO_PORT) & S4_GPIO_MASK)
            GPIO_ClearValue(D6_GPIO_PORT, D6_GPIO_MASK);
        else
            GPIO_SetValue(D6_GPIO_PORT, D6_GPIO_MASK);
    }
}
开发者ID:Andriiy,项目名称:Circuit-Boards,代码行数:49,代码来源:main.c

示例13: LCD_RST

void LCD_RST(int enable)
{
    if (enable)
        GPIO_SetValue(LCD_RESET_PORT, (1 << LCD_RESET_PIN));
    else
        GPIO_ClearValue(LCD_RESET_PORT, (1 << LCD_RESET_PIN));
}
开发者ID:vpcola,项目名称:LPC1769_NYP,代码行数:7,代码来源:LCD.c

示例14: main_task

/*
 *  メインタスク
 */
void main_task(intptr_t exinf)
{

	syslog(LOG_NOTICE, "Sample program starts (exinf = %d).", (int_t) exinf);

		/* GPIO0のLED制御ピンを出力にする */
	GPIO_SetDir(
			0,			// GPIOポート番号
			LEDMASK,	// 操作するビットマスク
			1			// 設定する値
			);

	while(1)
	{
			/* 500m秒待つ */
		SVC_PERROR(tslp_tsk(500));
			/* LED制御ピンをLにする */
		GPIO_ClearValue(
				0,			// GPIOポート番号
				LEDMASK	// 操作するビットマスク
				);
			/* 500m秒待つ */
		SVC_PERROR(tslp_tsk(500));
			/* LED制御ピンをHにする */
		GPIO_SetValue(
				0,			// GPIOポート番号
				LEDMASK	// 操作するビットマスク
				);
	}


	syslog(LOG_NOTICE, "Sample program ends.");
	SVC_PERROR(ext_ker());
	assert(0);
}
开发者ID:readermank,项目名称:kico_si5,代码行数:38,代码来源:blink_cmsis.c

示例15: LCD_DC

void LCD_DC(int enable)
{
    if (enable)
        GPIO_SetValue(LCD_DC_PORT, (1 << LCD_DC_PIN));
    else
        GPIO_ClearValue(LCD_DC_PORT, (1 << LCD_DC_PIN));
}
开发者ID:vpcola,项目名称:LPC1769_NYP,代码行数:7,代码来源:LCD.c


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