这篇教程C++ writeByte函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中writeByte函数的典型用法代码示例。如果您正苦于以下问题:C++ writeByte函数的具体用法?C++ writeByte怎么用?C++ writeByte使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了writeByte函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: coding//display function.Write to full-screen.void TM1637::display(int8_t DispData[]){ int8_t SegData[4]; uint8_t i; for(i = 0;i < 4;i ++) { SegData[i] = DispData[i]; } coding(SegData); start(); //start signal sent to TM1637 from MCU writeByte(ADDR_AUTO);// stop(); // start(); // writeByte(Cmd_SetAddr);// for(i=0;i < 4;i ++) { writeByte(SegData[i]); // } stop(); // start(); // writeByte(Cmd_DispCtrl);// stop(); //}
开发者ID:Seeed-Studio,项目名称:Grove-Starter-Kit-for-LaunchPad,代码行数:24,
示例2: digitalWritePiFaceSpecialvoid digitalWritePiFaceSpecial (int pin, int value){ uint8_t mask = 1 << pin ; uint8_t old ; old = readByte (GPIOA) ; if (value == 0) old &= (~mask) ; else old |= mask ; writeByte (GPIOA, old) ;}
开发者ID:carriercomm,项目名称:raspberry-webradio,代码行数:14,
示例3: delayvoid mcp23016::begin(bool protocolInitOverride) { if (!protocolInitOverride && !_error){ Wire.begin(); #if ARDUINO >= 157 Wire.setClock(400000UL); // Set I2C frequency to 400kHz #else TWBR = ((F_CPU / 400000UL) - 16) / 2; // Set I2C frequency to 400kHz #endif } delay(100); writeByte(IOCON,0b00000000);//read datasheet for details! _gpioDirection = 0xFFFF;//all in _gpioState = 0x0000;//all low }
开发者ID:koson,项目名称:gpio_expander,代码行数:14,
示例4: coding// Display function.Write to full-screen.void TM1637::display(int8_t disp_data[]){ int8_t seg_data[DIGITS]; uint8_t i; for (i = 0; i < DIGITS; i++) seg_data[i] = disp_data[i]; coding(seg_data); start(); // Start signal sent to TM1637 from MCU writeByte(ADDR_AUTO); // Command1: Set data stop(); start(); writeByte(cmd_set_addr); // Command2: Set address (automatic address adding) for (i = 0; i < DIGITS; i++) writeByte(seg_data[i]); // Transfer display data (8 bits x num_of_digits) stop(); start(); writeByte(cmd_disp_ctrl); // Control display stop();}
开发者ID:Seeed-Studio,项目名称:Grove_4Digital_Display,代码行数:24,
示例5: _rsTextLCD::TextLCD(PinName rs, PinName e, PinName d4, PinName d5, PinName d6, PinName d7, LCDType type) : _rs(rs), _e(e), _d(d4, d5, d6, d7), _type(type) { _e = 1; _rs = 0; // command mode wait(0.015); // Wait 15ms to ensure powered up // send "Display Settings" 3 times (Only top nibble of 0x30 as we've got 4-bit bus) for (int i=0; i<3; i++) { writeByte(0x3); wait(0.00164); // this command takes 1.64ms, so wait for it } writeByte(0x2); // 4-bit mode wait(0.000040f); // most instructions take 40us writeCommand(0x28); // Function set 001 BW N F - - writeCommand(0x0C); writeCommand(0x6); // Cursor Direction and Display Shift : 0000 01 CD S (CD 0-left, 1-right S(hift) 0-no, 1-yes cls();}
开发者ID:AlienEngineer,项目名称:demo-cortex-m3,代码行数:23,
示例6: getTypeSizeCSymbol* CData::addVariable (const int &scope, const std::string &name, const int &type, int size, const int &address){ if (size == 0) { size = getTypeSize(type); } CSymbol *symbol = new CSymbol (scope, name, type, size, CSymbol::VAR, address); _symbols.push_back(symbol); if (type == CSymbol::STRING) { // Para strings constantes e variaveis eh necessario indicar a categoria writeByte(CSymbol::VAR); } //_data += symbol->getBinary(); for (int i=0; i < symbol->getTypeSize(); i++) { // TODO: horrivel :-) writeByte ('/0'); } return symbol;}
开发者ID:BackupTheBerlios,项目名称:gpt-svn,代码行数:23,
示例7: writeByte/* * packetPing(): send Ping heart beat data to OneNet * */edp_pkt *packetPing(){ int32 remainlen = 0x00; edp_pkt* pkt; if((pkt = packetCreate()) == NULL) return NULL; /* msg type */ writeByte(pkt, PINGREQ); /* remain len */ writeRemainlen(pkt, remainlen); return pkt;}
开发者ID:wi-cuckoo,项目名称:IOT-Programming,代码行数:18,
示例8: writeBytevoid DDS::setFreq(double frequency){ //enter frequency as Hz if(frequency > 40000000){ Serial.println("Frequency is set Higher than board can output"); Serial.println("Setting to Maximum Freq "); frequency = 40000000; } #ifdef DEBUG Serial.print("Freq: "); Serial.print(frequency); Serial.println(" Hz"); #endif int32_t freq = frequency * 4294967295 / 125000000; // note 125 MHz clock on 9850 for (int b = 0; b < 4; b++, freq>>=8) { writeByte(freq & 0xFF); } writeByte(0x000); // Final control byte pulseHigh(FU_UD); // Done! Should see output }
开发者ID:Ximidar,项目名称:AD9850_Test_Code,代码行数:23,
示例9: switchvoid CDMRTX::process(){ if (m_state == DMRTXSTATE_IDLE) return; if (m_poLen == 0U) { switch (m_state) { case DMRTXSTATE_SLOT1: createData(0U); m_state = DMRTXSTATE_CACH2; break; case DMRTXSTATE_CACH2: createCACH(1U, 0U); m_state = DMRTXSTATE_SLOT2; break; case DMRTXSTATE_SLOT2: createData(1U); m_state = DMRTXSTATE_CACH1; break; default: createCACH(0U, 1U); m_state = DMRTXSTATE_SLOT1; break; } } if (m_poLen > 0U) { uint16_t space = io.getSpace(); while (space > (4U * DMR_RADIO_SYMBOL_LENGTH) && space < 1000U) { uint8_t c = m_poBuffer[m_poPtr]; uint8_t m = m_markBuffer[m_poPtr]; m_poPtr++; writeByte(c, m); space -= 4U * DMR_RADIO_SYMBOL_LENGTH; if (m_poPtr >= m_poLen) { m_poPtr = 0U; m_poLen = 0U; return; } } }}
开发者ID:Tyrox25,项目名称:MMDVM,代码行数:49,
示例10: digitalWrite// Read the thermocouple temperature either in Degree Celsius or Fahrenheit. Internally,// the conversion takes place in the background within 155 ms, or longer depending on the// number of samples in each reading (see CR1).// Returns the temperature, or an error (FAULT_OPEN, FAULT_VOLTAGE or NO_MAX31856)double MAX31856::readThermocouple(byte unit){ double temperature; long data; // Select the MAX31856 chip digitalWrite(_cs, LOW); // Read data starting with register 0x0c writeByte(READ_OPERATION(0x0c)); // Read 4 registers data = readData(); // Deselect MAX31856 chip digitalWrite(_cs, HIGH); // If there is no communication from the IC then data will be all 1's because // of the internal pullup on the data line (INPUT_PULLUP) if (data == 0xFFFFFFFF) return NO_MAX31856; // If the value is zero then the temperature could be exactly 0.000 (rare), or // the IC's registers are uninitialized. if (data == 0 && verifyMAX31856() == NO_MAX31856) return NO_MAX31856; // Was there an error? if (data & SR_FAULT_OPEN) temperature = FAULT_OPEN; else if (data & SR_FAULT_UNDER_OVER_VOLTAGE) temperature = FAULT_VOLTAGE; else { // Strip the unused bits and the Fault Status Register data = data >> 13; // Negative temperatures have been automagically handled by the shift above :-) // Convert to Celsius temperature = (double) data * 0.0078125; // Convert to Fahrenheit if desired if (unit == FAHRENHEIT) temperature = (temperature * 9.0/5.0)+ 32; } // Return the temperature return (temperature);}
开发者ID:engineertype,项目名称:MAX31856,代码行数:53,
示例11: writeBytevoid Sensor::playMelody(unsigned char* song, int length){ for(int i = 0; i<length; i+=2) { if(song[i+1] != 100) { writeByte(ID, BUZZER_DATA_TIME, 254); writeByte(ID, BUZZER_DATA_NOTE, song[i+1]); usleep(40000*song[i]); } else { writeByte(ID, BUZZER_DATA_TIME, 0); usleep(40000*song[i]); } } writeByte(ID, BUZZER_DATA_TIME, 0); }
开发者ID:tverrkraftig,项目名称:motor,代码行数:24,
示例12: _wiringPiSetupPiFacestatic int _wiringPiSetupPiFace (void){ if ((spiFd = open (spiDevice, O_RDWR)) < 0) return -1 ;// Set SPI parameters// Why are we doing a read after write?// I don't know - just blindliy copying an example elsewhere... -GH- if (ioctl (spiFd, SPI_IOC_WR_MODE, &spiMode) < 0) return -1 ; if (ioctl (spiFd, SPI_IOC_RD_MODE, &spiMode) < 0) return -1 ; if (ioctl (spiFd, SPI_IOC_WR_BITS_PER_WORD, &spiBPW) < 0) return -1 ; if (ioctl (spiFd, SPI_IOC_RD_BITS_PER_WORD, &spiBPW) < 0) return -1 ; if (ioctl (spiFd, SPI_IOC_WR_MAX_SPEED_HZ, &spiSpeed) < 0) return -1 ; if (ioctl (spiFd, SPI_IOC_RD_MAX_SPEED_HZ, &spiSpeed) < 0) return -1 ;// Setup the MCP23S17 writeByte (IOCON, IOCON_INIT) ; writeByte (IODIRA, 0x00) ; // Port A -> Outputs writeByte (IODIRB, 0xFF) ; // Port B -> Inputs return 0 ;}
开发者ID:gitpan,项目名称:HiPi,代码行数:36,
示例13: myDigitalWritevoid myDigitalWrite (struct wiringPiNodeStruct *node, int pin, int value){ uint8_t mask, old ; pin -= node->pinBase ; mask = 1 << pin ; old = readByte (MCP23x17_GPIOA) ; if (value == 0) old &= (~mask) ; else old |= mask ; writeByte (MCP23x17_GPIOA, old) ;}
开发者ID:cschirin,项目名称:computergraphics,代码行数:15,
示例14: mcp23s17Setupint mcp23s17Setup (const int pinBase, const int spiPort, const int devId){ int x ; struct wiringPiNodeStruct *node ; if ((x = wiringPiSPISetup (spiPort, MCP_SPEED)) < 0) return x ; writeByte (spiPort, devId, MCP23x17_IOCON, IOCON_INIT | IOCON_HAEN) ; writeByte (spiPort, devId, MCP23x17_IOCONB, IOCON_INIT | IOCON_HAEN) ; node = wiringPiNewNode (pinBase, 16) ; node->data0 = spiPort ; node->data1 = devId ; node->pinMode = myPinMode ; node->pullUpDnControl = myPullUpDnControl ; node->digitalRead = myDigitalRead ; node->digitalWrite = myDigitalWrite ; node->data2 = readByte (spiPort, devId, MCP23x17_OLATA) ; node->data3 = readByte (spiPort, devId, MCP23x17_OLATB) ; return 0 ;}
开发者ID:frank71726,项目名称:rpi_camera,代码行数:24,
示例15: clockvoid SX1509::keypad(byte rows, byte columns, unsigned int sleepTime, byte scanTime, byte debounceTime){ unsigned int tempWord; byte tempByte; // If clock hasn't been set up, set it to internal 2MHz if (_clkX == 0) clock(INTERNAL_CLOCK_2MHZ); // Set regDir 0:7 outputs, 8:15 inputs: tempWord = readWord(REG_DIR_B); for (int i=0; i<rows; i++) tempWord &= ~(1<<i); for (int i=8; i<(columns * 2); i++) tempWord |= (1<<i); writeWord(REG_DIR_B, tempWord); // Set regOpenDrain on 0:7: tempByte = readByte(REG_OPEN_DRAIN_A); for (int i=0; i<rows; i++) tempByte |= (1<<i); writeByte(REG_OPEN_DRAIN_A, tempByte); // Set regPullUp on 8:15: tempByte = readByte(REG_PULL_UP_B); for (int i=0; i<columns; i++) tempByte |= (1<<i); writeByte(REG_PULL_UP_B, tempByte); // Debounce Time must be less than scan time debounceTime = constrain(debounceTime, 1, 64); scanTime = constrain(scanTime, 1, 128); if (debounceTime >= scanTime) { debounceTime = scanTime >> 1; // Force debounceTime to be less than scanTime }
开发者ID:brucetsao,项目名称:LIB_for_MCU,代码行数:36,
示例16: pullUpDnControlPiFaceSpecialvoid pullUpDnControlPiFaceSpecial (int pin, int pud){ uint8_t mask = 1 << pin ; uint8_t old ; old = readByte (GPPUB) ; if (pud == PUD_UP) old |= mask ; else old &= (~mask) ; writeByte (GPPUB, old) ;}
开发者ID:gitpan,项目名称:HiPi,代码行数:15,
示例17: MAX7219PrintTimervoid MAX7219PrintTimer(unsigned long n){ if ((n>100)||(n==0)) { writeByte(digit0,DASH); writeByte(digit1,DASH); writeByte(digit2,DASH); writeByte(digit5,DASH); return; } writeByte(digit0, DASH); writeByte(digit1,n % 10); writeByte(digit2,n / 10); writeByte(digit5, DASH);}
开发者ID:mike22437120,项目名称:wifiradio,代码行数:17,
示例18: pgm_read_byte void LCD4884::writeChar(unsigned char c, char mode) { unsigned char line; unsigned char *pFont; byte ch; pFont = (unsigned char*) font6_8; c -= 32; for(line = 0; line < 6; line++) { ch = pgm_read_byte(pFont + c * 6 + line); writeByte( (mode==MENU_NORMAL) ? ch : (ch ^ 0xff), 1); } }
开发者ID:innofox,项目名称:LCD4884,代码行数:15,
示例19: writeBytevoidEnc28J60Network::memblock_mv_cb(uint16_t dest, uint16_t src, uint16_t len){ //as ENC28J60 DMA is unable to copy single bytes: if (len == 1) { writeByte(dest,readByte(src)); } else { // calculate address of last byte len += src - 1; /* 1. Appropriately program the EDMAST, EDMAND and EDMADST register pairs. The EDMAST registers should point to the first byte to copy from, the EDMAND registers should point to the last byte to copy and the EDMADST registers should point to the first byte in the destination range. The destination range will always be linear, never wrapping at any values except from 8191 to 0 (the 8-Kbyte memory boundary). Extreme care should be taken when programming the start and end pointers to prevent a never ending DMA operation which would overwrite the entire 8-Kbyte buffer. */ writeRegPair(EDMASTL, src); writeRegPair(EDMADSTL, dest); if ((src <= RXSTOP_INIT)&& (len > RXSTOP_INIT))len -= (RXSTOP_INIT-RXSTART_INIT); writeRegPair(EDMANDL, len); /* 2. If an interrupt at the end of the copy process is desired, set EIE.DMAIE and EIE.INTIE and clear EIR.DMAIF. 3. Verify that ECON1.CSUMEN is clear. */ writeOp(ENC28J60_BIT_FIELD_CLR, ECON1, ECON1_CSUMEN); /* 4. Start the DMA copy by setting ECON1.DMAST. */ writeOp(ENC28J60_BIT_FIELD_SET, ECON1, ECON1_DMAST); // wait until runnig DMA is completed while (readOp(ENC28J60_READ_CTRL_REG, ECON1) & ECON1_DMAST); }}
开发者ID:PaulStoffregen,项目名称:arduino_uip,代码行数:48,
示例20: initMPUuint8_t initMPU(uint8_t devAddr, uint8_t regAddr, uint8_t bitStart, uint8_t length, uint8_t source){ uint8_t b = 0; readByte(devAddr, regAddr, &b); msDelay(2); uint8_t mask = ((1 << length) - 1) << (bitStart - length + 1); source <<= (bitStart - length + 1); // shift data into correct position source &= mask; // zero all non-important bits in data b &= ~(mask); // zero all important bits in existing byte b |= source; // combine data with existing byte writeByte(devAddr, regAddr, b); return b;}
开发者ID:al1230,项目名称:WRIST_project,代码行数:16,
示例21: write4void OutBuffer::writenl(){#if _WIN32#if M_UNICODE write4(0x000A000D); // newline is CR,LF on Microsoft OS's#else writeword(0x0A0D); // newline is CR,LF on Microsoft OS's#endif#else#if M_UNICODE writeword('/n');#else writeByte('/n');#endif#endif}
开发者ID:NilsBossung,项目名称:dmd,代码行数:16,
示例22: returnboolean SFE_TSL2561::setInterruptControl(unsigned char control, unsigned char persist)// Sets up interrupt operations// If control = 0, interrupt output disabled// If control = 1, use level interrupt, see setInterruptThreshold()// If persist = 0, every integration cycle generates an interrupt// If persist = 1, any value outside of threshold generates an interrupt// If persist = 2 to 15, value must be outside of threshold for 2 to 15 integration cycles// Returns true (1) if successful, false (0) if there was an I2C error// (Also see getError() below){ // Place control and persist bits into proper location in interrupt control register if (writeByte(TSL2561_REG_INTCTL,((control | 0B00000011) << 4) & (persist | 0B00001111))) return(true); return(false);}
开发者ID:jaketesler,项目名称:arduino_libraries,代码行数:16,
示例23: writeByte/** send instruction packet */void AX12::sendPacket (byte _id, byte datalength, byte instruction, byte* data) { byte checksum = 0; writeByte (0xFF); writeByte (0xFF); checksum += writeByte (_id); checksum += writeByte (datalength + 2); checksum += writeByte (instruction); for (byte f=0; f<datalength; f++) { // data = parámetros checksum += writeByte (data[f]); } // checksum = writeByte (~checksum); serialHandle->listen();}
开发者ID:garci66,项目名称:DynamixelSoftSerial,代码行数:16,
示例24: readBytebool EEPROMClassEx::updateBit(int address, uint8_t bit, bool value) { if (bit> 7) return false; byte byteValInput = readByte(address); byte byteValOutput = byteValInput; // Set bit if (value) { byteValOutput |= (1 << bit); //Set bit to 1 } else { byteValOutput &= !(1 << bit); //Set bit to 0 } // Store if different from input if (byteValOutput!=byteValInput) { writeByte(address, byteValOutput); }}
开发者ID:CaptFrank,项目名称:Contiki-Sensor-Node,代码行数:17,
示例25: readByte/**** Function: setHeaterState(byte state)* Description: Set heater state* Params: state - Heater state setting* Returns: 0 if state was successfully written, 1 if not***/byte Si7020::setHeaterState(byte state){ byte result = 0; byte regValue = 0; result = readByte(SI7020_CMD_WRITE_RHT_USER_REG, ®Value); if (result == 0) { regValue &= (~SI7020_HEATER_MASK); // Clear resolution bits regValue |= (state & SI7020_HEATER_MASK); // Set new resolution bits result = writeByte(SI7020_CMD_WRITE_RHT_USER_REG, regValue); // Write new value to register } return result;}
开发者ID:Globaltronic,项目名称:BAGA,代码行数:23,
示例26: reset/** Read 64 bit unique ROM code. * * @return 0 if no timeout has occured. */int DS18B20::readROM(){ int result = reset(); if (0 == result) { writeByte(0x33); // Read ROM // read 64 bit unique code for (unsigned int i = 0; i < 8; i++) { _romCode[i] = readByte(); } } return result;}
开发者ID:ahessling,项目名称:ActiveLoad,代码行数:21,
示例27: writeBytebool I2CSingleByteMasterPollingFeature::setBits(uint8_t address,uint8_t mask) const { uint8_t value; // read current register value if(!readByte(address,value)) return false; // set the bits value|=mask; // write back to the register return writeByte(address,value);}
开发者ID:yaqwsx,项目名称:stm32plus,代码行数:17,
示例28: writeI32uint32_t TBinaryProtocol::writeMessageBegin(const std::string& name, const TMessageType messageType, const int32_t seqid) { if (strict_write_) { int32_t version = (VERSION_1) | ((int32_t)messageType); uint32_t wsize = 0; wsize += writeI32(version); wsize += writeString(name); wsize += writeI32(seqid); return wsize; } else { uint32_t wsize = 0; wsize += writeString(name); wsize += writeByte((int8_t)messageType); wsize += writeI32(seqid); return wsize; }}
开发者ID:euphoria,项目名称:thrift,代码行数:18,
示例29: bytes void Buffer::write16(uint16_t value) { if (position % 8) { if (position + 16 > size * 8) { data = (char*)realloc(data, bytes(position + 16)); size = bytes(position + 16); } writeByte(value >> 8); position += 8; writeByte(value & 0xFF); position += 8; } else { // We are on an even position if (position / 8 + 2 > size)
开发者ID:mgottschlag,项目名称:backlot-old,代码行数:18,
注:本文中的writeByte函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ writeCString函数代码示例 C++ writeBlock函数代码示例 |