Added sample ESP32 program
Can be built with Arduino IDE and edited with Eclipse CDT
This commit is contained in:
parent
7f7b62f71a
commit
de1de315cc
1
.gitignore
vendored
1
.gitignore
vendored
@ -2,3 +2,4 @@
|
|||||||
/schema/*/_autosave-*.sch
|
/schema/*/_autosave-*.sch
|
||||||
/schema/*/*-backups
|
/schema/*/*-backups
|
||||||
|
|
||||||
|
/.metadata/
|
||||||
|
20
ESP32/.cproject
Normal file
20
ESP32/.cproject
Normal file
@ -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
Normal file
1
ESP32/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
/build/
|
20
ESP32/.project
Normal file
20
ESP32/.project
Normal file
@ -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
Normal file
3
ESP32/ESP32.ino
Normal file
@ -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
Normal file
31
ESP32/vehicle-monitor.cpp
Normal file
@ -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…
Reference in New Issue
Block a user