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


C++ GPIO函数代码示例

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


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

示例1: configure_3g

static void configure_3g(void)
{
	/* Force 3G modem off to avoid confusing the EHCI host and
	 * causing problems during enumeration/init */
	gpio_output(GPIO(5, C, 1), 1);	/* 3G_SHUTDOWN */
	gpio_output(GPIO(4, D, 2), 0);	/* 3G_ON_OFF */
}
开发者ID:AdriDlu,项目名称:coreboot,代码行数:7,代码来源:mainboard.c

示例2: set_external_breakpoint_pin_state

void set_external_breakpoint_pin_state(uint16_t bitmask, bool state)
{
    if (state)
        GPIO(PORT_CODEPOINT, OUT) |= bitmask << PIN_CODEPOINT_0;
    else
        GPIO(PORT_CODEPOINT, OUT) &= ~(bitmask << PIN_CODEPOINT_0);
}
开发者ID:CMUAbstract,项目名称:edb-firmware,代码行数:7,代码来源:codepoint.c

示例3: ambarella_init_filbert

/* ==========================================================================*/
static void __init ambarella_init_filbert(void)
{
	int					i;

	ambarella_init_machine("Filbert");

	platform_add_devices(ambarella_devices, ARRAY_SIZE(ambarella_devices));
	for (i = 0; i < ARRAY_SIZE(ambarella_devices); i++) {
		device_set_wakeup_capable(&ambarella_devices[i]->dev, 1);
		device_set_wakeup_enable(&ambarella_devices[i]->dev, 0);
	}

	/* Config Eth0*/
	ambarella_eth0_platform_info.mii_reset.gpio_id = GPIO(124);
	ambarella_eth0_platform_info.mii_reset.active_level = GPIO_LOW;
	ambarella_eth0_platform_info.mii_reset.active_delay = 20;

	/* Config Eth1*/
	ambarella_eth1_platform_info.mii_reset.gpio_id = GPIO(125);
	ambarella_eth1_platform_info.mii_reset.active_level = GPIO_LOW;
	ambarella_eth1_platform_info.mii_reset.active_delay = 20;

	/* Config SD*/
	fio_default_owner = SELECT_FIO_SDIO;
	ambarella_platform_sd_controller0.clk_limit = 48000000;
	ambarella_platform_sd_controller0.slot[0].cd_delay = HZ;
	ambarella_platform_sd_controller0.slot[0].use_bounce_buffer = 1;
	ambarella_platform_sd_controller0.slot[0].max_blk_sz = SD_BLK_SZ_128KB;
	ambarella_platform_sd_controller0.slot[1].cd_delay = HZ;
	ambarella_platform_sd_controller0.slot[1].gpio_cd.irq_gpio = GPIO(75);
	ambarella_platform_sd_controller0.slot[1].gpio_cd.irq_line = gpio_to_irq(75);
	ambarella_platform_sd_controller0.slot[1].gpio_cd.irq_type = IRQ_TYPE_EDGE_BOTH;
	ambarella_platform_sd_controller0.slot[1].gpio_wp.gpio_id = GPIO(76);
}
开发者ID:WayWingsDev,项目名称:gopro-linux,代码行数:35,代码来源:init-boss_a7.c

示例4: UART_teardown

void UART_teardown(unsigned interface)
{
    // Put pins into High-Z state
    switch(interface)
    {
#ifdef UART_HOST
        case UART_INTERFACE_USB:
            UART(UART_HOST, IE) &= ~UCRXIE;   // disable Tx + Rx interrupts
            UART(UART_HOST, CTL1) |= UCSWRST; // put state machine in reset
            GPIO(PORT_UART_USB, SEL) &=
                ~(BIT(PIN_UART_USB_TX) | BIT(PIN_UART_USB_RX));
            GPIO(PORT_UART_USB, DIR) &=
                ~(BIT(PIN_UART_USB_TX) | BIT(PIN_UART_USB_RX));
            break;
#endif // PORT_UART_USB
#ifdef UART_TARGET
        case UART_INTERFACE_WISP:
            UART(UART_TARGET, IE) &= ~UCRXIE;   // disable Tx + Rx interrupts
            UART(UART_TARGET, CTL1) |= UCSWRST; // put state machine in reset
            GPIO(PORT_UART_TARGET, SEL) &=
                ~(BIT(PIN_UART_TARGET_TX) | BIT(PIN_UART_TARGET_RX));
            GPIO(PORT_UART_TARGET, DIR) &=
                ~(BIT(PIN_UART_TARGET_TX) | BIT(PIN_UART_TARGET_RX));
            break;
#endif // PORT_UART_TARGET
    }
}
开发者ID:CMUAbstract,项目名称:edb-firmware,代码行数:27,代码来源:uart.c

示例5: init

void init() {
  initClocks();

  // Ensure right location of interrupt vectors
  // The bootloader leaves its own after flashing
  SYSCFG.MEMRMP()->setMEM_MODE(SYSCFG::MEMRMP::MemMode::MainFlashmemory);
  CM4.VTOR()->setVTOR((void*) 0);

  // Put all inputs as Analog Input, No pull-up nor pull-down
  // Except for the SWD port (PB3, PA13, PA14)
  GPIOA.MODER()->set(0xEBFFFFFF);
  GPIOA.PUPDR()->set(0x24000000);
  GPIOB.MODER()->set(0xFFFFFFBF);
  GPIOB.PUPDR()->set(0x00000000);
  for (int g=2; g<5; g++) {
    GPIO(g).MODER()->set(0xFFFFFFFF); // All to "Analog"
    GPIO(g).PUPDR()->set(0x00000000); // All to "None"
  }

#if EPSILON_DEVICE_BENCH
  bool consolePeerConnectedOnBoot = Ion::Console::Device::peerConnected();
#endif

  initPeripherals();

#if EPSILON_DEVICE_BENCH
  if (consolePeerConnectedOnBoot) {
    Ion::Device::Bench::run();
  }
#endif
}
开发者ID:Tilka,项目名称:epsilon,代码行数:31,代码来源:device.cpp

示例6: configure_vop

static void configure_vop(void)
{
	write32(&rk3288_grf->iomux_lcdc, IOMUX_LCDC);

	/* lcdc(vop) iodomain select 1.8V */
	write32(&rk3288_grf->io_vsel, RK_SETBITS(1 << 0));

	switch (board_id()) {
	case 0:
		rk808_configure_switch(2, 1);	/* VCC18_LCD */
		rk808_configure_ldo(7, 2500);	/* VCC10_LCD_PWREN_H */
		rk808_configure_switch(1, 1);	/* VCC33_LCD */
		break;
	default:
		gpio_output(GPIO(2, B, 5), 1);	/* AVDD_1V8_DISP_EN */
		rk808_configure_ldo(7, 2500);	/* VCC10_LCD_PWREN_H */
		gpio_output(GPIO(7, B, 6), 1);	/* LCD_EN */
		rk808_configure_switch(1, 1);	/* VCC33_LCD */

		/* enable edp HPD */
		gpio_input_pulldown(GPIO(7, B, 3));
		write32(&rk3288_grf->iomux_edp_hotplug, IOMUX_EDP_HOTPLUG);
		break;
	}
}
开发者ID:zamaudio,项目名称:coreboot,代码行数:25,代码来源:mainboard.c

示例7: bootblock_mainboard_early_init

void bootblock_mainboard_early_init(void)
{
	/* Let gpio2ab io domains works at 1.8V.
	 *
	 * If io_vsel[0] == 0(default value), gpio2ab io domains is 3.0V
	 * powerd by APIO2_VDD, otherwise, 1.8V supplied by APIO2_VDDPST.
	 * But from the schematic of kevin rev0, the APIO2_VDD and
	 * APIO2_VDDPST both are 1.8V(intentionally?).
	 *
	 * So, by default, CPU1_SDIO_PWREN(GPIO2_A2) can't output 3.0V
	 * because the supply is 1.8V.
	 * Let ask GPIO2_A2 output 1.8V to make GPIO interal logic happy.
	 */
	write32(&rk3399_grf->io_vsel, RK_SETBITS(1 << 0));

	/*
	 * Let's enable these power rails here, we are already running the SPI
	 * Flash based code.
	 */
	gpio_output(GPIO(0, B, 2), 1);  /* PP1500_EN */
	gpio_output(GPIO(0, B, 4), 1);  /* PP3000_EN */

	if (IS_ENABLED(CONFIG_DRIVERS_UART)) {
		_Static_assert(CONFIG_CONSOLE_SERIAL_UART_ADDRESS == UART2_BASE,
			       "CONSOLE_SERIAL_UART should be UART2");

		/* iomux: select gpio4c[4:3] as uart2 dbg port */
		write32(&rk3399_grf->iomux_uart2c, IOMUX_UART2C);

		/* grf soc_con7[11:10] use for uart2 select */
		write32(&rk3399_grf->soc_con7, UART2C_SEL);
	}
}
开发者ID:kk1987,项目名称:coreboot,代码行数:33,代码来源:bootblock.c

示例8: append_watchpoint_event

static void append_watchpoint_event(unsigned index)
{
    if (watchpoint_events_count[watchpoint_events_buf_idx] <
            param_num_watchpoint_events_buffered) {

        watchpoint_event_t *watchpoint_event =
            &watchpoint_events_buf[watchpoint_events_count[watchpoint_events_buf_idx]++];

        watchpoint_event->timestamp = SYSTICK_CURRENT_TIME;
        watchpoint_event->index = index;
        if (watchpoints_vcap_snapshot & (1 << index))
            watchpoint_event->vcap = ADC_read(ADC_CHAN_INDEX_VCAP);
        else // TODO: don't stream vcap at all if snapshot is not enabled
            watchpoint_event->vcap = 0;

    }

    if (watchpoint_events_count[watchpoint_events_buf_idx] ==
            param_num_watchpoint_events_buffered) {// buffer full
        if (!(main_loop_flags & FLAG_WATCHPOINT_READY)) { // the other buffer is free
            swap_buffers();
            // clear error indicator
            GPIO(PORT_LED, OUT) &= ~BIT(PIN_LED_RED);
        } else { // both buffers are full
            // indicate error on LED
            GPIO(PORT_LED, OUT) |= BIT(PIN_LED_RED);

            // drop the watchpoints on the floor
        }
    } else {
        // clear error indicator
        GPIO(PORT_LED, OUT) &= ~BIT(PIN_LED_RED);
    }
}
开发者ID:CMUAbstract,项目名称:edb-firmware,代码行数:34,代码来源:codepoint.c

示例9: target_set_debug_led

void target_set_debug_led(unsigned int led, bool on)
{
	switch (led) {
		case 0: gpio_set(GPIO(GPIO_PORT_F, 1), on); break;
		case 1: gpio_set(GPIO(GPIO_PORT_F, 2), on); break;
		case 2: gpio_set(GPIO(GPIO_PORT_F, 3), on); break;
	}
}
开发者ID:DSKIM3,项目名称:lk,代码行数:8,代码来源:init.c

示例10: io_mcp_get_pin_info

irom io_error_t io_mcp_get_pin_info(string_t *dst, const struct io_info_entry_T *info, io_data_pin_entry_t *pin_data, const io_config_pin_entry_t *pin_config, int pin)
{
	int bank, bankpin, tv;
	int io, olat, cached;
	mcp_data_pin_t *mcp_pin_data;

	bank = (pin & 0x08) >> 3;
	bankpin = pin & 0x07;

	mcp_pin_data = &mcp_data_pin_table[info->instance][pin];

	switch(pin_config->llmode)
	{
		case(io_pin_ll_input_analog):
		{
			if(read_register(dst, info->address, GPIO(bank), &tv) != io_ok)
				return(io_error);

			string_format(dst, "current io: %s", onoff(tv & (1 << bankpin)));

			break;
		}

		case(io_pin_ll_counter):
		{
			if(read_register(dst, info->address, GPIO(bank), &tv) != io_ok)
				return(io_error);

			string_format(dst, "current io: %s, debounce: %d", onoff(tv & (1 << bankpin)), mcp_pin_data->debounce);

			break;
		}

		case(io_pin_ll_output_digital):
		{
			if(read_register(dst, info->address, GPIO(bank), &tv) != io_ok)
				return(io_error);

			io = tv & (1 << bankpin);

			if(read_register(dst, info->address, OLAT(bank), &tv) != io_ok)
				return(io_error);

			olat = tv & (1 << bankpin);
			cached = pin_output_cache[bank] & (1 << bankpin);

			string_format(dst, "current latch: %s, io: %s, cache: %s", onoff(io), onoff(olat), onoff(cached));

			break;
		}

		default:
		{
		}
	}

	return(io_ok);
}
开发者ID:ESP32DE,项目名称:esp8266-universal-io-bridge,代码行数:58,代码来源:io_mcp.c

示例11: board_id

uint32_t board_id(void)
{
	const gpio_t pins[] = {[2] = GPIO(51), [1] = GPIO(62), [0] = GPIO(38)};
	static uint32_t id = UNDEFINED_STRAPPING_ID;

	if (id == UNDEFINED_STRAPPING_ID)
		id = gpio_base2_value(pins, ARRAY_SIZE(pins));

	return id;
}
开发者ID:canistation,项目名称:coreboot,代码行数:10,代码来源:boardid.c

示例12: rush_backlight_update

/* Turn on or turn off the backlight */
static int rush_backlight_update(DisplayOps *me, uint8_t enable)
{
	TegraGpio *backlight_vdd_enable = new_tegra_gpio_output(GPIO(P, 2));
	TegraGpio *backlight_enable = new_tegra_gpio_output(GPIO(H, 2));

	gpio_set(&backlight_vdd_enable->ops, enable);
	mdelay(10);
	gpio_set(&backlight_enable->ops, enable);

	return 0;
}
开发者ID:rockchip-linux,项目名称:depthcharge,代码行数:12,代码来源:board.c

示例13: ram_code

uint32_t ram_code(void)
{
	uint32_t code;
	static gpio_t pins[] = {[3] = GPIO(8, A, 3), [2] = GPIO(8, A, 2),
		[1] = GPIO(8, A, 1), [0] = GPIO(8, A, 0)}; /* GPIO8_A0 is LSB */

	code = gpio_base2_value(pins, ARRAY_SIZE(pins));
	printk(BIOS_SPEW, "RAM Config: %u.\n", code);

	return code;
}
开发者ID:tidatida,项目名称:coreboot,代码行数:11,代码来源:boardid.c

示例14: UART_Init

void UART_Init(int id, UINT32 baud)
{
    if (id == 0) {
	GPIO_SetP0Function(GPIO(0,0), 1);  // P0.0 Function TxD UART0
	GPIO_SetP0Function(GPIO(0,1), 1); //  P0.1 Function RxD UART0
    }
    else if (id == 1) {
	GPIO_SetP0Function(GPIO(0,8), 1);  // P0.8 Function TxD UART0
	GPIO_SetP0Function(GPIO(0,9), 1); //  P0.9 Function RxD UART0
    }
    UART_SetBaud(id, baud);
}
开发者ID:toxicgumbo,项目名称:m1,代码行数:12,代码来源:uart.c

示例15: mainboard_keyboard_init

void mainboard_keyboard_init(struct pk_sm_desc *desc)
{
	pwr_btn_gpio = sysinfo_lookup_gpio("power", 1,
					   new_tegra_gpio_input_from_coreboot);
	die_if(!pwr_btn_gpio, "No GPIO for power!!\n");

	/* Inputs volup and voldown are active low. */
	vol_down_gpio = new_gpio_not(&new_tegra_gpio_input(GPIO(X, 7))->ops);
	vol_up_gpio = new_gpio_not(&new_tegra_gpio_input(GPIO(X, 6))->ops);

	foster_sm_init(desc);
}
开发者ID:coreboot,项目名称:depthcharge,代码行数:12,代码来源:keyboard.c


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