这篇教程C++ wiresend函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中wiresend函数的典型用法代码示例。如果您正苦于以下问题:C++ wiresend函数的具体用法?C++ wiresend怎么用?C++ wiresend使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了wiresend函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: wiresend/** * Writes a given register */void RFduinoProXShield::writeRegister(uint8_t regAddr, uint8_t regValue){ // Write the register Wire.beginTransmission(MCP23017_ADDRESS | i2caddr); wiresend(regAddr); wiresend(regValue); Wire.endTransmission();}
开发者ID:TechFirma,项目名称:RFduino-Pro-XShield-Library,代码行数:10,
示例2: wiresend/** * Writes all the pins in one go. This method is very useful if you are implementing a multiplexed matrix and want to get a decent refresh rate. */void Adafruit_MCP23017::writeGPIOAB(uint16_t ba) { Wire.beginTransmission(MCP23017_ADDRESS | i2caddr); wiresend(MCP23017_GPIOA); wiresend(ba & 0xFF); wiresend(ba >> 8); Wire.endTransmission();}
开发者ID:projetBTSMaisonIntelligente,项目名称:sweetHome,代码行数:10,
示例3: wiresend//-----------------------------------------------------// This function clear a single register// RegAdd = Register address// i2caddr = device address (0 to 7. See A0, A1 e A2 configurations)void MCP23017::ClearReg(uint8_t RegAdd, uint8_t i2caddr) { if (i2caddr > 7) { i2caddr = 7; } Wire.beginTransmission(MCP23017_HW_ADD | i2caddr); wiresend(RegAdd); wiresend(0x00); Wire.endTransmission(); }
开发者ID:pasuljG,项目名称:GestIC,代码行数:11,
示例4: UpdateArrayDataBank1 void MCP23017::SetAllRegBank1(uint8_t i2caddr) { uint8_t Count = 0; if (i2caddr > 7) { i2caddr = 7; } UpdateArrayDataBank1(); Wire.beginTransmission(MCP23017_HW_ADD | i2caddr); wiresend(MCP23017_BNK1_IODIRA); do { wiresend(ConfReg[Count]); } while (Count++ < sizeof(ConfReg)); Wire.endTransmission(); }
开发者ID:pasuljG,项目名称:GestIC,代码行数:12,
示例5: wiresendvoid Adafruit_MCP23017::begin(uint8_t addr) { if (addr > 7) { addr = 7; } i2caddr = addr; Wire.begin(); // set defaults! Wire.beginTransmission(MCP23017_ADDRESS | i2caddr); wiresend(MCP23017_IODIRA); wiresend(0xFF); // all inputs on port A Wire.endTransmission(); Wire.beginTransmission(MCP23017_ADDRESS | i2caddr); wiresend(MCP23017_IODIRB); wiresend(0xFF); // all inputs on port B Wire.endTransmission(); //default IOCON register pairs GPA and GPB interrupt outputs Wire.beginTransmission(MCP23017_ADDRESS | i2caddr); wiresend(MCP23017_IOCONA); wiresend(0x40); Wire.endTransmission(); Wire.beginTransmission(MCP23017_ADDRESS | i2caddr); wiresend(MCP23017_IOCONB); wiresend(0x40); Wire.endTransmission();}
开发者ID:skateone,项目名称:Adafruit-MCP23017-Arduino-Library,代码行数:31,
示例6: delayvoid Adafruit_NFCShield_I2C::wiresendcommand(uint8_t* cmd, uint8_t cmdlen) { uint8_t checksum; cmdlen++; #ifdef PN532DEBUG Serial.print("/nSending: ");#endif delay(2); // or whatever the delay is for waking up the board // I2C START Wire.beginTransmission(PN532_I2C_ADDRESS); checksum = PN532_PREAMBLE + PN532_PREAMBLE + PN532_STARTCODE2; wiresend(PN532_PREAMBLE); wiresend(PN532_PREAMBLE); wiresend(PN532_STARTCODE2); wiresend(cmdlen); wiresend(~cmdlen + 1); wiresend(PN532_HOSTTOPN532); checksum += PN532_HOSTTOPN532;#ifdef PN532DEBUG Serial.print(" 0x"); Serial.print(PN532_PREAMBLE, HEX); Serial.print(" 0x"); Serial.print(PN532_PREAMBLE, HEX); Serial.print(" 0x"); Serial.print(PN532_STARTCODE2, HEX); Serial.print(" 0x"); Serial.print(cmdlen, HEX); Serial.print(" 0x"); Serial.print(~cmdlen + 1, HEX); Serial.print(" 0x"); Serial.print(PN532_HOSTTOPN532, HEX);#endif for (uint8_t i=0; i<cmdlen-1; i++) { wiresend(cmd[i]); checksum += cmd[i];#ifdef PN532DEBUG Serial.print(" 0x"); Serial.print(cmd[i], HEX);#endif } wiresend(~checksum); wiresend(PN532_POSTAMBLE); // I2C STOP Wire.endTransmission();#ifdef PN532DEBUG Serial.print(" 0x"); Serial.print(~checksum, HEX); Serial.print(" 0x"); Serial.print(PN532_POSTAMBLE, HEX); Serial.println();#endif}
开发者ID:logic-fault,项目名称:ethernet-QEL,代码行数:53,
示例7: wiresend//Added to default library//From the Adafruit_RGBLCDShield library we learn that the//buttons are on bits 0..4, which are on GPIOA,//so we use GPINTENA, INTCONA and IOCONA.void Adafruit_MCP23017::enableButtonInterrupt() { uint8_t data; //Enable the interrupts on the button pins 0..4 Wire.beginTransmission(MCP23017_ADDRESS | i2caddr); wiresend(MCP23017_GPINTENA); Wire.endTransmission(); Wire.requestFrom(MCP23017_ADDRESS | i2caddr, 1); data = wirerecv(); data |= 0x1F; //Bits 0..4 high, to enable IOC //Write the new value back Wire.beginTransmission(MCP23017_ADDRESS | i2caddr); wiresend(MCP23017_GPINTENA); wiresend(data); Wire.endTransmission(); //We set INTCONA bits 0..4 to 0 = State change interrupt //(instead of compare to state) Wire.beginTransmission(MCP23017_ADDRESS | i2caddr); wiresend(MCP23017_INTCONA); Wire.endTransmission(); Wire.requestFrom(MCP23017_ADDRESS | i2caddr, 1); data = wirerecv(); data &= ~0x1F; //Force bits 0..4 to low //Write the new value back Wire.beginTransmission(MCP23017_ADDRESS | i2caddr); wiresend(MCP23017_INTCONA); wiresend(data); Wire.endTransmission(); //We set the INTA pin to Active-Low //first read current register value Wire.beginTransmission(MCP23017_ADDRESS | i2caddr); wiresend(MCP23017_IOCONA); Wire.endTransmission(); Wire.requestFrom(MCP23017_ADDRESS | i2caddr, 1); data = wirerecv(); //Bit 1 = INTPOL = Low = Active-Low //(When disabled or no interrupt, signal is high) data &= ~0x02; //Bit 2 = ODR = Low = Open Drain disabled data &= ~0x04; //Bit 6 = MIRROR = Low = INTA/INTB seperate data &= ~0x40; //Write the new value back Wire.beginTransmission(MCP23017_ADDRESS | i2caddr); wiresend(MCP23017_IOCONA); wiresend(data); Wire.endTransmission();}
开发者ID:amair,项目名称:Adafruit-RGB-LCD-Shield-Library,代码行数:57,
示例8: wiresendvoid MCP23017::begin(uint8_t addr) { if (addr > 7) { addr = 7; } i2caddr = addr; Wire.begin(); // set defaults! Wire.beginTransmission(MCP23017_ADDRESS | i2caddr); wiresend(MCP23017_IODIRA); wiresend(0xFF); // all inputs on port A Wire.endTransmission(); Wire.beginTransmission(MCP23017_ADDRESS | i2caddr); wiresend(MCP23017_IODIRB); wiresend(0xFF); // all inputs on port B Wire.endTransmission();}
开发者ID:jameslyden,项目名称:ino-libs,代码行数:20,
示例9: wiresendvoid MCP23017::digitalWrite(uint8_t p, uint8_t d) { uint8_t gpio; uint8_t gpioaddr, olataddr; // only 16 bits! if (p > 15) return; if (p < 8) { olataddr = MCP23017_OLATA; gpioaddr = MCP23017_GPIOA; } else { olataddr = MCP23017_OLATB; gpioaddr = MCP23017_GPIOB; p -= 8; } // read the current GPIO output latches Wire.beginTransmission(MCP23017_ADDRESS | i2caddr); wiresend(olataddr); Wire.endTransmission(); Wire.requestFrom(MCP23017_ADDRESS | i2caddr, 1); gpio = wirerecv(); // set the pin and direction if (d == HIGH) { gpio |= 1 << p; } else { gpio &= ~(1 << p); } // write the new GPIO Wire.beginTransmission(MCP23017_ADDRESS | i2caddr); wiresend(gpioaddr); wiresend(gpio); Wire.endTransmission();}
开发者ID:Cabel-test,项目名称:Arduino-Cabel_test,代码行数:39,
示例10: wiresendvoid TLC59116::writeRegister(uint8_t reg, uint8_t val) { Wire.beginTransmission(TLC59116_BASEADDR | (_addr & 0x0F)); wiresend(reg); wiresend(val); Wire.endTransmission();}
开发者ID:MajenkoLibraries,项目名称:TLC59116,代码行数:6,
示例11: delayvoid LiquidTWI2::begin(uint8_t cols, uint8_t lines, uint8_t dotsize) { // SEE PAGE 45/46 FOR INITIALIZATION SPECIFICATION! // according to datasheet, we need at least 40ms after power rises above 2.7V // before sending commands. Arduino can turn on way befer 4.5V so we'll wait 50 delay(50); Wire.begin(); uint8_t result;#if defined(MCP23017)&&defined(MCP23008) if (_mcpType == LTI_TYPE_MCP23017) {#endif#ifdef MCP23017 /* don't think we need this // set defaults! Wire.beginTransmission(MCP23017_ADDRESS | _i2cAddr); wiresend(MCP23017_IODIRA); wiresend(0xFF); // all inputs on port A result = Wire.endTransmission();#ifdef DETECT_DEVICE if (result) { if (_deviceDetected == 2) { _deviceDetected = 0; return; } }#endif Wire.beginTransmission(MCP23017_ADDRESS | _i2cAddr); wiresend(MCP23017_IODIRB); wiresend(0xFF); // all inputs on port B result = Wire.endTransmission();#ifdef DETECT_DEVICE if (result) { if (_deviceDetected == 2) { _deviceDetected = 0; return; } }#endif */ // now set up input/output pins Wire.beginTransmission(MCP23017_ADDRESS | _i2cAddr); wiresend(MCP23017_IODIRA); wiresend(0x0F); // buttons input, all others output result = Wire.endTransmission();#ifdef DETECT_DEVICE if (result) { if (_deviceDetected == 2) { _deviceDetected = 0; return; } }#endif // set the button pullups Wire.beginTransmission(MCP23017_ADDRESS | _i2cAddr); wiresend(MCP23017_GPPUA); wiresend(0x0F); result = Wire.endTransmission();#ifdef DETECT_DEVICE if (result) { if (_deviceDetected == 2) { _deviceDetected = 0; return; } }#endif // now set up input/output pins Wire.beginTransmission(MCP23017_ADDRESS | _i2cAddr); wiresend(MCP23017_GPIOA); wiresend(0x00); // buttons input, all others output result = Wire.endTransmission();#ifdef DETECT_DEVICE if (result) { if (_deviceDetected == 2) { _deviceDetected = 0; return; } }#endif // set button input polarity Wire.beginTransmission(MCP23017_ADDRESS | _i2cAddr); wiresend(MCP23017_IPOLA); wiresend(0x0F); result = Wire.endTransmission();#ifdef DETECT_DEVICE if (result) { if (_deviceDetected == 2) { _deviceDetected = 0; return; } }#endif // set button input polarity Wire.beginTransmission(MCP23017_ADDRESS | _i2cAddr);//.........这里部分代码省略.........
开发者ID:Erablitek,项目名称:LiquidTWI2,代码行数:101,
注:本文中的wiresend函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ wiringPiISR函数代码示例 C++ wireless_send_event函数代码示例 |