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


C++ PIN函数代码示例

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


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

示例1: run_node

int run_node(node_t* n, uint64_t lg2_pin_size, uint64_t pin_offs, void* pins) {
#define PIN(x) ((((x)+pin_offs)<<lg2_pin_size)+pins)
  const uint64_t pin_size = 1<<lg2_pin_size;
  int i;
  if(n->output_constant) {
    for(i=n->output0;i<n->outputN;i++) {
      memcpy(PIN(i),n->output_constant,pin_size);
    }
    return 0;
  } else if (n->function) {
    void* inputs  = PIN(n->input0);
    void* outputs = PIN(n->output0);
    n->function(inputs,outputs);
  } else if (n->subnodes) {
    pin_offs+=n->input0;
    node_t* subnode;
    for(i=0, subnode=n->subnodes; i<n->k; i++, subnode++) {
      run_node(subnode,lg2_pin_size,pin_offs,pins);
    }
    struct connection* cxn;
    for(i=0, cxn=n->cxn; i<n->ncxn; i++, cxn++)  {
      memcpy(PIN(cxn->to_pin),PIN(cxn->from_pin),pin_size);
    }
  } else {
    return -2;
  }
#undef PIN
}
开发者ID:davidad,项目名称:nodes,代码行数:28,代码来源:newnodes.c

示例2: REMOTE_get

u16 REMOTE_get(void)
{
  u08 i, tmp = 0;
  u08 time;
  u08 T2,T4;
  union u16convert code;

  loop_until_bit_is_set(PIN(REMOTE_PORT), REMOTE_BIT);  // skip leading signal

  TCCR0=4;        //update every 32us
  TCNT0 = 1;

  while (bit_is_set(PIN(REMOTE_PORT), REMOTE_BIT))
  {
    T2 = TCNT0;
    if (T2 >= 100)    // max wait time
      return 0;
  }
  
  // measure time T

  TCNT0 = 1;
  loop_until_bit_is_set(PIN(REMOTE_PORT), REMOTE_BIT);
  
  T2 = TCNT0;    // T is normally around 0E-10 hex = 15 -> 480 uS
  T2 = T2 * 2;
  // max time is 4T
  T4 = T2 * 2;    

  for (i = 0; i < 48; i++)
  {
    TCNT0 = 1;
    while(1)
    {
      time = TCNT0;
      if (time > T4)
        return 0;
      
      // measure time on the lo flank
      if (bit_is_clear(PIN(REMOTE_PORT), REMOTE_BIT))
      {
        tmp <<= 1;
        if (time >= T2)
          tmp++;
        break;
      }
    }

    // save command data as we go
    if( i == 39)
      code.bytes.low = tmp;

    if( i == 47)
      code.bytes.high = tmp;
    
    // syncronize - wait for next hi flank
    loop_until_bit_is_set(REMOTE_PORT - 2, REMOTE_BIT);
  }
  return code.value;
}
开发者ID:Fakiros,项目名称:PR0021,代码行数:60,代码来源:get.c

示例3: target_early_init

void target_early_init(void)
{
	// UART1 on P6.4 (TX) and P2.1 (RX)
	// LpcXpresso4337 P4 FTDI header
	pin_config(PIN(6,4), PIN_MODE(2) | PIN_PLAIN);
	pin_config(PIN(2,1), PIN_MODE(1) | PIN_PLAIN | PIN_INPUT);
}
开发者ID:cpizano,项目名称:lk,代码行数:7,代码来源:init.c

示例4: CurrentSensor

		CurrentSensor():
			current_adc(
				AD7685<2>(PIN(F, 12), SPI_CHANNEL4, PIN(F, 12), // Convert & CS are same pin
				AD7685<2>::CHAIN_MODE_NO_BUSY)),
			currents(0)
		{
		}
开发者ID:DIYzzuzpb,项目名称:sc6-pic32-code,代码行数:7,代码来源:currentsensor.hpp

示例5: BPS

		BPS(): Nu32(Nu32::V2011),
		// Initialize hardware
			nu32			(Nu32::V2011),
			ground_relay	(PIN(D, 1), false),
			power_relay		(PIN(D, 2), false),
			motor_relay		(PIN(D, 3), false),
			array_relay		(PIN(D, 4), false),
			bypass_button	(PIN(B, 0)), // thru B5
			common_can		(CAN1),
			common_can_in	(common_can, CAN_CHANNEL0),
			common_can_out	(common_can, CAN_CHANNEL1),
			common_can_err	(common_can, CAN_CHANNEL2),
			// lcd1			(PIN(G, 9), SPI_CHANNEL2, PIN(A, 9),  PIN(E, 9)),
			// lcd2			(PIN(E, 8), SPI_CHANNEL2, PIN(A, 10), PIN(E, 9)),
			voltage_sensor	(),
			current_sensor	(),
			//temp_sensor		(),
		// initialize timers
			dc_can_timeout		(NU_BPS_DC_TIMEOUT_INT_MS,	Timer::ms,	true),
			precharge_timer		(NU_BPS_PRECHARGE_TIME_MS,	Timer::ms,	false),
			can_timer			(NU_BPS_CAN_TIMER_MS,		Timer::ms,	true),
			lcd_timer			(1,							Timer::s,	false),
			can_module_i(0),
		// and data
			state()
		{
		}
开发者ID:nusolar,项目名称:sc6-pic32-code,代码行数:27,代码来源:bps.hpp

示例6: main

/******************************* Main Program Code *************************/
int main(void)
{
// enable motor#1
    DDRA = 0b00001100;
    
// initialize the LCD controller as determined by the defines (LCD instructions)
    lcd_init_4d();                                  // initialize the LCD display for a 4-bit interface

// endless loop
    while(1) {
		lcd_clear_line_4d(lcd_LineOne);
		_delay_ms(500);
    	// display the first line of information
		lcd_write_string_line_4d("Motor Clockwise", lcd_LineOne);
		// rotate motor
	    UNSET(PORTA, PIN(2));
	    SET(PORTA, PIN(3));
	    // clear LCD
		lcd_clear_line_4d(lcd_LineTwo);
		_delay_ms(500);
    	// display the first line of information
		lcd_write_string_line_4d("Counter Clockwiz", lcd_LineTwo);
		// rotate motor
	    SET(PORTA, PIN(2));
	    UNSET(PORTA, PIN(3));
    }
    return 0;
}
开发者ID:Yvaine,项目名称:M.S-P.P,代码行数:29,代码来源:motor-lcd.c

示例7: LGetValue

static inline base_t LGetValue (void)
{
	base_t Value;

	Value = PIN(LEDS_PORT_HIGH) & (LED4|LED5|LED6|LED7);
	Value |= ((PIN(LEDS_PORT_LOW) & (LED0|LED1|LED2|LED3))>>4);
	return Value;
}
开发者ID:M-Marton,项目名称:oe-kvk-tbird,代码行数:8,代码来源:leds.c

示例8: GPS_Init

bool GPS_Init(void) {
	// Initialize pins
	TRACE_INFO("GPS  > Init pins");
	palSetPadMode(PORT(GPS_RESET), PIN(GPS_RESET), PAL_MODE_OUTPUT_PUSHPULL);	// GPS reset
	palSetPadMode(PORT(GPS_EN), PIN(GPS_EN), PAL_MODE_OUTPUT_PUSHPULL);			// GPS off
	palSetPadMode(PORT(GPS_TIMEPULSE), PIN(GPS_TIMEPULSE), PAL_MODE_INPUT);		// GPS timepulse

	// Switch MOSFET
	TRACE_INFO("GPS  > Switch on");
	palSetPad(PORT(GPS_RESET), PIN(GPS_RESET));	// Pull up GPS reset
	palSetPad(PORT(GPS_EN), PIN(GPS_EN));		// Switch on GPS
	
	// Wait for GPS startup
	chThdSleepMilliseconds(3000);

	uint8_t status = 1;

	// Configure GPS
	TRACE_INFO("GPS  > Initialize GPS");
	if(gps_disable_nmea_output()) {
		TRACE_INFO("GPS  > Disable NMEA output OK");
	} else {
		TRACE_ERROR("GPS  > Disable NMEA output FAILED");
		status = 0;
	}

	#if GPS_TYPE == MAX7 || GPS_TYPE == MAX8
	// MAX6 does not support anything else than GPS
	if(gps_set_gps_only()) {
		TRACE_INFO("GPS  > Set GPS only OK");
	} else {
		TRACE_ERROR("GPS  > Set GPS only FAILED");
		status = 0;
	}
	#endif

	if(gps_set_airborne_model()) {
		TRACE_INFO("GPS  > Set airborne model OK");
	} else {
		TRACE_ERROR("GPS  > Set airborne model FAILED");
		status = 0;
	}
	if(gps_set_power_save()) {
		TRACE_INFO("GPS  > Configure power save OK");
	} else {
		TRACE_ERROR("GPS  > Configure power save FAILED");
		status = 0;
	}
	if(gps_power_save(0)) {
		TRACE_INFO("GPS  > Disable power save OK");
	} else {
		TRACE_ERROR("GPS  > Disable power save FAILED");
		status = 0;
	}

	return status;
}
开发者ID:CInsights,项目名称:pecan-stm32f429,代码行数:57,代码来源:max.c

示例9: SystemSetupStuff

void SystemSetupStuff(void)
{
    LPC_SC->PCONP |= PCONP_PCGPIO;              // power up GPIO
    LPC_GPIO1->FIODIR |= PIN(25);               // p1.25 Pwr on set output
    LPC_GPIO1->FIOPIN |= PIN(25);               // p1.25 Keep pwr on

    // Configure Power button
    LPC_PINCON->PINMODE3 |= (PINMODE_PULLDOWN << 24);      // Pullup
}
开发者ID:Damme,项目名称:LandLord,代码行数:9,代码来源:main.c

示例10: lcd_readHalf

//----------------------------------------------------------------------------------------
//
//		 Odczyt po��wki bajtu z LCD (D4..D7)
//
//----------------------------------------------------------------------------------------
static inline uint8_t lcd_readHalf(void)
{
	uint8_t result=0;

	if(PIN(LCD_D4PORT)&(1<<LCD_D4)) result |= (1<<0);
	if(PIN(LCD_D5PORT)&(1<<LCD_D5)) result |= (1<<1);
	if(PIN(LCD_D6PORT)&(1<<LCD_D6)) result |= (1<<2);
	if(PIN(LCD_D7PORT)&(1<<LCD_D7)) result |= (1<<3);

	return result;
}
开发者ID:rungokarol,项目名称:AquariumAVR,代码行数:16,代码来源:lcd44780.c

示例11: uint16

bool XML_ColorParser::HandleAttribute(const char *Tag, const char *Value)
{
	// Color value to be read in
	float CVal;
	
	if (NumColors > 0)
	{
	if (StringsEqual(Tag,"index"))
	{
		if (ReadBoundedInt16Value(Value,Index,0,NumColors-1))
		{
			IsPresent[3] = true;
			return true;
		}
		else return false;
	}
	}
	if (StringsEqual(Tag,"red"))
	{
		if (ReadFloatValue(Value,CVal))
		{
			IsPresent[0] = true;
			TempColor.red = uint16(PIN(65535*CVal+0.5,0,65535));
			return true;
		}
		else return false;
	}
	else if (StringsEqual(Tag,"green"))
	{
		if (ReadFloatValue(Value,CVal))
		{
			IsPresent[1] = true;
			TempColor.green = uint16(PIN(65535*CVal+0.5,0,65535));
			return true;
		}
		else return false;
	}
	else if (StringsEqual(Tag,"blue"))
	{
		float CVal;
		if (ReadFloatValue(Value,CVal))
		{
			IsPresent[2] = true;
			TempColor.blue = uint16(PIN(65535*CVal+0.5,0,65535));
			return true;
		}
		else return false;
	}
	UnrecognizedTag();
	return false;
}
开发者ID:Aleph-One-Marathon,项目名称:alephone-psp,代码行数:51,代码来源:ColorParser.cpp

示例12: lassort

int lassort(libmaus2::util::ArgParser const & arg, libmaus2::util::ArgInfo const &)
{
	std::string const outfilename = arg[0];
	std::vector<std::string> VI;
	for ( uint64_t i = 1 ; i < arg.size(); ++i )
		VI.push_back(arg[i]);
	int64_t const tspace = libmaus2::dazzler::align::AlignmentFile::getTSpace(VI);

	libmaus2::dazzler::align::AlignmentWriter::unique_ptr_type AW(
		new libmaus2::dazzler::align::AlignmentWriter(outfilename,tspace,false /* index */, 0 /* expt */)
	);

	libmaus2::dazzler::align::Overlap OVL;
	for ( uint64_t i = 0; i < VI.size(); ++i )
	{
		libmaus2::dazzler::align::AlignmentFileRegion::unique_ptr_type PIN(libmaus2::dazzler::align::OverlapIndexer::openAlignmentFileWithoutIndex(VI[i]));

		std::vector < libmaus2::dazzler::align::Overlap > VOVL;
		while ( PIN->getNextOverlap(OVL) )
		{
			if ( VOVL.size() && VOVL[0].aread != OVL.aread )
				handleVector(VOVL,*AW);
			VOVL.push_back(OVL);
		}
		handleVector(VOVL,*AW);
	}

	AW.reset();

	return EXIT_SUCCESS;
}
开发者ID:gt1,项目名称:lastools,代码行数:31,代码来源:lasmarkprimary.cpp

示例13: s6b0108_inbyte

uint8_t s6b0108_inbyte(uint8_t rs)
{
	uint8_t x;

	if(rs) s6b0108_wait_ready();
	DDR(S6B0108_PDATA)=INPUT;
	PORT(S6B0108_PDATA)=0x00;
	_delay_us(0.3);
	if (rs)
	{	// reading data
		PORT(S6B0108_PCMD) |= (_BV(RW) | _BV(RS));
		_delay_us(0.2);
		//first access is to copy display data to display output register
		PORT(S6B0108_PCMD) |= _BV(E);
		_delay_us(2.0); 
		PORT(S6B0108_PCMD) &= ~_BV(E);
		_delay_us(3.0); // 0.5 should be enough but doesn't work
	}
	else
	{	// reading status
		PORT(S6B0108_PCMD) |= _BV(RW);
		PORT(S6B0108_PCMD) &= ~_BV(RS);
		_delay_us(0.2);
	}
	PORT(S6B0108_PCMD) |= _BV(E);
	_delay_us(2.0); // 0.32 should be enough but doesn't work
 	x = PIN(S6B0108_PDATA);
	_delay_us(0.2);
	PORT(S6B0108_PCMD) &= ~_BV(E);

	PORT(S6B0108_PCMD) &= ~( _BV(RS) | _BV(RW) | _BV(E) );
	return x;
}
开发者ID:xtensa,项目名称:xarias,代码行数:33,代码来源:s6b0108.c

示例14: spi_rw_byte

uint8_t spi_rw_byte(uint8_t outgoing)
{
    uint8_t i, incoming;
    incoming = 0;

    //Send outgoing byte
    for(i = 0 ; i < 8 ; i++)
    {
        //send from MSB to LSB
        if(outgoing & 0b10000000)
	    PORT(MOSIPORT) |= BV(MOSIPIN);	   
        else
	    PORT(MOSIPORT) &= ~BV(MOSIPIN);
        
        PORT(SCKPORT) |= BV(SCKPIN);  //SPI_CLK = 1;
        _delay_us(RF_DELAY);

        //MISO bit is valid after clock goes going high
        incoming <<= 1;
        if( PIN(MISOPORT) & (1<<MISOPIN) ) incoming |= 0x01;

        PORT(SCKPORT) &= ~BV(SCKPIN);  //SPI_CLK = 0; 
        _delay_us(RF_DELAY);
        
        outgoing <<= 1;
    }

    return(incoming);
}
开发者ID:hummingbird2012,项目名称:hummingbird,代码行数:29,代码来源:spi.c

示例15: wait_ready

static void wait_ready(void)
{
    /*
    _delay_ms(1);
    return;
    */
    uint8_t flag;
    lcdPrepareRead();
    CMD_RS0();
    do
    {
        CMD_E_MARK();
        CMD_E_DELAY();
        flag = PIN(LCD_D7);
        CMD_E_RELEASE();
        CMD_E_DELAY();
        wdr();
    } while(flag);
    lcdPrepareWrite();
    /*
    uint16_t i;
    for(i=0; i<2000; i++)
        asm volatile ("nop");
    */
}
开发者ID:plumbum,项目名称:easyface,代码行数:25,代码来源:lcd.c


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