Skip to content

Instantly share code, notes, and snippets.

View Aietes's full-sized avatar

Stefan Krüger Aietes

  • floating pixels
  • Heidelberg, Germany
  • 11:38 (UTC +01:00)
  • X @StefanSays
View GitHub Profile
#include <nvs.h>
#include <nvs_flash.h>
/**
* Testing dedicated NVS partition access
*
* Used partition table
* # Name, Type, SubType, Offset, Size, Flags
* nvs, data, nvs, 0x9000, 0x3000
* void, data, nvs, 0xC000, 0x2000
* nvs_key, data, nvs_keys, 0xE000, 0x1000
@Aietes
Aietes / bitsandbytes.cpp
Last active June 17, 2020 09:12
Bit shifting in C
//print uint64_t 4 bits at a time, single HEX digit
uint64_t chipid = ESP.getEfuseMac();
for (size_t i = 0; i < 16; i++)
{
byte byte1 = chipid >> 4*i & 0x0000000F;
Serial.printf("%X ", byte1);
}
// 0 3 E A 4 A 0 4 A E 0 E 0 0 0 0
//print uint64_t 4 bits at a time, in pairs of 8 bits, single HEX digit