mirror of
https://github.com/espressif/esp-idf.git
synced 2025-07-31 11:17:20 +02:00
ble_mesh: sync zephyr v1.14.0 bt_hex()
This commit is contained in:
@@ -17,19 +17,11 @@
|
|||||||
const char *bt_hex(const void *buf, size_t len)
|
const char *bt_hex(const void *buf, size_t len)
|
||||||
{
|
{
|
||||||
static const char hex[] = "0123456789abcdef";
|
static const char hex[] = "0123456789abcdef";
|
||||||
static char hexbufs[4][129];
|
static char str[129];
|
||||||
static u8_t curbuf;
|
|
||||||
const u8_t *b = buf;
|
const u8_t *b = buf;
|
||||||
unsigned int mask;
|
|
||||||
char *str;
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
mask = bt_mesh_irq_lock();
|
len = MIN(len, (sizeof(str) - 1) / 2);
|
||||||
str = hexbufs[curbuf++];
|
|
||||||
curbuf %= ARRAY_SIZE(hexbufs);
|
|
||||||
bt_mesh_irq_unlock(mask);
|
|
||||||
|
|
||||||
len = MIN(len, (sizeof(hexbufs[0]) - 1) / 2);
|
|
||||||
|
|
||||||
for (i = 0; i < len; i++) {
|
for (i = 0; i < len; i++) {
|
||||||
str[i * 2] = hex[b[i] >> 4];
|
str[i * 2] = hex[b[i] >> 4];
|
||||||
|
Reference in New Issue
Block a user