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


C++ writeWord函数代码示例

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


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

示例1: writeWord

uint16_t picaso4d::txt_FontSD(uint8_t fontNumber) {
	if (fontNumber >= PICASO_NUM_FONTS)
		return 0;
	writeWord(0xFFE5);
	writeWord(_fontHandles[fontNumber]);
	return getACKresponse();
}
开发者ID:capricorn-one,项目名称:midiSync-SX,代码行数:7,代码来源:picaso4d.cpp

示例2: writeItem

/*********************************************************************
 * @fn      writeItem
 *
 * @brief   Write a data item to NV. Function can write an entire item to NV
 *
 * @param   pg     - Page number
 * @param   offset - offset within the NV page where to write the new item
 * @param   id     - NV item ID
 * @param   alignedLen - Length of data to write, alinged in flash word
 *                       boundary
 * @param  *pBuf   - Data to write.
 *
 * @return  none
 */
static void writeItem( uint8 pg, uint16 offset, osalSnvId_t id, uint16 alignedLen, uint8 *pBuf )
{
  osalNvItemHdr_t hdr;

  hdr.id = 0xFFFF;
  hdr.len = alignedLen | OSAL_NV_INVALID_LEN_MARK;

  // Write the len portion of the header first
  writeWord(pg, offset + alignedLen, (uint8 *) &hdr);

  // remove invalid len mark
  hdr.len &= ~OSAL_NV_INVALID_LEN_MARK;
  writeWord(pg, offset + alignedLen, (uint8 *) &hdr);

  // Copy over the data
  writeWordM(pg, offset, pBuf, alignedLen / OSAL_NV_WORD_SIZE);

  // value is valid. Write header except for the most significant bit.
  hdr.id = id | OSAL_NV_INVALID_ID_MARK;
  writeWord(pg, offset + alignedLen, (uint8 *) &hdr);

  // write the most significant bit
  hdr.id &= ~OSAL_NV_INVALID_ID_MARK;
  writeWord(pg, offset + alignedLen, (uint8 *) &hdr);
}
开发者ID:backman-git,项目名称:EcoSim-sample-project,代码行数:39,代码来源:osal_snv.c

示例3: readWord

void SX1509::writePin(byte pin, byte highLow)
{
	unsigned int tempRegDir = readWord(REG_DIR_B);
	
	if ((0xFFFF^tempRegDir)&(1<<pin))	// If the pin is an output, write high/low
	{
		unsigned int tempRegData = readWord(REG_DATA_B);
		if (highLow)	tempRegData |= (1<<pin);
		else			tempRegData &= ~(1<<pin);
		writeWord(REG_DATA_B, tempRegData);
	}
	else	// Otherwise the pin is an input, pull-up/down
	{
		unsigned int tempPullUp = readWord(REG_PULL_UP_B);
		unsigned int tempPullDown = readWord(REG_PULL_DOWN_B);
		
		if (highLow)	// if HIGH, do pull-up, disable pull-down
		{
			tempPullUp |= (1<<pin);
			tempPullDown &= ~(1<<pin);
			writeWord(REG_PULL_UP_B, tempPullUp);
			writeWord(REG_PULL_DOWN_B, tempPullDown);
		}
		else	// If LOW do pull-down, disable pull-up
		{
			tempPullDown |= (1<<pin);
			tempPullUp &= ~(1<<pin);
			writeWord(REG_PULL_UP_B, tempPullUp);
			writeWord(REG_PULL_DOWN_B, tempPullDown);
		}
	}
}
开发者ID:brucetsao,项目名称:LIB_for_MCU,代码行数:32,代码来源:SparkFunSX1509.cpp

示例4: initDisplay

void initDisplay() {
  // All digits on
  writeWord(0x0b07);
  // Set maximum brightness
  writeWord(0x0a0f);
  // Turn it on
  writeWord(0x0c01);
}
开发者ID:evenwestvang,项目名称:paft-dunk,代码行数:8,代码来源:7219.c

示例5: writeWord

void BitmapWriter::writeFileHeader(struct fileheader & fileheader, FILE * file)
{
    writeWord(fileheader.type, file);
    writeDWord(fileheader.fileSize, file);
    writeWord(fileheader.reserved1, file);
    writeWord(fileheader.reserved2, file);
    writeDWord(fileheader.offset, file);
}
开发者ID:Poligun,项目名称:RayTracer,代码行数:8,代码来源:bitmap_writer.cpp

示例6: writeWord

 /*--------------------------------------------------------------
  * Save a graph on a file readable by a BinaryGraphLoader.
  * NOTE: the output stream must be open with the 
  * ios::binary | ios::out mode.
  -------------------------------------------------------------*/
void BinaryGraphLoader::write(ostream& out, Graph &g)
  { int i,j;
    writeWord(out, g.NodeCount());
    for(i=0; i<g.NodeCount(); i++)
      { writeWord(out, g.OutEdgeCount(i));
        for(j=0; j<g.OutEdgeCount(i); j++)
	  writeWord(out, g.GetOutEdge(i,j,NULL));
      }
  }
开发者ID:chubbymaggie,项目名称:libv,代码行数:14,代码来源:argloader.cpp

示例7: writeDWord

void BitmapWriter::writeInfoHeader(struct infoheader & infoheader, FILE * file)
{
    writeDWord(infoheader.size, file);
    writeDWord(infoheader.width, file);
    writeDWord(infoheader.height, file);
    writeWord(infoheader.planes, file);
    writeWord(infoheader.bitCount, file);
    writeDWord(infoheader.compression, file);
    writeDWord(infoheader.imageSize, file);
    writeDWord(infoheader.xPixelsPerMeter, file);
    writeDWord(infoheader.yPixelsPerMeter, file);
    writeDWord(infoheader.colorUsed, file);
    writeDWord(infoheader.colorImportant, file);
}
开发者ID:Poligun,项目名称:RayTracer,代码行数:14,代码来源:bitmap_writer.cpp

示例8: writeSentence

/********************************************************************
* Write a sentence (multiple words) to the socket
********************************************************************/
void writeSentence(int fdSock, struct Sentence *stWriteSentence) {
    int iIndex;

    if (stWriteSentence->iLength == 0) {
        return;
    }

    DEBUG ? printf("Writing sentence\n") : 0;
    DEBUG ? printSentence(stWriteSentence) : 0;

    for (iIndex = 0; iIndex < stWriteSentence->iLength; iIndex++) {
        writeWord(fdSock, stWriteSentence->szSentence[iIndex]);
    }

    writeWord(fdSock, "");
}
开发者ID:Devronium,项目名称:ConceptApplicationServer,代码行数:19,代码来源:mikrotik-api.c

示例9: xferBuf

/*********************************************************************
 * @fn      xferBuf
 *
 * @brief   Xfers an NV buffer from one location to another, enforcing OSAL_NV_WORD_SIZE writes.
 *
 * @return  none
 */
static void xferBuf( uint8 srcPg, uint16 srcOff, uint8 dstPg, uint16 dstOff, uint16 len )
{
  uint8 rem = dstOff % OSAL_NV_WORD_SIZE;
  uint8 tmp[OSAL_NV_WORD_SIZE];

  if ( rem )
  {
    dstOff -= rem;
    HalFlashRead(dstPg, dstOff, tmp, OSAL_NV_WORD_SIZE);

    while ( (rem < OSAL_NV_WORD_SIZE) && len )
    {
      HalFlashRead(srcPg, srcOff, tmp+rem, 1);
      srcOff++;
      rem++;
      len--;
    }

    writeWord( dstPg, dstOff, tmp );
    dstOff += OSAL_NV_WORD_SIZE;
  }

  rem = len % OSAL_NV_WORD_SIZE;
  len /= OSAL_NV_WORD_SIZE;

  while ( len-- )
  {
    HalFlashRead(srcPg, srcOff, tmp, OSAL_NV_WORD_SIZE);
    srcOff += OSAL_NV_WORD_SIZE;
    writeWord( dstPg, dstOff, tmp );
    dstOff += OSAL_NV_WORD_SIZE;
  }

  if ( rem )
  {
    uint8 idx = 0;
    HalFlashRead(dstPg, dstOff, tmp, OSAL_NV_WORD_SIZE);
    while ( rem-- )
    {
      HalFlashRead(srcPg, srcOff, tmp+idx, 1);
      srcOff++;
      idx++;
    }
    writeWord( dstPg, dstOff, tmp );
  }
}
开发者ID:paoloach,项目名称:zpowermeter,代码行数:53,代码来源:OSAL_Nv.c

示例10: writeWord

void XMFileBase::writeWords(const mp_uword* buffer,mp_sint32 count)
{
	for (mp_sint32 i = 0; i < count; i++)
	{
		writeWord(*buffer);
		buffer++;
	}
}
开发者ID:Fatbag,项目名称:MilkyTracker,代码行数:8,代码来源:XMFile.cpp

示例11: writeGlobalSettings

void writeGlobalSettings() {
  eepromSetValid();

  cli();
  writeByte(2, mode);
  writeWord(3, tuningSetting);
  sei();
}
开发者ID:synthino,项目名称:synthino_xm,代码行数:8,代码来源:eeprom.cpp

示例12: setXferPage

/*********************************************************************
 * @fn      setXferPage
 *
 * @brief   Set active page header state to be transfer state.
 *
 * @param   none
 *
 * @return  none
 */
static void setXferPage(void)
{
  uint32 pgHdr;

  // erase difference bit between active state and xfer state
  pgHdr = OSAL_NV_XFER_PAGE_STATE;

  writeWord( activePg, OSAL_NV_PAGE_HDR_OFFSET, (uint8*)&pgHdr );
}
开发者ID:backman-git,项目名称:EcoSim-sample-project,代码行数:18,代码来源:osal_snv.c

示例13: writeWord

/** write a single bit in a 16-bit device register.
 * @param devAddr I2C slave device address or Slave Select pin if SPI
 * @param regAddr Register regAddr to write to
 * @param bitNum Bit position to write (0-15)
 * @param value New bit value to write
 * @return Status of operation (true = success)
 */
mraa_result_t I2Cdev::writeBitW (uint8_t devAddr, uint8_t regAddr, uint8_t bitNum, uint16_t data) {
	uint16_t w;
	mraa_result_t result;
	if ((result = readWord (devAddr, regAddr, &w)) == MRAA_SUCCESS) {
		w = (data != 0) ? (w | (1 << bitNum)) : (w & ~(1 << bitNum));
		return writeWord (devAddr, regAddr, w);
	}
	else
		return result;
}
开发者ID:Sanderhuisman,项目名称:EdisonQuad,代码行数:17,代码来源:I2Cdev.cpp

示例14: if

void max7301::portPullup(uint16_t data) {
	if (data == HIGH){
		_gpioState = 0xFFFF;
	} else if (data == LOW){	
		_gpioState = 0x0000;
	} else {
		_gpioState = data;
	}
	writeWord(GPPU, _gpioState);
}
开发者ID:koson,项目名称:gpio_expander,代码行数:10,代码来源:max7301.cpp

示例15: writeItem

/*********************************************************************
 * @fn      writeItem
 *
 * @brief   Writes an item header/data combo to the specified NV page.
 *
 * @param   pg - Valid NV Flash page.
 * @param   id - Valid NV item Id.
 * @param   len  - Byte count of the data to write.
 * @param   buf  - The data to write. If NULL, no data/checksum write.
 * @param   flag - TRUE if the checksum should be written, FALSE otherwise.
 *
 * @return  TRUE if header/data to write matches header/data read back, else FALSE.
 */
static uint8 writeItem( uint8 pg, uint16 id, uint16 len, void *buf, uint8 flag )
{
  uint16 offset = pgOff[pg-OSAL_NV_PAGE_BEG];
  uint8 rtrn = FALSE;
  osalNvHdr_t hdr;

  hdr.id = id;
  hdr.len = len;

  writeWord( pg, offset, (uint8 *)&hdr );
  HalFlashRead(pg, offset, (uint8 *)(&hdr), OSAL_NV_HDR_SIZE);

  if ( (hdr.id == id) && (hdr.len == len) )
  {
    if ( flag )
    {
      hdr.chk = calcChkB( len, buf );

      offset += OSAL_NV_HDR_SIZE;
      if ( buf != NULL )
      {
        writeBuf( pg, offset, len, buf );
      }

      if ( hdr.chk == calcChkF( pg, offset, len ) )
      {
        if ( hdr.chk == setChk( pg, offset, hdr.chk ) )
        {
          hotItemUpdate(pg, offset, hdr.id);
          rtrn = TRUE;
        }
      }
    }
    else
    {
      rtrn = TRUE;
    }

    len = OSAL_NV_ITEM_SIZE( hdr.len );
  }
  else
  {
    len = OSAL_NV_ITEM_SIZE( hdr.len );

    if (len > (OSAL_NV_PAGE_SIZE - pgOff[pg - OSAL_NV_PAGE_BEG]))
    {
      len = (OSAL_NV_PAGE_SIZE - pgOff[pg - OSAL_NV_PAGE_BEG]);
    }

    pgLost[pg - OSAL_NV_PAGE_BEG] += len;
  }
  pgOff[pg - OSAL_NV_PAGE_BEG] += len;

  return rtrn;
}
开发者ID:paoloach,项目名称:zpowermeter,代码行数:68,代码来源:OSAL_Nv.c


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