本文整理汇总了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();
}
示例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);
}
示例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);
}
}
}
示例4: initDisplay
void initDisplay() {
// All digits on
writeWord(0x0b07);
// Set maximum brightness
writeWord(0x0a0f);
// Turn it on
writeWord(0x0c01);
}
示例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);
}
示例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));
}
}
示例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);
}
示例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, "");
}
示例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 );
}
}
示例10: writeWord
void XMFileBase::writeWords(const mp_uword* buffer,mp_sint32 count)
{
for (mp_sint32 i = 0; i < count; i++)
{
writeWord(*buffer);
buffer++;
}
}
示例11: writeGlobalSettings
void writeGlobalSettings() {
eepromSetValid();
cli();
writeByte(2, mode);
writeWord(3, tuningSetting);
sei();
}
示例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 );
}
示例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;
}
示例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);
}
示例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;
}