int arrayToStr(unsigned char *buf, unsigned int buflen, char *out,int state)
{
char strBuf[33] = {0};
char pbuf[32];
int i;
for(i = 0; i < buflen; i++)
{
if(state ==1 )
{
sprintf(pbuf, "%02X", buf[i]);
}
else{
sprintf(pbuf, "%X", buf[i]);
}
strncat(strBuf, pbuf, 2);
}
strncpy(out, strBuf, buflen * 2);
printf("out = %s\n", out);
return buflen * 2;
}
u8 dec_to_hex(int value)
{
int i;
char buffer[2];
u8 hex_temp =0;
sprintf(buffer, "%x", value);
hex_temp = (u8)value;
printf("%x\r\n",hex_temp);
hex_temp = i;
return hex_temp;
// printf("%s\r\n", return_hex);
// return hex;
}