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

C++ PIN_CLEAR函数代码示例

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

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



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

示例1: spi_send

uint8_t 
spi_send(uint8_t outdata)
{
  DDR_CONFIG_IN(SOFT_SPI_MISO);

  uint8_t j, indata = indata;
  for(j = 0; j < 8; j++)
  {
    if(outdata & 0x80)
      PIN_SET(SOFT_SPI_MOSI);
    else
      PIN_CLEAR(SOFT_SPI_MOSI);

    PIN_SET(SOFT_SPI_SCK);
    indata <<= 1;

    if(PIN_HIGH(SOFT_SPI_MISO))
      indata |= 1;

    PIN_CLEAR(SOFT_SPI_SCK);

    outdata <<= 1;
  }

  DDR_CONFIG_OUT(SOFT_SPI_MISO);
  return indata;
}
开发者ID:1234tester,项目名称:ethersex,代码行数:27,代码来源:soft_spi.c


示例2: hd44780_hw_init

void noinline hd44780_hw_init(void)
{
    /* init io pins */
    CTRL_OUTPUT();
#ifdef HAVE_LCDON
    PIN_SET(LCDON);
#endif

    PIN_CLEAR(HD44780_RS);
#ifndef HD44780_MULTIENSUPPORT
    PIN_CLEAR(HD44780_EN1);
#endif
#ifdef HD44780_MULTIENSUPPORT
    PIN_CLEAR(HD44780_EN1);
    PIN_CLEAR(HD44780_EN2);
#endif
#ifdef HAVE_HD44780_RW
    PIN_CLEAR(HD44780_RW);
#endif
    PIN_CLEAR(HD44780_D4);
    PIN_CLEAR(HD44780_D5);
    PIN_CLEAR(HD44780_D6);
    PIN_CLEAR(HD44780_D7);
    DATA_OUTPUT();

#ifdef HD44780_BACKLIGHT_SUPPORT
    PIN_CLEAR(HD44780_BL);
#endif
}
开发者ID:1234tester,项目名称:ethersex,代码行数:29,代码来源:hd44780.c


示例3: shift_nibble_out

void noinline shift_nibble_out(uint8_t data)
{
// 	HD44780DEBUG("try to send: %X\n", data);
    uint8_t mask = 0x08;

    for (uint8_t n = 4; n > 0; n--) // Do this for 4 databits
    {
// 		HD44780DEBUG("send %i bit: %X\n", n, data & mask );
        if (data & mask) // Set or reset data signal
            PIN_SET(HD44780_2WIRE_D);
        else
            PIN_CLEAR(HD44780_2WIRE_D);
        PIN_SET(HD44780_2WIRE_CLK);
        LCD_DELAY();
        PIN_CLEAR(HD44780_2WIRE_CLK);
        mask >>= 1; // Shift right compare mask
    }

    // Clear data line, then do the last shift, Q7=1
    // Always clear data line before the last shift
    PIN_CLEAR(HD44780_2WIRE_D);

    PIN_SET(HD44780_2WIRE_CLK);
    LCD_DELAY();
    PIN_CLEAR(HD44780_2WIRE_CLK);
}
开发者ID:thkaiser,项目名称:ethersex,代码行数:26,代码来源:hd44780_2wire.c


示例4: leds_set_pin

static void leds_set_pin(leds_led_t led, bool on)
{
    switch( led ){
        case LED_0:
            if( on ){
                PIN_SET(LED_0);
            }else{
                PIN_CLEAR(LED_0);
            }
        break;
        case LED_1:
            if( on ){
                PIN_SET(LED_1);
            }else{
                PIN_CLEAR(LED_1);
            }
        break;
        case LED_2:
            if( on ){
                PIN_SET(LED_2);
            }else{
                PIN_CLEAR(LED_2);
            }
        break;
    }
}
开发者ID:atdotde,项目名称:luftschleuse2,代码行数:26,代码来源:leds.c


示例5: lome6_timersec

/*
* lome6 periodical countdown timer function
* counts down time in ~seconds since power button long is pressed (needed to prevent watchdog action)
* manages power on delay
*/
void lome6_timersec(void) {

	if (iCountdownTimer > 0) {

		iCountdownTimer--;
		if (iCountdownTimer <= 0)
			PIN_CLEAR(RELAIS_POWER);

	}
	
	// test power on delay counter
	// if server already on, dont do anything
	if (iPOD > 0 && PIN_HIGH(POWER_STATE)) {

		iPOD--;
		if (iPOD <= 0) {
		
			PIN_SET(RELAIS_POWER);
			_delay_ms(CONF_TIME2PRESS_POWER);
			PIN_CLEAR(RELAIS_POWER);
			
		}
		
	}

}
开发者ID:videopix,项目名称:ethersex,代码行数:31,代码来源:lome6.c


示例6: main

int main(void)
{
    uint8_t escaped = 0;
    leds_init();

    DDR_CONFIG_OUT(RS485_TX_PIN);
    DDR_CONFIG_OUT(RS485_NRX_PIN);

    PIN_CLEAR(RS485_TX_PIN);
    PIN_CLEAR(RS485_NRX_PIN);

    UBRR0 = UART_BAUD_SELECT(RS485_BITRATE,F_CPU);
    UCSR0B |= (1<<TXEN0) | (1<<RXEN0);

    UBRR1 = UART_BAUD_SELECT(RS485_BITRATE,F_CPU);
    UCSR1B |= (1<<TXEN1) | (1<<RXEN1);
    
    wdt_reset();
    PIN_SET(RS485_TX_PIN);
    PIN_SET(RS485_NRX_PIN);

    while(1){
        wdt_reset();
        if( (UCSR1A & (1<<RXC1)) ){
            uint8_t data = UDR1;
            if( escaped ){
                escaped = 0;
                if( data == 'R' ){
                    wdt_enable(WDTO_2S);
                    while(1);
                }
            }else{
               if( data == '\\' ){
                    escaped = 1;
                    continue;
                }
            }
            UDR0 = data;
            PIN_SET(RS485_TX_PIN);
            PIN_SET(RS485_NRX_PIN);
            //_delay_us(4);
            leds_tx();
            while( !(UCSR0A & (1<<TXC0)) );
            UCSR0A |= (1<<TXC0);
            leds_txend();
            //_delay_us(4);
            PIN_CLEAR(RS485_TX_PIN);
            PIN_CLEAR(RS485_NRX_PIN);
        }
        if( (UCSR0A & (1<<RXC0)) ){
            UDR1 = UDR0;
            leds_rx();
            while( !(UCSR1A & (1<<TXC1)) );
            UCSR1A |= (1<<TXC1);
            leds_rxend();
        }

    }
}
开发者ID:muccc,项目名称:uberbus,代码行数:59,代码来源:rs485bridge.c


示例7: initMMC

// Initialize MMC card
unsigned char initMMC (void)
{

  //raise SS and MOSI for 80 clock cycles
  //SendByte(0xff) 10 times with SS high
  //RAISE SS
  int i;

  // Port 5 Function           Dir       On/Off
  //         5.1-Dout          Out       0 - off    1 - On -> init in SPI_Init
  //         5.2-Din           Inp       0 - off    1 - On -> init in SPI_Init
  //         5.3-Clk           Out       -                 -> init in SPI_Init
  //         5.0-mmcCS         Out       0 - Active 1 - none Active
/*
  P5SEL |= 0x0E;
  P5SEL &= ~0x11;
  P5OUT |= 0x11;
  P5DIR |= 0x1B;
*/
  /*
  PIN_SET(port5_attr.sel, 0x0e, PIN_HI);
  PIN_CLEAR(port5_attr.sel, 0x01);
  PIN_SET(port5_attr.dir, 0x0B, PIN_HI);
  PIN_CLEAR(port5_attr.dir, 0x04);
  port_set_attr(5, 0x0f, &port5_attr);
  port_write(5, 0x01, PIN_HI);
  */
//  PIN_SET(port5_attr.sel, 0x0e, PIN_HI);
#ifndef PORT_WRITE
  mmcPower(MMC_ON);
  MMC_PWR_PDIR |=  MMC_CARD_PWR;
  MMC_PWR_PSEL &= ~MMC_CARD_PWR;
//  MMC_POUT |=  MMC_CS;
  CS_HIGH();
  MMC_PDIR |=  MMC_CS;
  MMC_PSEL &= ~MMC_CS;
#else  // !PORT_WRITE
  PIN_SET  (mmc_pwr_port_attr.dir, MMC_CARD_PWR, PIN_HI);
  PIN_CLEAR(mmc_pwr_port_attr.sel, MMC_CARD_PWR);
  port_set_attr(MMC_PWR_PORT, MMC_CARD_PWR, &mmc_pwr_port_attr);
  mmcPower(MMC_ON);
  PIN_CLEAR(mmc_port_attr.sel, MMC_CS);
  PIN_SET  (mmc_port_attr.dir, MMC_CS, PIN_HI);
  port_set_attr(MMC_PORT, MMC_CS, &mmc_port_attr);
  CS_HIGH();
  //port_write(5, 0x01, PIN_HI);
#endif // !PORT_WRITE

//  initSPI();
//  SPI_init();
  //initialization sequence on PowerUp
//  CS_HIGH();
  for(i=0;i<=9;i++)
    spiSendByte(0xff);

  mmc_error = MMC_SUCCESS;

  return (mmc_GoIdle());
}
开发者ID:MaxGekk,项目名称:ZigZag,代码行数:60,代码来源:mmc.c


示例8: leds_init

void leds_init(void)
{
    DDR_CONFIG_OUT(LED1); 
    DDR_CONFIG_OUT(LED2); 
    DDR_CONFIG_OUT(LED3); 
    PIN_CLEAR(LED1);
    PIN_CLEAR(LED2);
    PIN_CLEAR(LED3);
}
开发者ID:argv,项目名称:moodlamp-rf,代码行数:9,代码来源:leds.c


示例9: clear_shift_register

void clear_shift_register(void)
{
    PIN_CLEAR(HD44780_2WIRE_D);
    for (uint8_t a=7; a>0; a--)
    {
        PIN_SET(HD44780_2WIRE_CLK);
        LCD_DELAY();
        PIN_CLEAR(HD44780_2WIRE_CLK);
        LCD_DELAY();
    }
}
开发者ID:thkaiser,项目名称:ethersex,代码行数:11,代码来源:hd44780_2wire.c


示例10: eltakoms_init

void eltakoms_init(void)
{
  usart_init();

#if (USE_USART == 0 && defined(HAVE_RS485TE_USART0))
  PIN_CLEAR(RS485TE_USART0);  // disable RS485 transmitter for usart 0
#elif (USE_USART == 1  && defined(HAVE_RS485TE_USART1))
  PIN_CLEAR(RS485TE_USART1);  // disable RS485 transmitter for usart 1
#else
  #warning no RS485 transmit enable pin defined
#endif
  ELTAKOMS_DEBUG("init\n");
}
开发者ID:adlerweb,项目名称:ethersex,代码行数:13,代码来源:eltakoms.c


示例11: zbus_core_init

void
zbus_core_init(void)
{
    /* Initialize the usart module */
    usart_init();
    /* Enable RX/TX Swtich as Output */
    DDR_CONFIG_OUT(RS485_TX_PIN);
    DDR_CONFIG_OUT(RS485_NRX_PIN);
    usart(UCSR,B) = _BV(usart(RXCIE)) | _BV(usart(RXEN));
    /* Default is reciever enabled*/
    PIN_CLEAR(RS485_TX_PIN);
    PIN_CLEAR(RS485_NRX_PIN);
}
开发者ID:argv,项目名称:moodlamp-rf,代码行数:13,代码来源:zbusneu.c


示例12: sys_init

/* Инициализация портов */
void    sys_init()
{
    port_attr_t   port_attr;


    /* Настройка выхода на зелёный светодиод */
    PIN_SET( port_attr.dir, GREEN_PIN, PIN_HI );    /* Направление на вывод */
    PIN_CLEAR( port_attr.sel, GREEN_PIN );          /* Функция ввода/вывода */
    port_set_attr( GREEN_PORT, GREEN_PIN, &port_attr );
    port_write( GREEN_PORT, GREEN_PIN, PIN_LO );       /* По умолчанию гасим светодиод */

    /* Настройка выхода на красный светодиод */
    PIN_SET( port_attr.dir, RED_PIN, PIN_HI );    /* Направление на вывод */
    PIN_CLEAR( port_attr.sel, RED_PIN );          /* Функция ввода/вывода */
    port_set_attr( RED_PORT, RED_PIN, &port_attr );
    port_write( RED_PORT, RED_PIN, PIN_LO );       /* По умолчанию гасим светодиод */

    /* Настройка входа от геркона  */
    {   port_t  gercon_port = 0x00;
        event_type_t    event_type = 0;
        result_t    res = ENOSYS;    

        port_reset_iflag( GERCON_PORT, GERCON_PIN );

        PIN_CLEAR( port_attr.dir, GERCON_PIN );     /* Направление на ввод */
        PIN_CLEAR( port_attr.sel, GERCON_PIN );     /* Функция ввода/вывода */ 
        PIN_SET( port_attr.ie, GERCON_PIN, PIN_HI );    /* Разрешаем прерывания от кнопки */
        PIN_SET( port_attr.ies, GERCON_PIN, PIN_HI );   /* Ловим изменение с высокого на низкий уровень */ 
        port_set_attr( GERCON_PORT, GERCON_PIN, &port_attr );

        port_read( GERCON_PORT, GERCON_PIN, &gercon_port );

        /* Определение текущего состояния геркона */
        if( PIN_IS_SET( gercon_port, GERCON_PIN) ) {
            event_type = EV_TYPE_OPEN;
        } else {   
            PIN_SET( port_attr.ies, GERCON_PIN, PIN_LO );   /* Ловим изменение с низкого на высокий уровень */ 
            port_set_attr( GERCON_PORT, GERCON_PIN, &port_attr );
            event_type = EV_TYPE_CLOSE;
        }
        res = event_emit( PRIORITY_LOW, event_type, 0 );
        if( IS_ERROR(res) ) {
            /* Не смогли начать работу, зажигаем красный светодиод */
            port_write( RED_PORT, RED_PIN, PIN_HI );
        }
    }

    return;
}
开发者ID:MaxGekk,项目名称:ZigZag,代码行数:50,代码来源:ipmce_gercon.c


示例13: hd44780_hw_init

void noinline hd44780_hw_init(void)
{
    HD44780DEBUG("starte HW init\n");
    // set data direction to output & clear pins
    CTRL_OUTPUT();
    DATA_OUTPUT();

    PIN_CLEAR(HD44780_2WIRE_CLK);
    PIN_CLEAR(HD44780_2WIRE_D);

    _delay_ms(50); // Delay for power up time

    clear_shift_register();
    HD44780DEBUG("HW init finished\n");
}
开发者ID:thkaiser,项目名称:ethersex,代码行数:15,代码来源:hd44780_2wire.c


示例14: shift_data_out

void noinline
shift_data_out(uint8_t byte)
{
  for (uint8_t a = 8; a > 0; a--)
  {
    if ((byte & (1 << (a - 1))) != 0)
      PIN_SET(HD44780_SER_D);
    else
      PIN_CLEAR(HD44780_SER_D);

    PIN_SET(HD44780_SER_CLK);
    _delay_us(1);
    PIN_CLEAR(HD44780_SER_CLK);
  }
}
开发者ID:AnDann,项目名称:ethersex,代码行数:15,代码来源:hd44780_serlcd.c


示例15: sys_init

/* Инициализация прикладного объекта */
void    sys_init()
{
    port_attr_t   port_attr;
    /* Настройка ножки светодиода */

    PIN_SET( port_attr.dir, GREEN_LED, PIN_HI );    /* Направление на вывод */
    PIN_CLEAR( port_attr.sel, GREEN_LED);         /* Функция ввода/вывода */
    PIN_CLEAR( port_attr.ie, GREEN_LED);          /* Запрет прерываний */
    port_set_attr( LED_PORT, GREEN_LED, &port_attr );
    port_write( LED_PORT, GREEN_LED, PIN_LO );

    atimer_set( ASYNC_TIMER , atimer_counter() + WAIT_PERIOD );

    return;
}
开发者ID:MaxGekk,项目名称:ZigZag,代码行数:16,代码来源:hblink.c


示例16: fs20_init

void fs20_init(void)
{
    /* default: enabled */
    fs20_global.enable = 1;

#ifdef FS20_SEND_SUPPORT
    /* configure port pin for sending */
    DDR_CONFIG_OUT(FS20_SEND);
    PIN_CLEAR(FS20_SEND);
#endif

#ifdef FS20_RECEIVE_SUPPORT
    /* reset global data structures */
    //fs20_global.fs20.raw = 0;
    memset((void *)&fs20_global.fs20.datagram, 0, sizeof(fs20_global.fs20.datagram));

    /* configure port pin for use as input to the analoge comparator */
    DDR_CONFIG_IN(FS20_RECV);
    PIN_CLEAR(FS20_RECV);

    /* enable analog comparator,
     * use fixed voltage reference (1V, connected to AIN0)
     * reset interrupt flag (ACI)
     * enable interrupt
     */
    ACSR = _BV(ACBG) | _BV(ACI) | _BV(ACIE);

    /* configure timer2 for receiving fs20,
     * prescaler 128
     * overflow interrupt enabled */
    TC2_COUNTER_CURRENT = 0;
    TC2_PRESCALER_128;
    TC2_MODE_OFF;
    TC2_OUTPUT_COMPARE_NONE;
    TC2_INT_OVERFLOW_ON;

#ifdef FS20_RECEIVE_WS300_SUPPORT

    /* reset everything to zero */
    memset((void *)&fs20_global.ws300, 0, sizeof(fs20_global.ws300));
#endif
#endif

#ifdef FS20_RECV_PROFILE
    fs20_global.int_counter = 0;
    fs20_global.ovf_counter = 0;
#endif
}
开发者ID:athalonis,项目名称:ethersex,代码行数:48,代码来源:fs20.c


示例17: bootloader_info_entry_get

bl_info_entry_t* bootloader_info_entry_get(uint32_t* p_bl_info_page, bl_info_type_t type)
{
    if (mp_bl_info_page &&
        mp_bl_info_page->metadata.entry_header_length != 0xFF)
    {
        bootloader_info_header_t* p_header =
            (bootloader_info_header_t*)
            ((uint32_t) p_bl_info_page + ((bootloader_info_t*) p_bl_info_page)->metadata.metadata_len);
        uint32_t iterations = 0;
        bl_info_type_t iter_type = (bl_info_type_t) p_header->type;
        while (iter_type != type)
        {
            p_header = bootloader_info_iterate(p_header);
            if ((uint32_t) p_header > ((uint32_t) p_bl_info_page) + PAGE_SIZE ||
                (
                 (iter_type == BL_INFO_TYPE_LAST) &&
                 (iter_type != type)
                ) ||
                ++iterations > PAGE_SIZE / 2)
            {
                PIN_CLEAR(PIN_ENTRY_GET);
                return NULL; /* out of bounds */
            }
            iter_type = (bl_info_type_t) p_header->type;
        }
        return (bl_info_entry_t*) ((uint32_t) p_header + 4 * mp_bl_info_page->metadata.entry_header_length);
    }
    else
    {
        return NULL;
    }
}
开发者ID:glenne,项目名称:nRF51-ble-bcast-mesh,代码行数:32,代码来源:bootloader_info_app.c


示例18: door_init

void door_init(void)
{
    door_doorstate = 0;

    DDR_CONFIG_IN(DOOR_REED_CONTACT);
    PIN_SET(DOOR_REED_CONTACT);

    DDR_CONFIG_IN(DOOR_LOCK_BRIDGE);
    PIN_SET(DOOR_LOCK_BRIDGE);

    DDR_CONFIG_IN(DOOR_LOCK_UNLOCKED_CONTACT);
    PIN_SET(DOOR_LOCK_UNLOCKED_CONTACT);

    DDR_CONFIG_IN(DOOR_LOCK_LOCKED_CONTACT);
    PIN_SET(DOOR_LOCK_LOCKED_CONTACT);

    DDR_CONFIG_IN(DOOR_HANDLE_CONTACT);
    PIN_SET(DOOR_HANDLE_CONTACT);

    DDR_CONFIG_IN(DOOR_DOOR_OPEN_CONTACT);
    PIN_SET(DOOR_DOOR_OPEN_CONTACT);

    PIN_CLEAR(DOOR_LOCK);
    DDR_CONFIG_OUT(DOOR_LOCK);
}
开发者ID:atdotde,项目名称:luftschleuse2,代码行数:25,代码来源:door-1.c


示例19: send_sign

void
send_sign(uint8_t c){
  int8_t i;
  CWDEBUG ("cw: %X: ", c);
  if (c == 0) {
    _delay_ms(WORDBREAK);
  } else {

    for (i = 0; i < 8; i++) {
      if (c == 1) break;
      PIN_SET(CW);
      if ((c & 0x01) == 1 ) { // read lowest bit
  		CWDEBUG ("dah ");
        _delay_ms(DAH); // wait dah
      } else {
  		CWDEBUG ("dit ");
        _delay_ms(DIT); // wait dit
      }
      PIN_CLEAR(CW);
      _delay_ms(DIT); // wait dit during morse char
      c = c >> 1;  // right shift 
    }
  }  
  CWDEBUG (".\n");
  _delay_ms(DAH); // break between morce chars
}
开发者ID:kheinz57,项目名称:ethersex,代码行数:26,代码来源:cw.c


示例20: ST7626_reset

void ST7626_reset(void)
{
    PIN_CLEAR(ST7626_RESET);
    _delay_us(2);
    PIN_SET(ST7626_RESET);
    _delay_us(2);
}
开发者ID:AnDann,项目名称:ethersex,代码行数:7,代码来源:ST7626.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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