本文整理汇总了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();
}
示例2: setupTone
void setupTone(int pin) {
if (!globalToneSetupDone) {
Wire.begin();
globalToneSetupDone = 1;
}
if (!toneSetupDone[pin]) {
pinMode(pin, OUTPUT);
analogWrite(pin, 1);
toneSetupDone[pin] = 1;
}
}
示例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;
}
示例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);
}