Example #1
0
static size_t hex_str(uint8_t *buf, size_t len, char *out)
{
    for (size_t i = 0; i < len; i++) {
        *(out++) = nibble_to_char(buf[i] >> 4);
        *(out++) = nibble_to_char(buf[i]);
    }
    *(out) = '\0';

    return (len * 2) + 1;
}
Example #2
0
void put_hex(void const* p, unsigned long plen) {
    unsigned char const* u = (unsigned char const*)p;
    unsigned char const* uend = u+plen;
    char buf[3];
    buf[2] = 0;
    for(; u < uend; ++u) {
        buf[0] = nibble_to_char(*u >> 4);
        buf[1] = nibble_to_char(*u & 0x0f);
        put(buf);
    }
}
Example #3
0
static void
putnibble(unsigned char c){
	putserial(nibble_to_char(c));
}