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


C++ GPIO_OUTPUT_SET函数代码示例

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


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

示例1: board_init

/*
 * Miscelaneous platform dependent initialisations
 */
int board_init(void)
{
	/* arch number of PDNB3 */
	gd->bd->bi_arch_number = MACH_TYPE_PDNB3;

	/* adress of boot parameters */
	gd->bd->bi_boot_params = 0x00000100;

	GPIO_OUTPUT_SET(CONFIG_SYS_GPIO_FPGA_RESET);
	GPIO_OUTPUT_ENABLE(CONFIG_SYS_GPIO_FPGA_RESET);

	GPIO_OUTPUT_SET(CONFIG_SYS_GPIO_SYS_RUNNING);
	GPIO_OUTPUT_ENABLE(CONFIG_SYS_GPIO_SYS_RUNNING);

	/*
	 * Setup GPIO's for FPGA programming
	 */
	GPIO_OUTPUT_CLEAR(CONFIG_SYS_GPIO_PRG);
	GPIO_OUTPUT_CLEAR(CONFIG_SYS_GPIO_CLK);
	GPIO_OUTPUT_CLEAR(CONFIG_SYS_GPIO_DATA);
	GPIO_OUTPUT_ENABLE(CONFIG_SYS_GPIO_PRG);
	GPIO_OUTPUT_ENABLE(CONFIG_SYS_GPIO_CLK);
	GPIO_OUTPUT_ENABLE(CONFIG_SYS_GPIO_DATA);
	GPIO_OUTPUT_DISABLE(CONFIG_SYS_GPIO_INIT);
	GPIO_OUTPUT_DISABLE(CONFIG_SYS_GPIO_DONE);

	/*
	 * Setup GPIO's for interrupts
	 */
	GPIO_OUTPUT_DISABLE(CONFIG_SYS_GPIO_PCI_INTA);
	GPIO_INT_ACT_LOW_SET(CONFIG_SYS_GPIO_PCI_INTA);
	GPIO_OUTPUT_DISABLE(CONFIG_SYS_GPIO_PCI_INTB);
	GPIO_INT_ACT_LOW_SET(CONFIG_SYS_GPIO_PCI_INTB);
	GPIO_OUTPUT_DISABLE(CONFIG_SYS_GPIO_RESTORE_INT);
	GPIO_INT_ACT_LOW_SET(CONFIG_SYS_GPIO_RESTORE_INT);
	GPIO_OUTPUT_DISABLE(CONFIG_SYS_GPIO_RESTART_INT);
	GPIO_INT_ACT_LOW_SET(CONFIG_SYS_GPIO_RESTART_INT);

	/*
	 * Setup GPIO's for 33MHz clock output
	 */
	*IXP425_GPIO_GPCLKR = 0x01FF0000;
	GPIO_OUTPUT_ENABLE(CONFIG_SYS_GPIO_CLK_33M);

	/*
	 * Setup other chip select's
	 */
	*IXP425_EXP_CS1 = CONFIG_SYS_EXP_CS1;

	return 0;
}
开发者ID:Aorjoa,项目名称:bootloader,代码行数:54,代码来源:pdnb3.c

示例2: gpio_rutine

void gpio_rutine(void){
	static int i = 0;
	if (short_press_flag) {
		if (i++ == 0) {
			GPIO_OUTPUT_SET(PWBTN_PIN, 1);
		} else if (i > PWBTN_SHORT_PRESS_TICKS) {
			GPIO_OUTPUT_SET(PWBTN_PIN, 0);
			short_press_flag = 0;
			i = 0;
		}
	} else if (long_press_flag) {
		if (i++ == 0) {
			GPIO_OUTPUT_SET(PWBTN_PIN, 1);
		} else if (i > PWBTN_LONG_PRESS_TICKS) {
			GPIO_OUTPUT_SET(PWBTN_PIN, 0);
			long_press_flag = 0;
			i = 0;
		}
	} else if (hardrest_press_flag) {
		if (i++ == 0) {
			GPIO_OUTPUT_SET(PWBTN_PIN, 1);
		} else if (i == PWBTN_LONG_PRESS_TICKS) {
			GPIO_OUTPUT_SET(PWBTN_PIN, 0);
		} else if(i == PWBTN_LONG_PRESS_TICKS + PWBTN_HARDRESET_PAUSE_TICKS){
			GPIO_OUTPUT_SET(PWBTN_PIN, 1);
		} else if(i > PWBTN_LONG_PRESS_TICKS + PWBTN_HARDRESET_PAUSE_TICKS + PWBTN_SHORT_PRESS_TICKS){
			GPIO_OUTPUT_SET(PWBTN_PIN, 0);
			hardrest_press_flag = 0;
			i = 0;
		}
	}
}
开发者ID:LordGenry,项目名称:esp-serial-terminal,代码行数:32,代码来源:user_main.c

示例3: blink

void blink(void)
{
	static bool state = false; // Used to toggle LED state
	if(state == true)
		{
		GPIO_OUTPUT_SET(LED_PIN, 1); // Turn LED on
		state = false;
		}
	else
		{
		GPIO_OUTPUT_SET(LED_PIN, 0); // Turn LED off
		state = true;
		}
}
开发者ID:markbeee,项目名称:ESP32_Examples,代码行数:14,代码来源:user_main.c

示例4: blink

/////////////////////////////////////////////////////////////
// blink() - Changes the state of the LED each time called //
/////////////////////////////////////////////////////////////
void blink(void)
{
    static bool flag = false;
    if (flag)
    {
        GPIO_OUTPUT_SET(LED_PIN, 1);
        flag = false;
    }
    else
    {
        GPIO_OUTPUT_SET(LED_PIN, 0);
        flag = true;
    }
}
开发者ID:sparkfun,项目名称:ESP32_Miscellany,代码行数:17,代码来源:user_main.c

示例5: valveDriverInit

/**
 * called first at OS init
 */
void ICACHE_FLASH_ATTR valveDriverInit()
{
  // configure GPIO outputs
  PIN_FUNC_SELECT(GENERATOR_GPIO_MUX,   GENERATOR_GPIO_FUNC);
  PIN_FUNC_SELECT(OPEN_VALVE_GPIO_MUX,  OPEN_VALVE_GPIO_FUNC);
  PIN_FUNC_SELECT(CLOSE_VALVE_GPIO_MUX, CLOSE_VALVE_GPIO_FUNC);
  PIN_FUNC_SELECT(CAPACITOR_GPIO_MUX,   CAPACITOR_GPIO_FUNC);

  // configure passive output state
  GPIO_OUTPUT_SET(GENERATOR_GPIO, 0);
  GPIO_DIS_OUTPUT(OPEN_VALVE_GPIO);
  GPIO_OUTPUT_SET(CLOSE_VALVE_GPIO, 0);
  GPIO_DIS_OUTPUT(CAPACITOR_GPIO);
}
开发者ID:jnsbyr,项目名称:esp8266-gardena1251,代码行数:17,代码来源:valve.c

示例6: lpd6803_init

void ICACHE_FLASH_ATTR lpd6803_init() {
	gpio_init();
	//Set GPIO2 to output mode for CLCK
	PIN_FUNC_SELECT(PERIPHS_IO_MUX_GPIO2_U, FUNC_GPIO2);
	GPIO_OUTPUT_SET(2, 0);

	//Set GPIO0 to output mode for DATA
	PIN_FUNC_SELECT(PERIPHS_IO_MUX_GPIO0_U, FUNC_GPIO0);
	GPIO_OUTPUT_SET(0, 0);

	uint16_t i;
	for (i = 0; i < numLEDs; i++) {
		lpd6803_setPixelColor(i, 0, 0, 0);
	}
}
开发者ID:StephanHaag,项目名称:esp8266-devkit,代码行数:15,代码来源:lpd6803.c

示例7: mqttDataCb

// same as callback function in Arduino
void ICACHE_FLASH_ATTR mqttDataCb(uint32_t *args, const char* topic, uint32_t topic_len, const char *data, uint32_t data_len)
{
	char topicBuf[64], dataBuf[64];
	MQTT_Client* client = (MQTT_Client*)args;

	os_memcpy(topicBuf, topic, topic_len);
	topicBuf[topic_len] = 0;

	os_memcpy(dataBuf, data, data_len);
	dataBuf[data_len] = 0;

	// HERE STARTS THE BASIC LOGIC BY KONSTANTIN
// GPIO2 handling here
/*	if (strcmp(topicBuf,PIN_GPIO2_TOPIC)==0) {
		if (strcmp(dataBuf,"OFF")==0) {
		GPIO_OUTPUT_SET(PIN_GPIO2, 0);
		INFO("GPIO2 set to OFF\r\n");
		MQTT_Publish(&mqttClient,PIN_GPIO2_TOPIC_CB,"OFF",3,0,0);
		currGPIO2State=0;
	} else if (strcmp(dataBuf,"ON")==0) {
		GPIO_OUTPUT_SET(PIN_GPIO2, 1);
		INFO("GPIO2 set to ON\r\n");
		MQTT_Publish(&mqttClient,PIN_GPIO2_TOPIC_CB,"ON",2,0,0);
		currGPIO2State=1;
		}
	}  /*  */
// GPIO4 handling here
	if (strcmp(topicBuf,PIN_GPIO4_TOPIC)==0) {
		if (strcmp(dataBuf,"OFF")==0) {
		GPIO_OUTPUT_SET(PIN_GPIO4, 0);
		INFO("GPIO4 set to OFF\r\n");
		MQTT_Publish(&mqttClient,PIN_GPIO4_TOPIC_CB,"OFF",3,0,0);
		currGPIO4State=0;
	} else if (strcmp(dataBuf,"ON")==0) {
		GPIO_OUTPUT_SET(PIN_GPIO4, 1);
		INFO("GPIO4 set to ON\r\n");
		MQTT_Publish(&mqttClient,PIN_GPIO4_TOPIC_CB,"ON",2,0,0);
		currGPIO4State=1;
		}
	}


	// HERE ENDS THE BASIC LOGIC BY KONSTANTIN
//	INFO("GPIO2 State: %d",GPIO_INPUT_GET(PIN_GPIO));
	INFO("MQTT topic: %s, data: %s \r\n", topicBuf, dataBuf);
//	os_free(topicBuf);
//	os_free(dataBuf);
}
开发者ID:theater,项目名称:ESP8266,代码行数:49,代码来源:user_main.c

示例8: alarm_timer_cb

static void ICACHE_FLASH_ATTR
alarm_timer_cb(void* arg)
{
	if(alarm_counter)
	{
		PRINTF("alarm time, state:%u, alarm_counter:%u\n", alarm_state, alarm_counter);

		GPIO_OUTPUT_SET(ALARM_GPIO_ID, alarm_state);
		if(alarm_state)
		{
			alarm_state = 0;
		}
		else
		{
			alarm_state = 1;
		}
		alarm_counter++;
	}

	if(alarm_counter >= COUNTER_TO_CLEAR_ALARM)
	{
		PRINTF("alarm time end\n");
		alarm_counter = 0;
		alarm_state = 0;
		os_timer_disarm(&alarm_timer);
	}
}
开发者ID:daiyinger,项目名称:vibrate-alarm-demo,代码行数:27,代码来源:tisan_vibrate.c

示例9: jshPinSetValue

/**
 * Set the value of the corresponding pin.
 */
void jshPinSetValue(Pin pin, //!< The pin to have its value changed.
		bool value           //!< The new value of the pin.
	) {
  // Debug
  // os_printf("> ESP8266: jshPinSetValue %d, %d\n", pin, value);
	GPIO_OUTPUT_SET(pin, value);
}
开发者ID:impressiver,项目名称:Espruino,代码行数:10,代码来源:jshardware.c

示例10: init_relay

void init_relay()
{
	// make sure GPIOs enabled to GPIO function not alternate function

	PIN_FUNC_SELECT(PERIPHS_IO_MUX_GPIO2_U, FUNC_GPIO2);
	PIN_FUNC_SELECT(PERIPHS_IO_MUX_GPIO4_U, FUNC_GPIO4);
	PIN_FUNC_SELECT(PERIPHS_IO_MUX_GPIO5_U, FUNC_GPIO5);

	GPIO_OUTPUT_SET(SDATA, 0);
	GPIO_OUTPUT_SET(SCLK, 0);
	GPIO_OUTPUT_SET(SLAT, 0);

	relay_data = 0;
	send_relay();

}
开发者ID:n0bel,项目名称:ESPrinkler,代码行数:16,代码来源:user_main.c

示例11: user_esp_platform_check_ip

/******************************************************************************
 * FunctionName : user_esp_platform_check_ip
 * Description  : check whether get ip addr or not
 * Parameters   : none
 * Returns      : none
*******************************************************************************/
void ICACHE_FLASH_ATTR
user_esp_platform_check_ip(void)
{
    struct ip_info ipconfig;

   //disarm timer first
    os_timer_disarm(&test_timer);

   //get ip info of ESP8266 station
    wifi_get_ip_info(STATION_IF, &ipconfig);

    if (wifi_station_get_connect_status() == STATION_GOT_IP && ipconfig.ip.addr != 0) {

      printf("got ip !!! \r\n");
      user_tcpserver_init(SERVER_LOCAL_PORT);
      GPIO_OUTPUT_SET(LED_GPIO, 1);
      

    } else {
       
        if ((wifi_station_get_connect_status() == STATION_WRONG_PASSWORD ||
                wifi_station_get_connect_status() == STATION_NO_AP_FOUND ||
                wifi_station_get_connect_status() == STATION_CONNECT_FAIL)) {
               
         printf("connect fail !!! \r\n");
         
        } else {
       
           //re-arm timer to check ip
            os_timer_setfn(&test_timer, (os_timer_func_t *)user_esp_platform_check_ip, NULL);
            os_timer_arm(&test_timer, 100, 0);
        }
    }
}
开发者ID:Andrew-Collins,项目名称:esp8266-sdk,代码行数:40,代码来源:user_main.c

示例12: cb_gpio_set_gpio2

int8_t ICACHE_FLASH_ATTR cb_gpio_set_gpio2(uint8_t IsFirstCall, char* OutputData, uint16_t MaxBytes, uint16_t* RetBytes, uint8_t* RetDone){
/* TAG CALLBACK FUNCTION for [[GPIO_SET_GPIO2]]
 * --------------------------------------------
 * ! See whttpd_pp_item_struct structure definition to know what is passed to / what is expected from tag callback function.
 * ! This function could be called multiple times for one tag, if we signal by RetDone that we didn't end yet (probably because MaxBytes was less that what we needed).
 */
	//allocate memory for OutString (local)
	char* OutString = malloc(5); //!make sure that all your error code strings will fit
	if(OutString==NULL){
		*RetBytes = 0;
		*RetDone = 1;
		return -1;
	}
	if(IsFirstCall) cb_gsg2_CopiedBytes = 0;
	//
	//>> ---- generate whole OutString (enter your code here)
	char* Ptr;
	uint16_t Len;
	if((IsFirstCall)&&(whttpd_preproc_get_req_param_value_ptr("gpio2=", &Ptr, &Len))){ //parameter found in parameters passed in Request-URI
		cb_gsg2_State = (Ptr[0]!='0');
		PIN_FUNC_SELECT(PERIPHS_IO_MUX_GPIO2_U, FUNC_GPIO2);
		GPIO_OUTPUT_SET(2, cb_gsg2_State);
	}
	sprintf(OutString, "%d", cb_gsg2_State);
	//<< ----
	//
	whttpd_preproc_manage_cb_output(OutputData, OutString, &cb_gsg2_CopiedBytes, MaxBytes, RetBytes, RetDone); //output into OutputData (if MaxBytes is less than size of our data, manage subsequent chunked output throughout more calls of this tag callback function using global variable *_CopiedBytes)
	free(OutString); //free allocated memory
	return 0; //no error (don't abort tag preprocessing)
}
开发者ID:wdim0,项目名称:esp8266_rtos_whttpd,代码行数:30,代码来源:whttpd_preproc_cb.c

示例13: clear_interrupt

void ICACHE_FLASH_ATTR clear_interrupt(){
	//clear interrupt status
	uart0_sendStr("clear irq\n");
	GPIO_REG_WRITE(GPIO_STATUS_W1TC_ADDRESS, GPIO_REG_READ(GPIO_STATUS_ADDRESS) );
	
	as3935_chip_read();
	switch(as3935.x3.a3.INT){
		case IRQ_L:
			uart0_sendStr("as3935 lightning event \r\n");
			//check if we are within treshold
			if(threshold_distance>as3935.x7.a7.DISTANCE){
				//switch relay off
				
				GPIO_OUTPUT_SET(GPIO_ID_PIN(RELAY_PIN),0);
				
				//sqedule further checking
				state_machine=6;
			}
			
		break;
		case IRQ_D:
			uart0_sendStr("as3935 disturber detected \r\n");
			
		break;
		case IRQ_NF:
			uart0_sendStr("as3935 noise lewel to high \r\n");
			//todo: print to web page that we need to change  settings
		break;
	}
}
开发者ID:koltegirish,项目名称:as3935_esp8266_iot,代码行数:30,代码来源:as3935.c

示例14: user_init

void user_init(void) {
    uart_div_modify(0, UART_CLK_FREQ / 115200);
    os_delay_us(500);
    printf("SDK version : %s\n", system_get_sdk_version());
    mainqueue = xQueueCreate(10, sizeof(my_event_t));

    connectToAp();
    //setap("test", 4);

    init_led();

    PIN_FUNC_SELECT(PERIPHS_IO_MUX_GPIO5_U, FUNC_GPIO5);
    PIN_PULLUP_DIS(PERIPHS_IO_MUX_GPIO5_U); // disable pullodwn
    GPIO_REG_WRITE(GPIO_ENABLE_W1TS_ADDRESS,BIT5);
    GPIO_OUTPUT_SET(GPIO_ID_PIN(5), 1);

    char outbuffer[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
    WS2812OutBuffer( outbuffer, 6 , 0); //Initialize the output.
    write_textwall_buffer(0, "BIER ", 5);


    xTaskCreate(simple_task, (signed char * )"simple_task", 256, &mainqueue, tskIDLE_PRIORITY, NULL);
    xTaskCreate(receive_udp, (signed char * )"test", 256, &mainqueue, tskIDLE_PRIORITY, NULL);

    timerHandle = xTimerCreate((signed char *) "Trigger", 50 / portTICK_RATE_MS, pdTRUE, NULL, timer_cb);
    if (timerHandle != NULL) {
        if (xTimerStart(timerHandle, 0) != pdPASS) {
            printf("%s: Unable to start Timer ...\n", __FUNCTION__);
        }
    } else {
        printf("%s: Unable to create Timer ...\n", __FUNCTION__);
    }
}
开发者ID:houzhenggang,项目名称:ESP8266-3,代码行数:33,代码来源:user_main.c

示例15: board_init

int board_init(void)
{
	/* adress of boot parameters */
	gd->bd->bi_boot_params = 0x00000100;

	GPIO_OUTPUT_CLEAR(CONFIG_SYS_GPIO_IORST);
	GPIO_OUTPUT_ENABLE(CONFIG_SYS_GPIO_IORST);

	/* Setup GPIOs for PCI INTA */
	GPIO_OUTPUT_DISABLE(CONFIG_SYS_GPIO_PCI1_INTA);
	GPIO_INT_ACT_LOW_SET(CONFIG_SYS_GPIO_PCI1_INTA);

	/* Setup GPIOs for 33MHz clock output */
	GPIO_OUTPUT_ENABLE(CONFIG_SYS_GPIO_PCI_CLK);
	GPIO_OUTPUT_ENABLE(CONFIG_SYS_GPIO_EXTBUS_CLK);
	writel(0x011001FF, IXP425_GPIO_GPCLKR);

	udelay(533);
	GPIO_OUTPUT_SET(CONFIG_SYS_GPIO_IORST);

	ACTUX1_LED1(2);
	ACTUX1_LED2(2);
	ACTUX1_LED3(0);
	ACTUX1_LED4(0);
	ACTUX1_LED5(0);
	ACTUX1_LED6(0);
	ACTUX1_LED7(0);

	ACTUX1_HS(ACTUX1_HS_DCD);

	return 0;
}
开发者ID:Adrizcorp,项目名称:ARM_SOC_FPGA,代码行数:32,代码来源:actux1.c


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