uint16_t read_os(void *dst, uint16_t length, const char *ignore_string){ uint16_t counter = 0; uint16_t c; uint8_t v, tmp = 0, idx = 0; if(!ignore_string){ ignore_string = block_ignore_string; } while(counter < length){ c = cli_getc(); if(c > 0xff){ return counter; } if(strchr(ignore_string, c)){ continue; } v = convert_nibble(c); if(v > 0x0f){ return counter; } if(idx){ ((uint8_t*)dst)[counter++] = (tmp << 4) | v; idx = 0; if(counter % (BUFFER_LIMIT/2) == 0){ cli_putc('.'); } }else{ tmp = v; idx = 1; } } return counter; }
void testrun_entropium(void){ char c, str[16]; uint8_t data[32]; uint32_t i=0; while('q'!=cli_getc()){ entropium_getRandomBlock(data); cli_putstr_P(PSTR("\r\n ")); ultoa(i, str, 10); for(c=strlen(str); c<11; ++c){ cli_putc(' '); } cli_putstr(str); ++i; cli_putstr_P(PSTR(" : ")); cli_hexdump(data, 32); } cli_putstr_P(PSTR("\r\n\r\n")); }