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


C++ writeTo函数代码示例

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


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

示例1: initAcc

/* =================================================
FUNCTION: initAcc

CREATED: 16-05-2014

DESCRIPTION: initializes the sensor

PARAMETERS: None

GLOBAL VARIABLES: None.

RETURNS: None.

AUTHOR: P. Kantue

================================================== */
void initAcc() {
  //Turning on the ADXL345
  writeTo(ACC, 0x2D, 0);      
  writeTo(ACC, 0x2D, 16);
  writeTo(ACC, 0x2D, 8);
  //by default the device is in +-2g range reading
}
开发者ID:pkantue,项目名称:Arduino,代码行数:23,代码来源:AP_IMU.cpp

示例2: initGyro

/* =================================================
FUNCTION: initGyro

CREATED: 16-05-2014

DESCRIPTION: initializes the sensor

PARAMETERS: None

GLOBAL VARIABLES: None.

RETURNS: None.

AUTHOR: P. Kantue

================================================== */
void initGyro()
{
  writeTo(GYRO, G_PWR_MGM, 0x00);
  writeTo(GYRO, G_SMPLRT_DIV, 0x07); // EB, 50, 80, 7F, DE, 23, 20, FF
  writeTo(GYRO, G_DLPF_FS, 0x1E); // Full Scale Range +/- 2000 deg/sec, 1KHz, 1E, 19
  writeTo(GYRO, G_INT_CFG, 0x00);
}
开发者ID:pkantue,项目名称:Arduino,代码行数:23,代码来源:AP_IMU.cpp

示例3: bus

void Accelerometer::powerOn() {
  Wire.begin();        // join i2c bus (address optional for master)
  //Turning on the ADXL345
  writeTo(DEVICE, ADXL345_POWER_CTL, 0);      
  writeTo(DEVICE, ADXL345_POWER_CTL, 16);
  writeTo(DEVICE, ADXL345_POWER_CTL, 8); 
}
开发者ID:jeerawat51,项目名称:adxl345-arduino,代码行数:7,代码来源:Adxl345.cpp

示例4: begin

void CAdxl345::powerOn() {
	begin(); // enable I2C Bus

	//Turning on the ADXL345
	writeTo(DEVICE, ADXL345_POWER_CTL, 0);
	writeTo(DEVICE, ADXL345_POWER_CTL, 16);
	writeTo(DEVICE, ADXL345_POWER_CTL, 8);
}
开发者ID:brucetsao,项目名称:nano1768,代码行数:8,代码来源:adxl345.cpp

示例5: writeTo

void Sensors::initMagnetometer()
{
  // Enable the magnetometer
  writeTo(HMC5883_ADDRESS_MAG, HMC5883_REGISTER_MAG_MR_REG_M, 0x00);
  
  // Set the gain to +/-1.3 (max sensitivity)  
  writeTo(HMC5883_ADDRESS_MAG, HMC5883_REGISTER_MAG_CRB_REG_M, 0x20);
}  
开发者ID:cazacov,项目名称:webdev,代码行数:8,代码来源:sensors.cpp

示例6: be_child

/* does not return */
void be_child(int fd_from_master, int fd_to_master) { 
	int start = 0, end = 0;

	while (1) {
		writeTo(fd_to_master, &start);
		writeTo(fd_to_master, &end);

		/* got EOF from master = exit */
		if (readFrom(fd_from_master, &start) == 0) exit(0);
		if (readFrom(fd_from_master, &end) == 0) exit(0);

		doit(start, end);
	}
}
开发者ID:chichichap,项目名称:C,代码行数:15,代码来源:findprimes.c

示例7: writeTo

void IMU3000::setSampleRate(byte divider, byte lowpass)
{
	//writing divider
	writeTo(IMU3000_REG_SMPLRT_DIV,divider);

	//writing lowpass rate freq
	byte lpf;
	readFrom(IMU3000_REG_DLPF, 1, &lpf);
	
	lpf &= ~IMU3000_DLPF_CFG_MASK;
	lpf |= lowpass;

	writeTo(IMU3000_REG_DLPF, lpf);  

}
开发者ID:abderrahmene,项目名称:IMU3000,代码行数:15,代码来源:IMU3000.cpp

示例8: writeTo

ISCORE_PLUGIN_SCENARIO_EXPORT void Visitor<Writer<DataStream>>::writeTo(Scenario::StateModel& s)
{
    // Common metadata
    writeTo(s.metadata);

    m_stream >> s.m_eventId
            >> s.m_previousConstraint
            >> s.m_nextConstraint
            >> s.m_heightPercentage;

    // Message tree
    Process::MessageNode n;
    m_stream >> n;
    s.m_messageItemModel = new Scenario::MessageItemModel{s.m_stack, s, &s};
    s.messages() = n;

    // Processes plugins
    int32_t process_count;
    m_stream >> process_count;
    auto& pl = context.components.factory<Process::StateProcessList>();
    for(; process_count -- > 0;)
    {
        s.stateProcesses.add(deserialize_interface(pl, *this, &s));
    }


    checkDelimiter();
}
开发者ID:rperrot,项目名称:i-score,代码行数:28,代码来源:StateModelSerialization.cpp

示例9: getValue

std::string Element::toString() const {
    if (!ok())
        return "INVALID-MUTABLE-ELEMENT";

    if (hasValue())
        return getValue().toString();

    const BSONType type = getType();

    // The only types that sometimes don't have a value are Object and Array nodes.
    dassert((type == mongo::Object) || (type == mongo::Array));

    if (type == mongo::Object) {
        BSONObjBuilder builder;
        writeTo(&builder);
        BSONObj obj = builder.obj();
        return obj.firstElement().toString();
    } else {
        // It must be an array.
        BSONObjBuilder builder;
        BSONArrayBuilder arrayBuilder(builder.subarrayStart(getFieldName()));
        writeArrayTo(&arrayBuilder);
        arrayBuilder.done();
        BSONObj obj = builder.obj();
        return obj.firstElement().toString();
    }
}
开发者ID:ShaneHarvey,项目名称:mongo,代码行数:27,代码来源:element.cpp

示例10: writeTo

template<> void Visitor<Writer<JSONObject>>::writeTo(Scenario::BaseScenario& base_scenario)
{
    writeTo(static_cast<Scenario::BaseScenarioContainer&>(base_scenario));

    Deserializer<JSONValue> elementPluginDeserializer(m_obj["PluginsMetadata"]);
    base_scenario.pluginModelList = iscore::ElementPluginModelList{elementPluginDeserializer, &base_scenario};
}
开发者ID:Sciss,项目名称:i-score,代码行数:7,代码来源:BaseScenarioSerialization.cpp

示例11: BYTES_TO_BLOCKS

		void Node::resize(NodeSize newSize) {
			if (size() == newSize) return;
			
			hasChanged_ = true;
			
			// Flush all data blocks, so that IDs of
			// deleted blocks aren't updated incorrectly
			// at some later time.
			cache_.flush();
			
			const size_t oldBlockCount = BYTES_TO_BLOCKS(size());
			const size_t newBlockCount = BYTES_TO_BLOCKS(newSize);
			
			// Set the size field.
			BlockWriter sizeWriter(cache_.getWriteBlock(BlockPath::Root()), NODE_SIZE_OFFSET);
			Binary::WriteUint64(sizeWriter, newSize);
			
			size_ = newSize;
			
			// Replace block IDs with zero for deleted blocks.
			if (oldBlockCount > newBlockCount) {
				const auto zeroId = BlockId::Zero();
				
				for (size_t i = newBlockCount; i < oldBlockCount; i++) {
					const auto path = BlockPath::Index(i);
					auto& parentBlock = cache_.getWriteBlock(path.parent());
					BlockWriter writer(parentBlock, NodeBlockIdOffset(path));
					zeroId.writeTo(writer);
				}
			}
		}
开发者ID:JuanCabre,项目名称:openp2p,代码行数:31,代码来源:Node.cpp

示例12: MYASSERT

int ITG3200::setClockSource(byte _CLKsource) {   
  int a=0;
  a=readFrom( _dev_address,PWR_MGM, 1, &_buff[0]);
  MYASSERT(a,"Failed to read clock source\n\r")
  a=writeTo( _dev_address,PWR_MGM, ((_buff[0] & ~PWRMGM_CLK_SEL) | _CLKsource)); 
    MYASSERT(a,"Failed to write clock source\n\r")
    return 0;
  }
开发者ID:raymoss,项目名称:ProjectFalcon,代码行数:8,代码来源:ITG3200.cpp

示例13: readFrom

void CAdxl345::setRegisterBit(byte regAdress, int bitPos, bool state) {
	byte _b;
	readFrom(DEVICE, regAdress, 1, &_b);
	if (state) {
		_b |= (1 << bitPos); // forces nth bit of _b to be 1.  all other bits left alone.
	} else {
		_b &= ~(1 << bitPos); // forces nth bit of _b to be 0.  all other bits left alone.
	}
	writeTo(DEVICE, regAdress, _b);
}
开发者ID:brucetsao,项目名称:nano1768,代码行数:10,代码来源:adxl345.cpp

示例14: readFrom

void IMU3000::setRange(byte range)
{
	byte rng;
	readFrom(IMU3000_REG_DLPF, 1, &rng);
	
	rng &= ~IMU3000_FS_SEL_MASK;
	rng |= range;

	writeTo(IMU3000_REG_DLPF, rng);  
}
开发者ID:abderrahmene,项目名称:IMU3000,代码行数:10,代码来源:IMU3000.cpp

示例15: writeTo

/*
 * setGain method:
 * set HMC5883L_SCALE_FACTOR based on 'fieldRange' value
 * write to HMC5883L_ConfigurationRegisterB register the appropriate value for the specified 'fieldRange'
 */
void HMC5883L::setGain(float fieldRange)
{
	if (fieldRange==0.88) // Nominal gain configuration (HMC5883L_ConfigurationRegisterB)
	{
		HMC5883L_SCALE_FACTOR = (1000.0f / 1370.0f);
		writeTo(HMC5883L_ConfigurationRegisterB, 0x00);
	}
	else if (fieldRange==1.3)
	{
		HMC5883L_SCALE_FACTOR = (1000.0f / 1090.0f);
		writeTo(HMC5883L_ConfigurationRegisterB, 0x20);
	}
	else if (fieldRange==1.9)
	{
		HMC5883L_SCALE_FACTOR = (1000.0f / 820.0f);
		writeTo(HMC5883L_ConfigurationRegisterB, 0x40);
	}
	else if (fieldRange==2.5)
	{
		HMC5883L_SCALE_FACTOR = (1000.0f / 660.0f);
		writeTo(HMC5883L_ConfigurationRegisterB, 0x60);
	}
	else if (fieldRange==4.0)
	{
		HMC5883L_SCALE_FACTOR = (1000.0f / 440.0f);
		writeTo(HMC5883L_ConfigurationRegisterB, 0x80);
	}
	else if (fieldRange==4.7)
	{
		HMC5883L_SCALE_FACTOR = (1000.0f / 390.0f);
		writeTo(HMC5883L_ConfigurationRegisterB, 0xA0);
	}
	else if (fieldRange==5.6)
	{
		HMC5883L_SCALE_FACTOR = (1000.0f / 330.0f);
		writeTo(HMC5883L_ConfigurationRegisterB, 0xC0);
	}
	else if (fieldRange==8.1)
	{
		HMC5883L_SCALE_FACTOR = (1000.0f / 230.0f);
		writeTo(HMC5883L_ConfigurationRegisterB, 0xE0);
	}
	else // out of range - return to defaults // default configuration: field range 1.3Ga
	{
		HMC5883L_SCALE_FACTOR = (1000 / 1090);
		writeTo(HMC5883L_ConfigurationRegisterB, 0x20);
	}
}
开发者ID:gchinellato,项目名称:Self-Balance-Robot,代码行数:53,代码来源:GY80_HMC5883L.cpp


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