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


C++ TwoWire::begin方法代码示例

本文整理汇总了C++中TwoWire::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ TwoWire::begin方法的具体用法?C++ TwoWire::begin怎么用?C++ TwoWire::begin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TwoWire的用法示例。


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

示例1: prepare_pin

/* The "train" requested by servo motors is
 the minimal of 20ms. Our PWM allow us to have
 41.7Hz that means 23.98 ms.
 However the cypress does not offer a good angle
 resolution on this frequency and the user
 has option to operates the servos in 188Hz */
void Servo::prepare_pin(uint8_t pin)
{

	extern TwoWire Wire;

	Wire.begin();

	// let's use this function only to select the bit port
	// the datasheet is a little confusing regading this set

	analogWrite(pin, 1);

	// Select programmable PWM CLK source to 367.7 Hz
	Wire.beginTransmission(CYPRESS_I2C_ADDRESS);
	Wire.write(0x29);
	Wire.write(0x04);
	Wire.endTransmission();

	// Rising edge register
	Wire.beginTransmission(CYPRESS_I2C_ADDRESS);
	Wire.write(0x2a);
	Wire.write(0xff);
	Wire.endTransmission();

	// Set divider to get 47.4Hz freq.
	Wire.beginTransmission(CYPRESS_I2C_ADDRESS);
	Wire.write(0x2C);

	if (this->is188hz)
	Wire.write(0x02);
	else
	Wire.write(0x09);

	Wire.endTransmission();
}
开发者ID:00alis,项目名称:corelibs-edison,代码行数:41,代码来源:Servo.cpp

示例2: setupTone

void setupTone(int pin) {
  if (!globalToneSetupDone) {   
    Wire.begin();
    globalToneSetupDone = 1;
  }
  
  if (!toneSetupDone[pin]) {
    pinMode(pin, OUTPUT);
    analogWrite(pin, 1);
    toneSetupDone[pin] = 1;
  }  
}
开发者ID:shadowstrike114,项目名称:Arduino,代码行数:12,代码来源:Tone.cpp

示例3: NunchuckInitialize

static bool NunchuckInitialize(TwoWire& interface)
{
  interface.begin(); // join i2c bus as master

  interface.beginTransmission(0x52);// transmit to device 0x52
    interface.write((uint8_t)0xF0);// sends a zero.
    interface.write((uint8_t)0x55);// sends a zero.
    interface.write((uint8_t)0xFB);// sends a zero.
    interface.write((uint8_t)0x00);// sends a zero.
  interface.endTransmission();// stop transmitting

  return 1;
}
开发者ID:aethaniel,项目名称:ExperimentalCore-sam,代码行数:13,代码来源:wire_wii_nunchuck.cpp

示例4: MCP23018_Init

void MCP23018_Init(void)
{
	pinMode(MISC_INT_PIN, INPUT);	// MISC_INT configured as INPUT
	pinMode(MISC_RST_PIN, INPUT);	// MISC_RST configured as INPUT (OUTPUT LOW to RESET)
	pinMode(VEH_IO_INT_PIN, INPUT);
	pinMode(VEH_IO_RST_PIN, INPUT);

	MCP23018_Reset(DEV_MISC);
	MCP23018_Reset(DEV_VEH_IO);

	i2c.begin();

	MCP23018_Init_IOCON();

	// VEH IO INPUT pins (MISC_IN1:MISC_IN8) always inputs
	MCP23018_WRITE(DEV_VEH_IO, (uint8_t)IODIRA, (uint8_t)0xFFu);
}
开发者ID:jafo2128,项目名称:_CANcrusher_ARM,代码行数:17,代码来源:mcp23018.cpp


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