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

C++ PIN_FUNC_SELECT函数代码示例

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

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



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

示例1: user_init

// Init function 
void ICACHE_FLASH_ATTR user_init()
{
  struct station_config station_conf;

  // Enable GPIO
  gpio_init();
  PIN_FUNC_SELECT(PERIPHS_IO_MUX_GPIO2_U, FUNC_GPIO2);
  PIN_FUNC_SELECT(PERIPHS_IO_MUX_GPIO0_U, FUNC_GPIO0);
  gpio_output_set(0, 0, (1<<ELGPIO), 0);

  // Set station mode
  wifi_set_opmode_current(STATION_MODE);

  // Set AP settings
  os_memcpy(&station_conf.ssid, SSID, 32);
  os_memcpy(&station_conf.password, SSID_PASSWORD, 64);
  wifi_station_set_config(&station_conf);

  // Set an event handler for WiFi events
  wifi_set_event_handler_cb(wifi_callback);

  // Setup poll and EL timers, but don't start them yet
  os_timer_disarm(&poll_timer);
  os_timer_setfn(&poll_timer, poll_timer_callback, NULL);
  os_timer_disarm(&el_timer);
  os_timer_setfn(&el_timer, el_timer_callback, NULL);

  os_printf("user_init() complete!\n\r");
}
开发者ID:matt-williams,项目名称:coin-op-tshirt,代码行数:30,代码来源:user_main.c


示例2: user_spi_pin_init

/*
 * 函数:user_spi_pin_init
 * 说明:SPI引脚初始化
 */
void ICACHE_FLASH_ATTR
user_spi_pin_init(void)
{

#if defined(HARD_SPI)
    SpiAttr hSpiAttr;
    hSpiAttr.bitOrder = SpiBitOrder_MSBFirst;
    /*
     * SpiSpeed_0_5MHz     = 160,
     * SpiSpeed_1MHz       = 80,
     * SpiSpeed_2MHz       = 40,
     * SpiSpeed_5MHz       = 16,
     * SpiSpeed_8MHz       = 10,
     * SpiSpeed_10MHz      = 8,
     */
    hSpiAttr.speed = SpiSpeed_0_5MHz;
    hSpiAttr.mode = SpiMode_Master;
    hSpiAttr.subMode = SpiSubMode_0;

    // Init HSPI GPIO
    WRITE_PERI_REG(PERIPHS_IO_MUX, 0x105);
    PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTDI_U, 2);//configure io to spi mode
    PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTCK_U, 2);//configure io to spi mode
    PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTMS_U, 2);//configure io to spi mode
    PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTDO_U, 2);//configure io to spi mode

    SPIInit(SpiNum_HSPI, &hSpiAttr);

#elif defined(SOFT_SPI)
    SOFT_PIN_INIT();
#else
	#error #error "Please define SPI Interface mode : SOFT_SPI or HARD_SPI"
#endif

}
开发者ID:zouchuan1991,项目名称:ESP8266-Demos,代码行数:39,代码来源:user_spi.c


示例3: some_timer_func

void some_timer_func(void *arg) // in Arduino this is loop the main loop
{
        PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTCK_U, FUNC_U0CTS);//CONFIG MTCK PIN FUNC TO U0CTS
        PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTDO_U, FUNC_U0RTS);//CONFIG MTDO PIN FUNC TO U0RTS
        SET_PERI_REG_MASK(0x3ff00028 , BIT2);//SWAP PIN : U0TXD<==>U0RTS(MTDO) , U0RXD<==>U0CTS(MTCK)
	os_printf("pins activated");
}
开发者ID:UnicronNL,项目名称:ESP8266-transparent-bridge,代码行数:7,代码来源:user_main.c


示例4: GPIO_INTER

LOCAL void ICACHE_FLASH_ATTR
GPIO_INTER(void)
{
	os_printf(" LVZAINA ===> SmartConfig start! \n");
	uint32 gpio_status;
	uint8 index = 0;
	gpio_status = GPIO_REG_READ(GPIO_STATUS_ADDRESS);
	//clear interrupt status
	GPIO_REG_WRITE(GPIO_STATUS_W1TC_ADDRESS, gpio_status);

	PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTCK_U, FUNC_GPIO13);
	PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTDO_U, FUNC_GPIO15);
	PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTMS_U, FUNC_GPIO14);
	while(index < 3)
	{
		os_printf(" LVZAINA ===> SmartConfig... \n");
		gpio_output_set(0, 1<<13, 1<<13, 0);
		gpio_output_set(1<<15,0 , 1<<15, 0);
		gpio_output_set(0, 1<<14, 1<<14, 0);
		gpio_io_wait(500000);
		gpio_output_set(0, 1<<15, 1<<15, 0);
		gpio_output_set(1<<13,0 , 1<<13, 0);
		gpio_output_set(1<<14,0 , 1<<14, 0);
		gpio_io_wait(500000);
		/*if( is_wificonfig_ok == 1)*/
			/*break;*/
		index++;
	}


}
开发者ID:lvzaina,项目名称:esp8266_nm,代码行数:31,代码来源:user_esp_platform.c


示例5: i2c_master_gpio_init

/******************************************************************************
 * FunctionName : i2c_master_gpio_init
 * Description  : config SDA and SCL gpio to open-drain output mode,
 *				mux and gpio num defined in i2c_master.h
 * Parameters   : uint8 sda and scl pin numbers
 * Returns	  : bool, true if init okay
*******************************************************************************/
bool i2c_master_gpio_init(uint8 sda, uint8 scl)
{
	if((sda > GPIO_PIN_NUM) || (pin_func[sda] == GPIO_PIN_FUNC_INVALID)){
		return false;
	}

	if((scl > GPIO_PIN_NUM) || (pin_func[scl] == GPIO_PIN_FUNC_INVALID)){
		return false;
	}

	pinSDA = sda;
	pinSCL = scl;

	ETS_GPIO_INTR_DISABLE() ;
//	ETS_INTR_LOCK();

	PIN_FUNC_SELECT(pin_mux[sda], pin_func[sda]);
	PIN_FUNC_SELECT(pin_mux[scl], pin_func[scl]);

	GPIO_REG_WRITE(GPIO_PIN_ADDR(GPIO_ID_PIN(sda)), GPIO_REG_READ(GPIO_PIN_ADDR(GPIO_ID_PIN(sda))) | GPIO_PIN_PAD_DRIVER_SET(GPIO_PAD_DRIVER_ENABLE)); //open drain;
	GPIO_REG_WRITE(GPIO_ENABLE_ADDRESS, GPIO_REG_READ(GPIO_ENABLE_ADDRESS) | (1 << sda));
	GPIO_REG_WRITE(GPIO_PIN_ADDR(GPIO_ID_PIN(scl)), GPIO_REG_READ(GPIO_PIN_ADDR(GPIO_ID_PIN(scl))) | GPIO_PIN_PAD_DRIVER_SET(GPIO_PAD_DRIVER_ENABLE)); //open drain;
	GPIO_REG_WRITE(GPIO_ENABLE_ADDRESS, GPIO_REG_READ(GPIO_ENABLE_ADDRESS) | (1 << scl));

	i2c_master_setDC(1, 1);

	ETS_GPIO_INTR_ENABLE() ;
//	ETS_INTR_UNLOCK();

	i2c_master_init();
	return true;
}
开发者ID:alemoke,项目名称:esp8266-frankenstein,代码行数:39,代码来源:i2c_master.c


示例6: dmx_task

void ICACHE_FLASH_ATTR dmx_task(os_event_t *events) {
	int i;
	
	if(twinkl_has_changes()) {
		INFO("Updating DMX channels\n");
		twinkl_render(dmx_channels);
	}

	//INFO("Sending DMX channels\n");

	//Space for break
	PIN_FUNC_SELECT(pin_mux[dmx_tx_pin], FUNC_GPIO2);	
	gpio_output_set(0, BIT2, BIT2, 0); 
	os_delay_us(125);
	
	//Mark After Break
	gpio_output_set(BIT2, 0, BIT2, 0);
	os_delay_us(50);

	//Looks the wrong way round, but reduces jitter somehow
	//Do not touch.
	PIN_FUNC_SELECT(pin_mux[dmx_tx_pin], FUNC_U1TXD_BK);	
	uart_tx_one_char(1, 0);

	for(i = 0; i < TWINKL_CHANNEL_COUNT; i++) {
		uart_tx_one_char(1, dmx_channels[i]);
	}

	//INFO("Done sending DMX channels\n");
	if(udp_server != NULL) {
		os_timer_arm(&dmx_update_timer, dmx_refresh_delay, 0);
	}
}
开发者ID:LongHairedHacker,项目名称:twinkl-esp,代码行数:33,代码来源:user_main.c


示例7: ioInit

void ioInit() {
	PIN_FUNC_SELECT(PERIPHS_IO_MUX_GPIO2_U, FUNC_GPIO2);
	PIN_FUNC_SELECT(PERIPHS_IO_MUX_GPIO0_U, FUNC_GPIO0);
	gpio_output_set(0, 0, (1<<LEDGPIO), (1<<BTNGPIO));
	os_timer_disarm(&resetBtntimer);
	os_timer_setfn(&resetBtntimer, resetBtnTimerCb, NULL);
	os_timer_arm(&resetBtntimer, 500, 1);
    
	
	/*

void gpio_output_set (uint32 set_mask, uint32 clear_mask, uint32 enable_mask,
uint32 disable_mask)
Input parameters:
uint32 disable_mask — settings disable bits,
uint32 enable_mask  — settings enable output bit,
uint32 clear_mask     — set the output to a low position,
uint32 set_mask         — set the output to a high position.

	*/
	
	//	system_mktime(uint32 year, uint32 mon, uint32 day, uint32 hour, uint32 min, uint32 sec);
//	system_mktime(2014, 1,1,0, 0,0);
	//uint32 time = system_get_time()/TIMEMILIMIL;
	//os_printf("[%d] ioInit().\n",time);
	
  timerCounter=0; 
   timerCounterOverAll=0;  triggerLastTime=0;
}
开发者ID:bacl,项目名称:WiFiPhot0,代码行数:29,代码来源:io.c


示例8: pwm_init

/******************************************************************************
 * FunctionName : pwm_init
 * Description  : pwm gpio, params and timer initialization
 * Parameters   : uint16 freq : pwm freq param
 *                uint8 *duty : each channel's duty
 * Returns      : NONE
*******************************************************************************/
void ICACHE_FLASH_ATTR
pwm_init(uint16 freq, uint8 *duty)
{
    uint8 i;

    ETS_FRC_TIMER1_INTR_ATTACH(pwm_tim1_intr_handler, NULL);
    TM1_EDGE_INT_ENABLE();
    ETS_FRC1_INTR_ENABLE();

    RTC_CLR_REG_MASK(FRC1_INT_ADDRESS, FRC1_INT_CLR_MASK);
    RTC_REG_WRITE(FRC1_CTRL_ADDRESS,  //FRC2_AUTO_RELOAD|
                  DIVDED_BY_16
                  | FRC1_ENABLE_TIMER
                  | TM_EDGE_INT);
    RTC_REG_WRITE(FRC1_LOAD_ADDRESS, 0);

    PIN_FUNC_SELECT(PWM_0_OUT_IO_MUX, PWM_0_OUT_IO_FUNC);
    PIN_FUNC_SELECT(PWM_1_OUT_IO_MUX, PWM_1_OUT_IO_FUNC);
    PIN_FUNC_SELECT(PWM_2_OUT_IO_MUX, PWM_2_OUT_IO_FUNC);

    for (i = 0; i < PWM_CHANNEL; i++) {
        pwm_gpio |= (1 << pwm_out_io_num[i]);
    }

    pwm_set_freq_duty(freq, duty);

    pwm_start();
}
开发者ID:Squonk42,项目名称:nodelua,代码行数:35,代码来源:pwm.c


示例9: hspi_init

void hspi_init(void)
{
    spi_fifo = (uint32_t*)SPI_FLASH_C0(HSPI);

    WRITE_PERI_REG(PERIPHS_IO_MUX, 0x105); //clear bit9

    //PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTDI_U, 2); // HSPIQ MISO GPIO12
    PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTCK_U, 2); // HSPID MOSI GPIO13
    PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTMS_U, 2); // CLK GPIO14
    PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTDO_U, 2); // CS GPIO15


    // SPI clock = CPU clock / 10 / 4
    // time length HIGHT level = (CPU clock / 10 / 2) ^ -1,
    // time length LOW level = (CPU clock / 10 / 2) ^ -1
    WRITE_PERI_REG(SPI_FLASH_CLOCK(HSPI),
                   (((HSPI_PRESCALER - 1) & SPI_CLKDIV_PRE) << SPI_CLKDIV_PRE_S) |
                   ((1 & SPI_CLKCNT_N) << SPI_CLKCNT_N_S) |
                   ((0 & SPI_CLKCNT_H) << SPI_CLKCNT_H_S) |
                   ((1 & SPI_CLKCNT_L) << SPI_CLKCNT_L_S));

    WRITE_PERI_REG(SPI_FLASH_CTRL1(HSPI), 0);

    uint32_t regvalue = SPI_FLASH_DOUT;
    regvalue &= ~(BIT2 | SPI_FLASH_USR_ADDR | SPI_FLASH_USR_DUMMY | SPI_FLASH_USR_DIN | SPI_USR_COMMAND | SPI_DOUTDIN); //clear bit 2 see example IoT_Demo
    WRITE_PERI_REG(SPI_FLASH_USER(HSPI), regvalue);
}
开发者ID:tsbp,项目名称:TERMO_WIFII,代码行数:27,代码来源:hspi.c


示例10: ioInit

void ioInit() {
	PIN_FUNC_SELECT(PERIPHS_IO_MUX_GPIO0_U, FUNC_GPIO0);
	PIN_FUNC_SELECT(PERIPHS_IO_MUX_GPIO4_U, FUNC_GPIO4);
	PIN_FUNC_SELECT(PERIPHS_IO_MUX_GPIO5_U, FUNC_GPIO5);
	//PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTDI_U, FUNC_GPIO12);
//	gpio_output_set(0, 0, (1<<LEDGPIO), (1<<BTNGPIO));
//	os_timer_disarm(&resetBtntimer);
//	os_timer_setfn(&resetBtntimer, resetBtnTimerCb, NULL);
//	os_timer_arm(&resetBtntimer, 500, 1);

	light_param.pwm_period = 1000;

	uint32 io_info[][3] = {   {PWM_0_OUT_IO_MUX,PWM_0_OUT_IO_FUNC,PWM_0_OUT_IO_NUM},
		                      {PWM_1_OUT_IO_MUX,PWM_1_OUT_IO_FUNC,PWM_1_OUT_IO_NUM},
		                      {PWM_2_OUT_IO_MUX,PWM_2_OUT_IO_FUNC,PWM_2_OUT_IO_NUM},
//		                      {PWM_3_OUT_IO_MUX,PWM_3_OUT_IO_FUNC,PWM_3_OUT_IO_NUM},
//		                      {PWM_4_OUT_IO_MUX,PWM_4_OUT_IO_FUNC,PWM_4_OUT_IO_NUM},
		                      };

    uint32 pwm_duty_init[PWM_CHANNEL] = {0,0,0};

    /*PIN FUNCTION INIT FOR PWM OUTPUT*/
    pwm_init(light_param.pwm_period,  pwm_duty_init ,PWM_CHANNEL,io_info);
    set_pwm_debug_en(0);
    pwm_start();
}
开发者ID:richcj10,项目名称:USA-FW-IoT,代码行数:26,代码来源:io.c


示例11: i2c_init

/**
 * I2C init function
 * This sets up the GPIO io
 */
void ICACHE_FLASH_ATTR
i2c_init(void)
{
    //Disable interrupts
    ETS_GPIO_INTR_DISABLE();

    //Set pin functions
    PIN_FUNC_SELECT(I2C_SDA_MUX, I2C_SDA_FUNC);
    PIN_FUNC_SELECT(I2C_SCK_MUX, I2C_SCK_FUNC);

    //Set SDA as open drain
    GPIO_REG_WRITE(
        GPIO_PIN_ADDR(GPIO_ID_PIN(I2C_SDA_PIN)), 
        GPIO_REG_READ(GPIO_PIN_ADDR(GPIO_ID_PIN(I2C_SDA_PIN))) | 
        GPIO_PIN_PAD_DRIVER_SET(GPIO_PAD_DRIVER_ENABLE)
    );

    GPIO_REG_WRITE(GPIO_ENABLE_ADDRESS, GPIO_REG_READ(GPIO_ENABLE_ADDRESS) | (1 << I2C_SDA_PIN));

    //Set SCK as open drain
    GPIO_REG_WRITE(
        GPIO_PIN_ADDR(GPIO_ID_PIN(I2C_SCK_PIN)), 
        GPIO_REG_READ(GPIO_PIN_ADDR(GPIO_ID_PIN(I2C_SCK_PIN))) | 
        GPIO_PIN_PAD_DRIVER_SET(GPIO_PAD_DRIVER_ENABLE)
    );

    GPIO_REG_WRITE(GPIO_ENABLE_ADDRESS, GPIO_REG_READ(GPIO_ENABLE_ADDRESS) | (1 << I2C_SCK_PIN));

    //Turn interrupt back on
    ETS_GPIO_INTR_ENABLE();

    i2c_sda(1);
    i2c_sck(1);
    return;
}
开发者ID:Ignat99,项目名称:ESP8266_Relay_Board,代码行数:39,代码来源:i2c.c


示例12: user_link_led_init

LOCAL void ICACHE_FLASH_ATTR
user_link_led_init(void)
{
    PIN_FUNC_SELECT(SENSOR_LINK_LED_IO_MUX, SENSOR_LINK_LED_IO_FUNC);
    PIN_FUNC_SELECT(SENSOR_UNUSED_LED_IO_MUX, SENSOR_UNUSED_LED_IO_FUNC);
    GPIO_OUTPUT_SET(GPIO_ID_PIN(SENSOR_UNUSED_LED_IO_NUM), 0);
}
开发者ID:alonewolfx2,项目名称:esp8266-sdk,代码行数:7,代码来源:user_sensor.c


示例13: i2c_init

void ICACHE_FLASH_ATTR i2c_init(void)
{
    // MUX selection
    PIN_FUNC_SELECT(SDA_MUX, SDA_FUNC);
    PIN_FUNC_SELECT(SCL_MUX, SCL_FUNC);

    // Set SDA as OD output
    GPIO_REG_WRITE
    (
        GPIO_PIN_ADDR(GPIO_ID_PIN(SDA_PIN)),
        GPIO_REG_READ(GPIO_PIN_ADDR(GPIO_ID_PIN(SDA_PIN))) | GPIO_PIN_PAD_DRIVER_SET(GPIO_PAD_DRIVER_ENABLE)
    );
    // Set SCK as OD output
    GPIO_REG_WRITE
    (
        GPIO_PIN_ADDR(GPIO_ID_PIN(SCL_PIN)),
        GPIO_REG_READ(GPIO_PIN_ADDR(GPIO_ID_PIN(SCL_PIN))) | GPIO_PIN_PAD_DRIVER_SET(GPIO_PAD_DRIVER_ENABLE)
    );
    // Set idle bus high
    _SDA1;
    _SCL1;
    // Set both output
    GPIO_REG_WRITE(GPIO_ENABLE_ADDRESS, GPIO_REG_READ(GPIO_ENABLE_ADDRESS) | SDA_BIT | SCL_BIT);
    return;
}
开发者ID:nickplee,项目名称:wifiwatch,代码行数:25,代码来源:i2c.c


示例14: ioInit

void ioInit() {
	PIN_FUNC_SELECT(PERIPHS_IO_MUX_GPIO2_U, FUNC_GPIO2);
	PIN_FUNC_SELECT(PERIPHS_IO_MUX_GPIO0_U, FUNC_GPIO0);
	gpio_output_set((1<<LEDGPIO), 0, (1<<LEDGPIO), (1<<BTNGPIO));
	os_timer_disarm(&resetBtntimer);
	os_timer_setfn(&resetBtntimer, resetBtnTimerCb, NULL);
//	os_timer_arm(&resetBtntimer, 500, 1);
}
开发者ID:VNArmy,项目名称:esp-switch-control,代码行数:8,代码来源:io.c


示例15: miot_uart_dev_init

bool miot_uart_dev_init(struct miot_uart_state *us) {
  struct miot_uart_config *cfg = us->cfg;
  if (!esp_uart_validate_config(cfg)) return false;

  ETS_INTR_DISABLE(ETS_UART_INUM);
  uart_div_modify(us->uart_no, UART_CLK_FREQ / cfg->baud_rate);

  if (us->uart_no == 0) {
    PIN_PULLUP_DIS(PERIPHS_IO_MUX_U0TXD_U);
    PIN_FUNC_SELECT(PERIPHS_IO_MUX_U0TXD_U, FUNC_U0TXD);
    if (cfg->swap_rxcts_txrts) {
      SET_PERI_REG_MASK(PERIPHS_DPORT_BASEADDR + HOST_INF_SEL,
                        PERI_IO_UART0_PIN_SWAP);
    } else {
      CLEAR_PERI_REG_MASK(PERIPHS_DPORT_BASEADDR + HOST_INF_SEL,
                          PERI_IO_UART0_PIN_SWAP);
    }
  } else {
    PIN_PULLUP_DIS(PERIPHS_IO_MUX_GPIO2_U);
    PIN_FUNC_SELECT(PERIPHS_IO_MUX_GPIO2_U, FUNC_U1TXD_BK);
    if (cfg->swap_rxcts_txrts) {
      SET_PERI_REG_MASK(PERIPHS_DPORT_BASEADDR + HOST_INF_SEL,
                        PERI_IO_UART1_PIN_SWAP);
    } else {
      CLEAR_PERI_REG_MASK(PERIPHS_DPORT_BASEADDR + HOST_INF_SEL,
                          PERI_IO_UART1_PIN_SWAP);
    }
  }

  unsigned int conf0 = 0b011100; /* 8-N-1 */
  if (cfg->tx_fc_ena) {
    conf0 |= UART_TX_FLOW_EN;
    PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTCK_U, FUNC_U0CTS);
  }
  WRITE_PERI_REG(UART_CONF0(us->uart_no), conf0);

  unsigned int conf1 = cfg->rx_fifo_full_thresh;
  conf1 |= (cfg->tx_fifo_empty_thresh << 8);
  if (cfg->rx_fifo_alarm >= 0) {
    conf1 |= UART_RX_TOUT_EN | ((cfg->rx_fifo_alarm & 0x7f) << 24);
  }
  if (cfg->rx_fc_ena && cfg->rx_fifo_fc_thresh > 0) {
    /* UART_RX_FLOW_EN will be set in uart_start. */
    conf1 |= ((cfg->rx_fifo_fc_thresh & 0x7f) << 16);
    PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTDO_U, FUNC_U0RTS);
  }
  WRITE_PERI_REG(UART_CONF1(us->uart_no), conf1);

  s_us[us->uart_no] = us;

  /* Start with TX and RX ints disabled. */
  WRITE_PERI_REG(UART_INT_ENA(us->uart_no), UART_INFO_INTS);

  ETS_UART_INTR_ATTACH(esp_uart_isr, NULL);
  ETS_INTR_ENABLE(ETS_UART_INUM);
  return true;
}
开发者ID:zikalino,项目名称:mongoose-iot,代码行数:57,代码来源:esp_uart.c


示例16: WRITE_PERI_REG

/* @defgroup SPI hardware implementation
 * @brief begin()
 *
 * Initializes the SPI bus using the default SPISettings
 *
 */
void SPIClass::begin() {

	WRITE_PERI_REG(PERIPHS_IO_MUX, 0x105); //clear bit9

	PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTDI_U, 2); // HSPIQ MISO == GPIO12
	PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTCK_U, 2); // HSPID MOSI == GPIO13
	PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTMS_U, 2); // CLK		 == GPIO14

	prepare(this->SPIDefaultSettings);
}
开发者ID:blinkingnoise,项目名称:Sming,代码行数:16,代码来源:SPI.cpp


示例17: uart_config

/******************************************************************************
 * FunctionName : uart_config
 * Description  : Internal used function
 *                UART0 used for data TX/RX, RX buffer size is 0x100, interrupt enabled
 *                UART1 just used for debug output
 * Parameters   : uart_no, use UART0 or UART1 defined ahead
 * Returns      : NONE
*******************************************************************************/
static void ICACHE_FLASH_ATTR
uart_config(uint8 uart_no)
{
  if (uart_no == UART1) {
    PIN_FUNC_SELECT(PERIPHS_IO_MUX_GPIO2_U, FUNC_U1TXD_BK);
    //PIN_PULLDWN_DIS(PERIPHS_IO_MUX_GPIO2_U);
    PIN_PULLUP_DIS(PERIPHS_IO_MUX_GPIO2_U);
  } else {
    /* rcv_buff size is 0x100 */
    ETS_UART_INTR_ATTACH(uart0_rx_intr_handler,  &(UartDev.rcv_buff));
    PIN_PULLUP_DIS (PERIPHS_IO_MUX_U0TXD_U);
    //PIN_PULLDWN_DIS(PERIPHS_IO_MUX_U0TXD_U);
    PIN_FUNC_SELECT(PERIPHS_IO_MUX_U0TXD_U, FUNC_U0TXD);
    PIN_PULLUP_DIS (PERIPHS_IO_MUX_U0RXD_U);
    //PIN_PULLDWN_DIS(PERIPHS_IO_MUX_U0RXD_U);
    PIN_FUNC_SELECT(PERIPHS_IO_MUX_U0RXD_U, 0); // FUNC_U0RXD==0
  }

  uart_div_modify(uart_no, UART_CLK_FREQ / UartDev.baut_rate);

  if (uart_no == UART1)  //UART 1 always 8 N 1
    WRITE_PERI_REG(UART_CONF0(uart_no),
        CALC_UARTMODE(EIGHT_BITS, NONE_BITS, ONE_STOP_BIT));
  else
    WRITE_PERI_REG(UART_CONF0(uart_no),
        CALC_UARTMODE(UartDev.data_bits, UartDev.parity, UartDev.stop_bits));

  //clear rx and tx fifo,not ready
  SET_PERI_REG_MASK(UART_CONF0(uart_no), UART_RXFIFO_RST | UART_TXFIFO_RST);
  CLEAR_PERI_REG_MASK(UART_CONF0(uart_no), UART_RXFIFO_RST | UART_TXFIFO_RST);

  if (uart_no == UART0) {
    // Configure RX interrupt conditions as follows: trigger rx-full when there are 80 characters
    // in the buffer, trigger rx-timeout when the fifo is non-empty and nothing further has been
    // received for 4 character periods.
    // Set the hardware flow-control to trigger when the FIFO holds 100 characters, although
    // we don't really expect the signals to actually be wired up to anything. It doesn't hurt
    // to set the threshold here...
    // We do not enable framing error interrupts 'cause they tend to cause an interrupt avalanche
    // and instead just poll for them when we get a std RX interrupt.
    WRITE_PERI_REG(UART_CONF1(uart_no),
                   ((80 & UART_RXFIFO_FULL_THRHD) << UART_RXFIFO_FULL_THRHD_S) |
                   ((100 & UART_RX_FLOW_THRHD) << UART_RX_FLOW_THRHD_S) |
                   UART_RX_FLOW_EN |
                   (4 & UART_RX_TOUT_THRHD) << UART_RX_TOUT_THRHD_S |
                   UART_RX_TOUT_EN);
    SET_PERI_REG_MASK(UART_INT_ENA(uart_no), UART_RXFIFO_FULL_INT_ENA | UART_RXFIFO_TOUT_INT_ENA);
  } else {
    WRITE_PERI_REG(UART_CONF1(uart_no),
                   ((UartDev.rcv_buff.TrigLvl & UART_RXFIFO_FULL_THRHD) << UART_RXFIFO_FULL_THRHD_S));
  }

  //clear all interrupt
  WRITE_PERI_REG(UART_INT_CLR(uart_no), 0xffff);
}
开发者ID:karlpilkington,项目名称:esp-rfm69,代码行数:63,代码来源:uart.c


示例18: user_plug_init

void ICACHE_FLASH_ATTR user_plug_init() {
	uint8 i;
	
	for (i=0; i<PLUG_LED_COUNT; i++) {
		PIN_FUNC_SELECT(plug_led_hardware[i].gpio_name, plug_led_hardware[i].gpio_func);
	}
	PIN_FUNC_SELECT(plug_reset_hardware.gpio_name, plug_reset_hardware.gpio_func);
	
	plug_init();
	plug_wifi_blink_start();
}
开发者ID:toome123,项目名称:ESP8266,代码行数:11,代码来源:user_plug.c


示例19: spi_gpio_init

//init the two intr line of slave
//gpio0: wr_ready ,and
//gpio2: rd_ready , controlled by slave
static void ICACHE_FLASH_ATTR
spi_gpio_init(void)
{

    PIN_FUNC_SELECT(PERIPHS_IO_MUX_GPIO0_U, FUNC_GPIO0);
    PIN_FUNC_SELECT(PERIPHS_IO_MUX_GPIO2_U, FUNC_GPIO2);
    //PIN_FUNC_SELECT(PERIPHS_IO_MUX_GPIO4_U, FUNC_GPIO4);
    GPIO_OUTPUT_SET(0, 1);
    GPIO_OUTPUT_SET(2, 0);
    //GPIO_OUTPUT_SET(4, 1);
}
开发者ID:taiyuanfang,项目名称:Espressif,代码行数:14,代码来源:spi.c


示例20: spicommon_cs_initialize

void spicommon_cs_initialize(spi_host_device_t host, int cs_io_num, int cs_num, int force_gpio_matrix)
{
    if (!force_gpio_matrix && cs_io_num == io_signal[host].spics0_native && cs_num == 0) {
        //The cs0s for all SPI peripherals map to pin mux source 1, so we use that instead of a define.
        PIN_FUNC_SELECT(GPIO_PIN_MUX_REG[cs_io_num], 1);
    } else {
        //Use GPIO matrix
        PIN_FUNC_SELECT(GPIO_PIN_MUX_REG[cs_io_num], PIN_FUNC_GPIO);
        gpio_matrix_out(cs_io_num, io_signal[host].spics_out[cs_num], false, false);
        if (cs_num == 0) gpio_matrix_in(cs_io_num, io_signal[host].spics_in, false);
    }
}
开发者ID:mr-nice,项目名称:esp-idf,代码行数:12,代码来源:spi_common.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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