//
// standardcalls.c
//
// Functions for doing some standard things which for some reason the Palm
// doesn't do, or doesn't do correctly.
//
// Copyright (C)2000 by MacSema, Inc. All rights reserved.
//
// http://www.macsema.com
//

#include <Pilot.h>
#include "palmserial.h"
#include "standardcalls.h"

void ShowDebug (char *pszMessage)
{
	//Serial_PutRawBlock(0,(unsigned char *)pszMessage,strlen(pszMessage));
}

void IntToHex(unsigned char *pInt, int nSize, int nWidth, char *sDest)
{
	int i,nCount;
	byte byNibble,byTemp;
	char *s;
	char sTemp[16];
	
	s = sTemp;
	nCount = 0;
	for (i=0;i<nSize;i++) {
		byTemp = *pInt;
		byNibble = byTemp >> 4;
		if (byNibble <= 9) *s = byNibble + '0';
		else *s = byNibble + 'A' - 10;
		s++;
		byTemp = *pInt;
		byNibble = byTemp & 0x0F;
		if (byNibble <= 9) *s = byNibble + '0';
		else *s = byNibble + 'A' - 10;
		s++;
		pInt++;
		nCount += 2;
	}
	for (i=0;i<nWidth - nCount;i++) {
		sDest[i] = '0';
	}
	for (i=0;i<nCount;i++) {
		sDest[i + (nWidth - nCount)] = sTemp[i];
	}
	sDest[nWidth] = 0;
}


