Browse Source

Added sample ESP32 program

Can be built with Arduino IDE and edited with Eclipse CDT
master
Youen Toupin 2 years ago
parent
commit
de1de315cc
  1. 1
      .gitignore
  2. 20
      ESP32/.cproject
  3. 1
      ESP32/.gitignore
  4. 20
      ESP32/.project
  5. 3
      ESP32/ESP32.ino
  6. 31
      ESP32/vehicle-monitor.cpp

1
.gitignore vendored

@ -2,3 +2,4 @@
/schema/*/_autosave-*.sch
/schema/*/*-backups
/.metadata/

20
ESP32/.cproject

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
<storageModule moduleId="org.eclipse.cdt.core.settings">
<cconfiguration id="org.eclipse.cdt.core.default.config.1559961769">
<storageModule buildSystemId="org.eclipse.cdt.core.defaultConfigDataProvider" id="org.eclipse.cdt.core.default.config.1559961769" moduleId="org.eclipse.cdt.core.settings" name="Configuration">
<externalSettings/>
<extensions/>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
</cconfiguration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
<storageModule moduleId="org.eclipse.cdt.core.pathentry">
<pathentry include="~/.arduino15/packages/esp32/hardware/esp32/1.0.6/cores/esp32" kind="inc" path="" system="true"/>
<pathentry include="~/.arduino15/packages/esp32/hardware/esp32/1.0.6/tools/sdk/include/newlib" kind="inc" path="" system="true"/>
<pathentry kind="out" path="build"/>
<pathentry kind="src" path=""/>
</storageModule>
</cproject>

1
ESP32/.gitignore vendored

@ -0,0 +1 @@
/build/

20
ESP32/.project

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>ESP32</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.cdt.core.cBuilder</name>
<triggers>clean,full,incremental,</triggers>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.cdt.core.cnature</nature>
<nature>org.eclipse.cdt.core.ccnature</nature>
<nature>org.eclipse.cdt.make.core.makeNature</nature>
</natures>
</projectDescription>

3
ESP32/ESP32.ino

@ -0,0 +1,3 @@
// This file only exists to make the Arduino IDE happy
// The actual entry points are in vehicle-monitor.cpp (because .ino extension is non-standard)
// Notice we don't even need to include anything as the Arduino IDE automatically compiles all .cpp files that are in the sketch folder

31
ESP32/vehicle-monitor.cpp

@ -0,0 +1,31 @@
/* The true ESP32 chip ID is essentially its MAC address.
This sketch provides an alternate chip ID that matches
the output of the ESP.getChipId() function on ESP8266
(i.e. a 32-bit integer matching the last 3 bytes of
the MAC address. This is less unique than the
MAC address chip ID, but is helpful when you need
an identifier that can be no more than a 32-bit integer
(like for switch...case).
created 2020-06-07 by cweinhofer
with help from Cicicok */
#include <Arduino.h>
uint32_t chipId = 0;
void setup() {
Serial.begin(115200);
}
void loop() {
for(int i=0; i<17; i=i+8) {
chipId |= ((ESP.getEfuseMac() >> (40 - i)) & 0xff) << i;
}
Serial.printf("ESP32 Chip model = %s Rev %d\n", ESP.getChipModel(), ESP.getChipRevision());
Serial.printf("This chip has %d cores\n", ESP.getChipCores());
Serial.print("Chip ID: "); Serial.println(chipId);
delay(3000);
}
Loading…
Cancel
Save