-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrz_snippets.h
executable file
·56 lines (42 loc) · 1.05 KB
/
rz_snippets.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/*
TITLE:
rz_snippets.h
BRIEF:
header only library
DESC:
Arduino library for ESP32 with some system related functions
* don't use, deprecated
SOURCE:
https://github.com/Zheng-Bote/esp32_libs
SYNTAX:
#include "rz_snippets.h"
RETURN:
void
HISTORY:
Version | Date | Developer | Comments
------- | ---------- | ---------------- | ---------------------------------------------------------------
0.0.1 | 2018-10-13 | RZheng | created
*/
#include "Arduino.h"
#ifndef rz_snippets
#define rz_snipptes
String rz_baseMac()
{
uint64_t chipid;
char baseMacChr[18] = {0};
chipid=ESP.getEfuseMac();
Serial.printf("ESP32 Chip ID = %04X",(uint16_t)(chipid>>32));//print High 2 bytes
Serial.printf("%08X\n",(uint32_t)chipid);//print Low 4bytes.
sprintf(baseMacChr, "%04X",(uint16_t)(chipid>>32));
Serial.print("baseMac: ");
Serial.println(baseMacChr);
return String(baseMacChr);
}
char* rz_strToChar(String str)
{
int len = str.length() + 1;
char* buf = new char[len];
strcpy(buf, str.c_str());
return buf;
}
#endif