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


C++ printHex函数代码示例

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


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

示例1: dumpRegs

static void dumpRegs(struct ft5x06_ts *ts, unsigned start, unsigned end)
{
	u8 regbuf[512];
	unsigned char startch[1] = { start };
	int ret ;
	struct i2c_msg readpkt[2] = {
		{ts->client->addr, 0, 1, startch},
		{ts->client->addr, I2C_M_RD, end-start+1, regbuf}
	};
	ret = i2c_transfer(ts->client->adapter, readpkt, ARRAY_SIZE(readpkt));
	if (ret != ARRAY_SIZE(readpkt)) {
		printk(KERN_WARNING "%s: i2c_transfer failed\n", client_name);
	} else {
		printk(KERN_ERR "registers %02x..%02x\n", start, end);
		printHex(regbuf, end-start+1);
	}
}
开发者ID:Moretti0,项目名称:gg,代码行数:17,代码来源:ft5x06_ts.c

示例2: cmd_peep

void cmd_peep(void) {
int i=0;

	while (i <= ENDEEPROM) {
		if (!(i&63)) {speol(); printHex(i+0xe000); spb(':'); }
		if (!(i&7)) spb(' ');
		if (!(i&3)) spb(' ');		
		byte c = eeread(i) & 0xff;

		if (c == 0) spb('\\');
		//else if ((c == 255) || (c < 0)) spb('.');
		else if (c == 255) spb('.');
		else if (c < ' ') spb('^');
		else spb(c);
		i++;
	}
	speol();
}
开发者ID:mujtabachang,项目名称:mew,代码行数:18,代码来源:bitlash-eeprom.c

示例3: cgmiTestUserDataBufferCB

static cgmi_Status cgmiTestUserDataBufferCB(void *pUserData, void *pBuffer)
{
#if GST_CHECK_VERSION(1,0,0)
    GstMapInfo map;
#endif
    GstBuffer *pGstBuff = (GstBuffer *)pBuffer;
    guint8 *bufferData;
    guint bufferSize;

    if( NULL == pGstBuff )
    {
        return CGMI_ERROR_BAD_PARAM;
    }

#if GST_CHECK_VERSION(1,0,0)
    if ( gst_buffer_map(pGstBuff, &map, GST_MAP_READ) == FALSE )
    {
        g_print("Failed in mapping buffer for reading userdata!\n");
        return CGMI_ERROR_FAILED;
    }

    bufferData = map.data;
    bufferSize = map.size;
#else
    bufferData = GST_BUFFER_DATA( pGstBuff );
    bufferSize = GST_BUFFER_SIZE( pGstBuff );
#endif

    // Dump data recieved.
    g_print("cgmiTestUserDataBufferCB called with buffer of size (%d)...\n",
        bufferSize);
    printHex( bufferData, bufferSize );
    g_print("\n");

#if GST_CHECK_VERSION(1,0,0)
    gst_buffer_unmap( pGstBuff, &map );
#endif
    // Free buffer
    gst_buffer_unref( pGstBuff );

    gUserDataCbCalled++;

    return CGMI_ERROR_SUCCESS;
}
开发者ID:ertos12,项目名称:cgmi,代码行数:44,代码来源:cgmiClientTest.c

示例4: Macro_timeState

// Update Time State trigger
// Only valid with Sleep/Resume and Inactive/Active triggers
// States:
//   * 0x00 - Off
//   * 0x01 - Activate
//   * 0x02 - On
//   * 0x03 - Deactivate
void Macro_timeState( uint8_t type, uint16_t cur_time, uint8_t state )
{
	// Make sure this is a valid trigger type
	switch ( type )
	{
	case TriggerType_Sleep1:
	case TriggerType_Resume1:
	case TriggerType_Inactive1:
	case TriggerType_Active1:
		break;

	// Ignore if not the correct type
	default:
		warn_msg("Invalid time state trigger update: ");
		printHex( type );
		print(NL);
		return;
	}

	// cur_time is controlled by the caller
	// When this function called the trigger is active
	if ( cur_time > 0xFF )
	{
		warn_msg("Only 255 time instances are accepted for a time state trigger: ");
		printInt16( cur_time );
		print(NL);
		return;
	}
	uint8_t index = cur_time;

	// Only add to macro trigger list if one of three states
	switch ( state )
	{
	case ScheduleType_A:  // Activate
	case ScheduleType_On: // On
	case ScheduleType_D:  // Deactivate
		macroTriggerEventBuffer[ macroTriggerEventBufferSize ].index = index;
		macroTriggerEventBuffer[ macroTriggerEventBufferSize ].state = state;
		macroTriggerEventBuffer[ macroTriggerEventBufferSize ].type  = type;
		macroTriggerEventBufferSize++;
		break;
	}
}
开发者ID:nptchang,项目名称:controller,代码行数:50,代码来源:macro.c

示例5: cgmi_SectionBufferCallback_PMT

static cgmi_Status cgmi_SectionBufferCallback_PMT(
    void *pUserData,
    void *pFilterPriv,
    void *pFilterId,
    cgmi_Status sectionStatus,
    char *pSection,
    int sectionSize)
{
    cgmi_Status retStat;
    tMpegTsPmt curPmt;

    //g_print( "cgmi_QueryBufferCallback -- pFilterId: 0x%08lx \n", pFilterId );

    if( NULL == pSection )
    {
        g_print("NULL buffer passed to cgmiSectionBufferCallback.\n");
        return CGMI_ERROR_BAD_PARAM;
    }

    g_print("Received section pFilterId: %p, sectionSize %d\n\n", pFilterId, sectionSize);
    printHex( pSection, sectionSize );
    g_print("\n\n");

    parsePMT( &curPmt, pSection, sectionSize );
    printPMT( &curPmt );

    gPmtParsed = true;

    g_print("Calling cgmi_StopSectionFilter...\n");
    retStat = cgmi_StopSectionFilter( pFilterPriv, pFilterId );
    CHECK_ERROR(retStat);

    /*
    g_print("Calling cgmi_DestroySectionFilter...\n");
    retStat = cgmi_DestroySectionFilter( pFilterPriv, pFilterId );
    CHECK_ERROR(retStat);
    */
    // Free buffer allocated in cgmi_QueryBufferCallback
    g_free( pSection );


    return CGMI_ERROR_SUCCESS;
}
开发者ID:ertos12,项目名称:cgmi,代码行数:43,代码来源:cgmiClientTest.c

示例6: wmain

int wmain(int argc, wchar_t * argv[])
{
	RPC_BINDING_HANDLE hBinding;
	wchar_t dataIn[] = L"a cleartext message!";
	PVOID pDataOut, pDataOut2;
	DWORD dwDataOut, dwDataOut2;

	if(argc > 1)
	{
		wprintf(L"Will use \'%s\' for DC name...\n", argv[1]);
		if(kull_m_rpc_createBinding(L"ncacn_np", argv[1], L"\\pipe\\protected_storage", L"ProtectedStorage", RPC_C_IMP_LEVEL_IMPERSONATE, &hBinding, NULL))
		{
			wprintf(L"\n* Retrieve RSA Public Key\n");
			if(kull_m_rpc_bkrp_generic(&hBinding, &BACKUPKEY_RETRIEVE_BACKUP_KEY_GUID, (PVOID) 0xbadc00fe, 0, &pDataOut, &dwDataOut)) // don't ask me why dummy data is needed here (not used).
			{
				wprintf(L"  > pDataOut @ 0x%p (%u)\n", pDataOut, dwDataOut);
				//printHex(pDataOut, dwDataOut);
				MIDL_user_free(pDataOut);
			}

			wprintf(L"\n* Backup a secret (%s)\n", dataIn);
			if(kull_m_rpc_bkrp_generic(&hBinding, &BACKUPKEY_BACKUP_GUID, &dataIn, sizeof(dataIn), &pDataOut, &dwDataOut))
			{
				wprintf(L"  > pDataOut @ 0x%p (%u)\n", pDataOut, dwDataOut);
				printHex(pDataOut, dwDataOut);

				wprintf(L"\n* Restore a secret\n");
				if(kull_m_rpc_bkrp_generic(&hBinding, &BACKUPKEY_RESTORE_GUID, pDataOut, dwDataOut, &pDataOut2, &dwDataOut2))
				{
					wprintf(L"  > pDataOut2 @ 0x%p (%u)\n", pDataOut, dwDataOut);
					wprintf(L"  > Secret : %s\n", pDataOut2);
					MIDL_user_free(pDataOut2);
				}
				MIDL_user_free(pDataOut);
			}

			kull_m_rpc_deleteBinding(&hBinding);
		}
	}
	else wprintf(L"[ERROR] A DC name is needed in argument\n");
	return ERROR_SUCCESS;
}
开发者ID:gentilkiwi,项目名称:basic_rpc,代码行数:42,代码来源:test_call.c

示例7: nvmem_write_patch

unsigned char nvmem_write_patch(unsigned long ulFileId, unsigned long spLength, const uint8_t *spData)
{
	unsigned char 	status = 0;
	unsigned short	offset = 0;
	unsigned char*      spDataPtr = (unsigned char*)spData;
	uint8_t rambuffer[SP_PORTION_SIZE];

	while ((status == 0) && (spLength >= SP_PORTION_SIZE))
	{
	  for (uint8_t i=0; i<SP_PORTION_SIZE; i++) {
	    rambuffer[i] = pgm_read_byte(spData + i + offset);
	  }
#if (DEBUG_MODE == 1)
	  PRINT_F("Writing: "); printDec16(offset); PRINT_F("\t");
	  for (uint8_t i=0; i<SP_PORTION_SIZE; i++) {
	    PRINT_F("0x");
	    printHex(rambuffer[i]);
	    PRINT_F(", ");
	  }
	  PRINT_F("\n\r");
#endif
	  status = nvmem_write(ulFileId, SP_PORTION_SIZE, offset, rambuffer);
	  offset += SP_PORTION_SIZE;
	  spLength -= SP_PORTION_SIZE;
	  spDataPtr += SP_PORTION_SIZE;
	}
	
	if (status !=0)
	{
		// NVMEM error occurred
		return status;
	}
	
	if (spLength != 0)
	{
	  memcpy_P(rambuffer, spDataPtr, SP_PORTION_SIZE);
	  // if reached here, a reminder is left
	  status = nvmem_write(ulFileId, spLength, offset, rambuffer);
	}
	
	return status;
}
开发者ID:glocklueng,项目名称:stm32-wifi-ir,代码行数:42,代码来源:nvmem.c

示例8: nvmem_write_patch

UINT8 nvmem_write_patch(UINT32 ulFileId, UINT32 spLength, const UINT8 *spData)
{
	UINT8 	status = 0;
	UINT16	offset = 0;
	UINT8*      spDataPtr = (UINT8*)spData;
	UINT8 rambuffer[SP_PORTION_SIZE];

	while ((status == 0) && (spLength >= SP_PORTION_SIZE))
	{
	  for (UINT8 i=0; i<SP_PORTION_SIZE; i++) {
	    rambuffer[i] = pgm_read_byte(spData + i + offset);
	  }
#if (DEBUG_MODE == 1)
	  PRINT_F("Writing: "); printDec16(offset); PRINT_F("\t");
	  for (UINT8 i=0; i<SP_PORTION_SIZE; i++) {
	    PRINT_F("0x");
	    printHex(rambuffer[i]);
	    PRINT_F(", ");
	  }
	  PRINT_F("\n\r");
#endif
	  status = nvmem_write(ulFileId, SP_PORTION_SIZE, offset, rambuffer);
	  offset += SP_PORTION_SIZE;
	  spLength -= SP_PORTION_SIZE;
	  spDataPtr += SP_PORTION_SIZE;
	}
	
	if (status !=0)
	{
		// NVMEM error occurred
		return status;
	}
	
	if (spLength != 0)
	{
	  memcpy_P(rambuffer, spDataPtr, SP_PORTION_SIZE);
	  // if reached here, a reminder is left
	  status = nvmem_write(ulFileId, spLength, offset, rambuffer);
	}
	
	return status;
}
开发者ID:joshbouganim,项目名称:Adafruit_CC3000_Library,代码行数:42,代码来源:nvmem.cpp

示例9: selectPrintln

/*
**-----------------------------------------------------------------------------
**
**  Abstract:
**  This function selects according to which type of element to print
**  the function to send the data via UART. A new line character is added
**
**  Parameters:
**  string: data to be sent via UART
**  typeString: selects whether it is string, decimal or hex
**
**  Returns:
**  True:  Successful UART transmission
**  False: Unsuccessful UART transmission
**
**-----------------------------------------------------------------------------
*/
bool selectPrintln(uint8_t * string, uint8_t typeString)
{
  bool result = false;

  switch(typeString){
    case TYPE_STRING:
      result = printString(string, WITH_LINE);
      break;
    case TYPE_HEX:
      result = printHex((uint8_t)string, WITH_LINE);
      break;
    case TYPE_DEC:
      result = printDec((uint8_t)string, WITH_LINE);
      break;
    default:
      break;
  }
  
  return result;
}
开发者ID:NordicSemiconductor,项目名称:ble-sdk-RL78,代码行数:37,代码来源:CG_serial.c

示例10: syscallHandler

void syscallHandler(uint32_t eax, uint32_t ebx){
	switch(eax){
		case 0:
			;char c = (char)ebx;
			putch(c);
			break;
		case 1:
			;char* c2 = (char*)ebx;
			print(c2);
			break;
		case 2:
			__kill__();
			break;
		default:
			print("Other syscall ");
			printHex(eax);
			println("");
			break;
	}
}
开发者ID:Codepixl,项目名称:codeOS2,代码行数:20,代码来源:syscall.c

示例11: while

/**	Transmit a packet with checksum to the SM130.
 */
void SM130::transmitData()
{
	// wait until at least 20ms passed since last I2C transmission
	while(t > millis());
	t = millis() + 20;

	// init checksum and packet length
	byte sum = 0;
	byte len = data[0] + 1;

	// remember which command was sent
	cmd = data[1];

	// transmit packet with checksum
	//Wire.beginTransmission(address);
	for (int i = 0; i < len; i++)
	{
#if defined(ARDUINO) && ARDUINO >= 100
		Wire.write(data[i]);
#else
		Wire.send(data[i]);
#endif
		sum += data[i];
	}
#if defined(ARDUINO) && ARDUINO >= 100
	Wire.write(sum);
#else
	Wire.send(sum);
#endif
	Wire.endTransmission();

	// show transmitted packet for debugging
	if (debug)
	{
		Serial.print("> ");
		printArrayHex(data, len);
		Serial.print(' ');
		printHex(sum);
		Serial.println();
	}
}
开发者ID:cperez36,项目名称:RFIDuino,代码行数:43,代码来源:SM130.cpp

示例12: printHex

void printHex(Print& p, const uint8_t* buf, size_t len, const __FlashStringHelper* byte_sep, const __FlashStringHelper* group_sep, size_t group_by) {
	size_t cur_group = 0;
	while (len--) {
		// Print the group separator whenever starting a new
		// group
		if (group_by && group_sep && cur_group == group_by) {
			p.print(group_sep);
			cur_group = 0;
		}

		// Print the byte separator, except when at the start of
		// a new group (this also excludes the first byte)
		if (cur_group != 0 && byte_sep)
			p.print(byte_sep);

		printHex(p, *buf);

		buf++;
		cur_group++;
	}
}
开发者ID:Introsys,项目名称:fresh,代码行数:21,代码来源:Printers.cpp

示例13: fail

void fail() // segfault generation
{
    // int *p = 0x00000000;   
    // p[0] = 13;
    const int _m_size = 25;
    char * _m_array;
    // _m_array = new int [_m_size];
    _m_array = new char[_m_size];
    for (int i = 0; i<_m_size; i++)
    {
        //int a=rand() % my_array.size();
       
        _m_array[i] = rand() % _m_size;
        cout << i <<  " - " << _m_array[i];
        printHex(_m_array[i]);
        // cout << "\n";
    }
    cout << endl;
    delete [] _m_array;
        
}
开发者ID:MakSim345,项目名称:MS-VC08,代码行数:21,代码来源:my_exceptions.cpp

示例14: printData

void printData(
	const char *label,
	CFDataRef data,
	PrintDataType whichType,
	OidParser &parser)
{
	const unsigned char *buf = CFDataGetBytePtr(data);
	unsigned len = CFDataGetLength(data);
	
	printf("%s: ", label);
	switch(whichType) {
		case PD_Hex:
			printHex(buf, len, 16);
			break;
		case PD_ASCII:
			printAscii((const char *)buf, len, 50);
			break;
		case PD_OID:
			printOid(buf, len, parser);
	}
	putchar('\n');
}
开发者ID:unofficial-opensource-apple,项目名称:Security,代码行数:22,代码来源:rootUtils.cpp

示例15: PRINTLN

bool EmbitLoRaModem::Send(LoRaPacket* packet, bool ack)
{
	unsigned char length = packet->Write(sendBuffer);
	PRINTLN("Sending payload: ");
	for (unsigned char i = 0; i < length; i++) {
		printHex(sendBuffer[i]);
	}
	PRINTLN();
  
	if(ack == true)
		SendPacket(CMD_SEND_PREFIX, sizeof(CMD_SEND_PREFIX), sendBuffer, length);
	else
		SendPacket(CMD_SEND_PREFIX_NO_ACK, sizeof(CMD_SEND_PREFIX_NO_ACK), sendBuffer, length);
	unsigned char result = ReadPacket(3);
	if(result != 0){
		PRINTLN("Failed to send packet");
		return false;
	}
	else
		return true;
	
}
开发者ID:allthingstalk,项目名称:arduino-lora,代码行数:22,代码来源:EmbitLoRaModem.cpp


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