Skip to content

Commit

Permalink
ESP32 - fix chip swap bytes
Browse files Browse the repository at this point in the history
Swap the bytes to make the last byte most unsignificantly.
  • Loading branch information
ricaun committed Apr 20, 2019
1 parent fb7552d commit d8465f8
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 20 deletions.
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,25 +41,25 @@ ESP microcontroller has basically two versions, ESP8266 and ESP32, each one has

| UniqueID | ESP8266 | ESP32 |
| :-------: | :------: | :------:|
| Byte 0| Byte 0 | Byte 0 |
| Byte 1| Byte 1 | Byte 1 |
| Byte 2| Byte 2 | Byte 2 |
| Byte 3| Byte 3 | Byte 3 |
| Byte 4| - | Byte 4 |
| Byte 5| - | Byte 5 |
| Byte 0| Byte 0 | Byte 5 |
| Byte 1| Byte 1 | Byte 4 |
| Byte 2| Byte 2 | Byte 3 |
| Byte 3| Byte 3 | Byte 2 |
| Byte 4| - | Byte 1 |
| Byte 5| - | Byte 0 |

To make the variable UniqueID8 to work propably the library uses the default bytes to 0x00. <br/>

| UniqueID8 | ESP8266 | ESP32 |
| :-------: | :------: | :------:|
| Byte 0| 0x00 | 0x00 |
| Byte 1| 0x00 | 0x00 |
| Byte 2| 0x00 | Byte 0 |
| Byte 3| 0x00 | Byte 1 |
| Byte 4| Byte 0 | Byte 2 |
| Byte 5| Byte 1 | Byte 3 |
| Byte 6| Byte 2 | Byte 4 |
| Byte 7| Byte 3 | Byte 5 |
| Byte 2| 0x00 | Byte 5 |
| Byte 3| 0x00 | Byte 4 |
| Byte 4| Byte 0 | Byte 3 |
| Byte 5| Byte 1 | Byte 2 |
| Byte 6| Byte 2 | Byte 1 |
| Byte 7| Byte 3 | Byte 0 |

## Tested Microcontroller

Expand All @@ -73,7 +73,7 @@ This library only supports AVR Microcontroller and ESP Microcontroller.
## Installation

* Install the library by [Using the Library Manager](https://www.arduino.cc/en/Guide/Libraries#toc3)
* **OR** by [Importing the .zip library](https://www.arduino.cc/en/Guide/Libraries#toc4) using either the [master](https://github.com/ricaun/ArduinoUniqueID/archive/1.0.4.zip) or one of the [releases](https://github.com/ricaun/ArduinoUniqueID/releases) ZIP files.
* **OR** by [Importing the .zip library](https://www.arduino.cc/en/Guide/Libraries#toc4) using either the [master](https://github.com/ricaun/ArduinoUniqueID/archive/1.0.5.zip) or one of the [releases](https://github.com/ricaun/ArduinoUniqueID/releases) ZIP files.

## Examples

Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=ArduinoUniqueID
version=1.0.4
version=1.0.5
author=Luiz Henrique Cassettari
maintainer=Luiz Henrique Cassettari <ricaun@gmail.com>
sentence=Arduino Library to get the AVR microcontroler Unique ID / Manufacture Serial Number.
Expand Down
12 changes: 6 additions & 6 deletions src/ArduinoUniqueID.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ ArduinoUniqueID::ArduinoUniqueID()
uint64_t chipid = ESP.getEfuseMac();
id[0] = 0;
id[1] = 0;
id[2] = chipid >> 40;
id[3] = chipid >> 32;
id[4] = chipid >> 24;
id[5] = chipid >> 16;
id[6] = chipid >> 8;
id[7] = chipid;
id[2] = chipid;
id[3] = chipid >> 8;
id[4] = chipid >> 16;
id[5] = chipid >> 24;
id[6] = chipid >> 32;
id[7] = chipid >> 40;
#endif
}

Expand Down

0 comments on commit d8465f8

Please sign in to comment.