Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ESP32 Support and Bug Fixes #37

Open
wants to merge 380 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
Show all changes
380 commits
Select commit Hold shift + click to select a range
6052c54
Removed Makefile. Closes #2
astagi Dec 17, 2013
43daf13
Merged ponty modifications
astagi Dec 17, 2013
cda71c2
Removed makefile files
astagi Dec 17, 2013
4a11466
test the "make" process
Dec 18, 2013
d4379e9
documentation
Dec 18, 2013
aa295f5
Merge pull request #9 from ponty/newfunctions
astagi Dec 18, 2013
cab2a53
rafactor baudrate into variable (#10)
Dec 18, 2013
6f97e4d
raise exception if there is no reply on serial line (#10)
Dec 18, 2013
4289608
serial port auto-detection is optional
Dec 18, 2013
ed0ebd8
add /dev/ttyS0 and /dev/ttyS1 to port auto-detection (#10)
Dec 18, 2013
e87fa59
firmware configuration in cfg.h (#10)
Dec 18, 2013
58a2c35
default baudrate=115200 (#10)
Dec 18, 2013
020557c
Merge pull request #11 from ponty/serial
astagi Dec 19, 2013
b4d41f9
add getBool method
llaurent Dec 28, 2013
ee7f314
support for the DHT sensor library
llaurent Dec 28, 2013
ce69dea
a simple example to read from a DHT sensor
llaurent Dec 29, 2013
f110873
begin is called when instantiating the class
llaurent Dec 29, 2013
7207af2
strcmp !!! :-)
llaurent Dec 29, 2013
11efa71
Merge branch 'master' of [email protected]:nanpy/nanpy.git
Dec 29, 2013
0b657c3
fix setup.py
Dec 29, 2013
8a7ee65
Merge pull request #12 from llaurent/dht_sensor
ponty Dec 29, 2013
e46a60d
more doc
Dec 29, 2013
a71dd1f
fix DHT lib path
Dec 29, 2013
6e886c8
restore makefiles for testing
Dec 29, 2013
ef91483
new firmware classes: counter, info
Dec 29, 2013
d803637
configurable firmware, optional short strings for communication
Dec 29, 2013
ec5f79b
more doc
Dec 29, 2013
9f434fd
remove 2 sec sleep
Dec 29, 2013
f1c70a2
refactoring serial-manager
Dec 29, 2013
c253caf
SerialManager: logging
Dec 29, 2013
e3d8bd2
SerialManager: flush after connecting
Dec 29, 2013
db14413
object based interface, firmware_id
Dec 29, 2013
1cc746f
remove test dependency: path.py
Dec 29, 2013
4e3dca9
new object based classes
Dec 29, 2013
a1c7cf9
new examples
Dec 29, 2013
1e89c16
reworked tests
Dec 29, 2013
5d138dd
remove py25 support
Dec 29, 2013
3269af2
SerialManager: 2 sec sleep, autodetection skippable, lazy open (#10)
Dec 29, 2013
3cb9552
speed up tests (skip sleep)
Dec 29, 2013
654e5a1
exception instead of assert
Dec 30, 2013
a04ff2e
renames: nr -> pin_number, name2int -> to_pin_number
Jan 5, 2014
be575c3
shiftOut
Jan 5, 2014
b5855b3
support AD9850
Jan 5, 2014
a0d265d
new example: checkspeed
Jan 5, 2014
5f816c1
fix module name
Jan 5, 2014
b5b238b
optimize DefineClass
Jan 5, 2014
f9d51c3
use NUM_DIGITAL_PINS constant
Jan 5, 2014
021aecc
explicit use of SerialManager in examples
Jan 5, 2014
1cc1bd1
fix counter for 16MHz
Jan 12, 2014
235f68e
Disable features requiring external libs
astagi Feb 22, 2014
0b7e934
Added configuration description to README, fixed contributors
astagi Feb 22, 2014
25117ac
new feature: RAM read/write
Feb 24, 2014
fe9e2e2
Moving examples under nanpy/examples to make examples part of the dis…
astagi Feb 25, 2014
ba580ec
if instead of ifdef for FreqCounter
astagi Feb 25, 2014
4e5718d
Removed useless code, do not track cfg.h
astagi Feb 25, 2014
006ffd9
Better firmware configuration
astagi Feb 25, 2014
e123eb0
Added Tone class
astagi Feb 25, 2014
b7e76c1
Restored includes, fixes #20
astagi Feb 26, 2014
ada3853
put Tone under namespace
Feb 26, 2014
331c7d8
put Tone inside #if #endif
Feb 26, 2014
a718ec4
rename Tone to ToneWrapper
Feb 26, 2014
650e943
new RAM.free() function
Feb 27, 2014
c58bd87
eeprom example: 16 bytes in one line, remove spaces
Feb 27, 2014
647504a
cache portOutputRegister, portInputRegister, portModeRegister return …
Feb 27, 2014
36ab8c8
use object based interface in more examples
Feb 27, 2014
29d43ca
use object based interface in README
Feb 27, 2014
cf2de5d
enable some modules in sample cfg.h
Feb 28, 2014
a800617
default BOARD is uno in makefile
Feb 28, 2014
b5a8c6c
move watchdog related code into WatchdogClass.cpp
Feb 28, 2014
17bec10
Added Anthony Goodhew to contributors
astagi Feb 28, 2014
840ee8f
Fixed watch dog disable at startup issue
astagi Mar 4, 2014
8a8e7ba
Separate makefile stuff
astagi Mar 4, 2014
93f2eee
Check if running on AVR for freeram.c
astagi Mar 4, 2014
8a4d4d3
Added missing configure.sh script
astagi Mar 21, 2014
af4bd8d
Removed firmware
astagi Mar 21, 2014
02e910d
Removed makefile stuff, moved to firmware repo
astagi Mar 21, 2014
a612cb2
Codegen package removed
astagi Mar 22, 2014
4d54905
Wire and I2C support
Mar 28, 2014
5240bf9
LCD I2C interface support
Mar 28, 2014
ed0c1d8
new: firmware_info
Apr 2, 2014
b02300d
SerialManager: open(), close(), timeout parameter
Apr 2, 2014
e01bc99
Add PyPi badge to README.
andreagrandi Apr 10, 2014
62abd79
Merge pull request #24 from andreagrandi/patch-1
astagi Apr 10, 2014
46fa0b7
Version 0.9
astagi Apr 21, 2014
52c8f2e
Added getResolution and setResolution for DallasTemperature
astagi Jun 8, 2014
f3cc1c9
Ignore venv
astagi Jun 8, 2014
0d15859
Added setResolution to DallasTemperature sample, request the address …
astagi Jun 8, 2014
1d6fc1d
fixed getAddress method (was missing @arduinoobjectmethod)
Aug 1, 2014
ad9c44c
Merge pull request #28 from wrik/master
astagi Aug 7, 2014
82c69f5
Added Richard Giles to CONTRIBUTORS
astagi Aug 9, 2014
efa85eb
Version 0.9.1
astagi Aug 9, 2014
6b00cbe
fix Wire.read
Aug 24, 2014
77184b4
support for bmp180 presssure sensor
Aug 24, 2014
27e3ef9
Added Graeme Pyle to contributors
astagi Sep 1, 2014
2638326
Added Justin Youngblood to CONTRIBUTORS
astagi Sep 21, 2014
0abb921
Update dallastemperature.py
DarkSotM Sep 25, 2014
95ae56b
Merge pull request #32 from DarkSotM/master
astagi Sep 25, 2014
47ce989
Set serial default timeout to None
astagi Sep 30, 2014
6ecc00c
Added missing connection parameter to all ArduinoObjects
astagi Sep 30, 2014
1bbb094
Merge pull request #33 from astagi/minfixes
astagi Sep 30, 2014
4ba2be6
Version 0.9.2
astagi Oct 2, 2014
fd1b556
Minfixes on README
astagi Oct 18, 2014
42f415e
First import for docs
astagi Oct 18, 2014
72c7224
Adds How to extend Nanpy section to docs
astagi Nov 16, 2014
e4f27fd
Merge pull request #35 from nanpy/feature/docs
astagi Nov 19, 2014
32beeb2
Restore serial timeout
astagi Dec 23, 2014
458d7bf
adding classifiers
Jan 22, 2015
244f721
more badges
Jan 22, 2015
38cca95
Python side delay for Tone
astagi Jan 31, 2015
0a47426
Set timeout to 7 seconds
astagi Jan 31, 2015
2ded6d8
Merge pull request #37 from astagi/feature/timeout
astagi Jan 31, 2015
f1b9d37
move test files
Feb 4, 2015
8fdc8a1
fix tox
Feb 4, 2015
ccf0ed4
drop support for py31, add for py34
Feb 4, 2015
8e88d8d
add travis and coverall support ( #40 )
Feb 4, 2015
5e0ee70
Add travis and coveralls badges
astagi Feb 4, 2015
c46079f
Update README.md
astagi Feb 5, 2015
cfa01c3
Merge pull request #43 from nanpy/feature/ci
astagi Feb 5, 2015
72d96b0
Update README.md
astagi Feb 5, 2015
05e8918
fix coveralls (#40)
Feb 5, 2015
63e0c99
support more MCU in vcc.py
Feb 12, 2015
39154ae
add landscape badge
Feb 16, 2015
232f6c0
fix warnings
Feb 16, 2015
2cb0e6d
Remove mytemperaturelib sample
astagi Feb 14, 2015
a4addf4
Add servo sample
astagi Feb 14, 2015
7a379d8
Functions toCelsius and toFahrenheit are now class methods
astagi Feb 14, 2015
10946da
New DallasTemperature example
astagi Feb 14, 2015
65f15ff
Fix print call in nanpy/examples
astagi Feb 15, 2015
6760a52
Update year
astagi Feb 16, 2015
c9b6b7d
Merge pull request #46 from nanpy/feature/release0.9.3
astagi Feb 16, 2015
30d7dc5
/dev/ttyACM* has highest prio
Feb 16, 2015
c5a9327
avoid mutex deadlock
Feb 17, 2015
e02c9a8
mock connection
Feb 17, 2015
ae48536
remove classmethod based classes (arduino.py and eeprom.py) #47
Feb 17, 2015
87e506a
Add reStructuredText README
Feb 18, 2015
d284447
Merge pull request #50 from Pi3R1k/master
astagi Feb 18, 2015
5f574cb
EepromLib is now EEPROM
astagi Feb 19, 2015
f6ed823
Version 0.9.3
astagi Feb 21, 2015
b3020ec
Add Badges to README.rst
Feb 22, 2015
078e8f1
Correct Badges View
Feb 22, 2015
a0c57d3
Correct Title
Feb 22, 2015
59e1473
Correct Title
Feb 22, 2015
846d4ed
Merge pull request #51 from Pi3R1k/master
astagi Feb 24, 2015
5bbd4c8
Goodbye README.md
astagi Feb 24, 2015
715df35
Add Pierrick Brun to CONTRIBUTORS
astagi Feb 26, 2015
ac931c5
Use PyPI pins flat style
astagi Feb 28, 2015
a272ed9
Add rtscts parameter to SerialManager
astagi Apr 26, 2015
43cbf98
Style fixes on dht
astagi Apr 27, 2015
5259436
New DHT example
astagi Apr 27, 2015
92eb4a3
Version 0.9.4
astagi May 2, 2015
0f843b7
Update README.rst
astagi May 8, 2015
80ac395
Update README.rst
astagi May 8, 2015
807f498
Make link actually work
May 18, 2015
6c1bd1b
add necessary import
May 18, 2015
b75f40c
Merge pull request #57 from LunarLanding/patch-2
astagi May 18, 2015
9fd3baf
Merge pull request #56 from LunarLanding/patch-1
astagi May 18, 2015
9cee560
Added Support for the Adafruit TLC5947 24-Channel PWM Driver
balzreber Aug 30, 2015
efc09aa
Merge pull request #59 from balzreber/master
astagi Aug 31, 2015
b2c5a2c
Bump version to 0.9.5
astagi Sep 6, 2015
4fc5b86
Merge remote-tracking branch 'nanpy/master'
balzreber Sep 6, 2015
ee052f6
Added Support for the Adafruit TLC5947 24-Channel PWM Driver
balzreber Sep 6, 2015
b6560d4
Merge pull request #60 from balzreber/TLC5947
astagi Sep 6, 2015
4150077
Update README.rst
astagi Sep 11, 2015
9831283
Remove Python 3.2 from travis
astagi Oct 28, 2015
09a7064
Add LCD autoscroll
michalopler Jan 28, 2016
50ef951
Add clear method for lcd
astagi Jan 30, 2016
4e293da
Add example for lcd autoscroll
astagi Jan 30, 2016
95911fe
Update copyright
astagi Jan 29, 2016
91ef078
Drop support to Python 2.6
astagi Jan 29, 2016
6a08ffd
Add requirements.txt
astagi Jan 30, 2016
7ae5505
Add auto long description detection
astagi Jan 30, 2016
9da4c5f
Add Michal Opler to CONTRIBUTORS
astagi Jan 30, 2016
388e511
Remove useless badges from README
astagi Jan 30, 2016
0a81c3a
Merge pull request #62 from nanpy/feature/drop-py26
astagi Jan 30, 2016
01adc9b
Update README.rst
astagi Jan 31, 2016
07cf708
Add INPUT_PULLUP support
astagi Feb 6, 2016
8a668ef
Add blink example on two different boards
astagi Feb 6, 2016
aeca430
Updating stepper.py to allow for 4 pin motors.
hegartybr Feb 16, 2016
7777673
Merge pull request #65 from hegartybr/patch-1
astagi Feb 20, 2016
a49a198
Add LCD createChar API
michalopler Feb 23, 2016
8f71a48
Add example for LCD createChar
michalopler Feb 23, 2016
dc54d28
Code style fix
michalopler Feb 23, 2016
849944c
Merge pull request #66 from joppi/feature/customchar
astagi Feb 27, 2016
6072e84
Update README.rst
astagi Feb 27, 2016
5e7aa25
Add Stefan Krastanov to contributors
astagi Feb 27, 2016
fb0d728
Update README.rst
astagi Mar 2, 2016
01bc64b
Bump version to 0.9.6
astagi Mar 4, 2016
44197cb
i2c: fix doc, improve example
Mar 20, 2016
5d8429e
PCF8574: implementation
Mar 20, 2016
45a307e
add example for power supply
Feb 11, 2016
00cfc62
X9C1xxx support added
Apr 14, 2016
6354ebd
support new version format (example:10608 -> 1.6.8)
Apr 14, 2016
41b14cd
parse month always as English name
Apr 14, 2016
7002966
fix digipot
Apr 18, 2016
c13cb00
doc: Supported hardware (#68)
May 4, 2016
9661d75
support esp8266
May 4, 2016
7a95026
MCP41xxx addition
egarris2 Sep 9, 2016
2e42f7d
Merge pull request #79 from egarris2/MCP41xxx_addition
astagi Sep 23, 2016
7b2b52a
Update CONTRIBUTORS
astagi Sep 23, 2016
d1e7cd1
soft reset demo: comment
Oct 6, 2016
4838e40
README: Bug reports
Nov 28, 2016
0cf1eea
README
Dec 16, 2016
b060391
Experimental PulseIn
Feb 8, 2017
88259e5
Fixed function naming error
Feb 9, 2017
2f3b2b9
DHT: make DHT example simple again
Feb 18, 2017
6387a28
dallas: parameter can be address_or_index
Feb 18, 2017
89fdd24
Merge pull request #1 from nanpy/master
Feb 26, 2017
2012283
Added ultrasonic module to nanpy
Mar 3, 2017
607b000
Merged branch master into dev
Mar 3, 2017
3c0bafb
Added useInches as ultrasonic parameter
Mar 3, 2017
b6334b4
Fixed spelling error
Mar 4, 2017
99ede2f
Fixed typo
Mar 4, 2017
b9460d5
Fixed type error
Mar 4, 2017
421ad64
Fixed naming mismatch
Mar 4, 2017
b235fc7
Fixed no return type
Mar 4, 2017
0cd7c83
Moved reading_in_range to just python
Mar 4, 2017
bb320dc
Fixes?
Mar 4, 2017
b467a73
Uh...
Mar 4, 2017
0af0e72
Merge pull request #2 from GW-Robotics/dev
Mar 8, 2017
50a3749
Wrote experimental colour sensor code
Mar 8, 2017
e81cdd7
Added missing detach function
Mar 22, 2017
7c00195
demo: improve and fix counterdemo
Apr 1, 2017
701cb70
demo: pwm_demo
Apr 1, 2017
a51418f
readme
Apr 1, 2017
81b7ea7
Merge pull request #3 from nanpy/master
Apr 4, 2017
b8df35b
Merge pull request #4 from GW-Robotics/master
Apr 4, 2017
42d362c
pwm: check if register class available
Apr 14, 2017
84a6154
ClassInfo: firmware_name_list
Apr 14, 2017
13498ea
example: print classes in dump.py
Apr 14, 2017
856d52e
Merge pull request #88 from omn0mn0m/patch-1
ponty Apr 14, 2017
b8f6813
Merge pull request #87 from GW-Robotics/dev
ponty Apr 14, 2017
cb6141e
readme: add HC-SR04 (ultrasonic sensor) #87
Apr 14, 2017
70a77de
readme: pwm is hardcoded (#73)
Apr 14, 2017
818adfb
log: message to help adding missing class to cfg.h
Apr 14, 2017
28673ba
comments
Apr 18, 2017
a0f4ce2
readme: install from github (#91)
May 22, 2017
ec672be
new: firmware_check.py
May 25, 2017
c19fb86
new: ISSUE_TEMPLATE.py
May 25, 2017
7fa648a
fixed socket connection and added py3 support
olixr Oct 7, 2019
148ffb9
Added timeout to socket connection
olixr Oct 19, 2019
755609c
Added timeout catch to socket manager
olixr Oct 21, 2019
b5d2a76
Initial commit
Aug 13, 2020
a99d150
Updated cfg check
Aug 13, 2020
78cca19
Merge branch 'master' of https://github.com/mudpi/nanpy
Aug 13, 2020
d21aeda
Revert "Merge branch 'master' of https://github.com/mudpi/nanpy"
Aug 13, 2020
7aab416
Merge branch 'master' of https://github.com/mudpi/nanpy-firmware into…
Aug 13, 2020
2c21e75
Merge esp updates to main branch
Aug 13, 2020
102d8f2
Merge pull request #1 from mudpi/esp-updates
olixr Aug 13, 2020
e7d270d
Fixed sample file locations
Aug 13, 2020
1d615ee
Fix for ESP32 pinMode
olixr Apr 18, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto
9 changes: 7 additions & 2 deletions Nanpy/ArduinoClass.cpp
Original file line number Diff line number Diff line change
@@ -17,18 +17,23 @@ void nanpy::ArduinoClass::elaborate( nanpy::MethodDescriptor* m ) {
if (strcmp(m->getName(), "r") == 0) { // digitalRead
m->returns(digitalRead(m->getInt(0)));
}

#ifndef ESP32
if (strcmp(m->getName(), "aw") == 0) { // analogWrite
analogWrite(m->getInt(0), m->getInt(1));
m->returns(0);
}
#endif

if (strcmp(m->getName(), "a") == 0) { // analogRead
m->returns(analogRead(m->getInt(0)));
}

if (strcmp(m->getName(), "pm") == 0) { // pinMode
pinMode(m->getInt(0), m->getInt(1));
int _mode = m->getInt(1);
#ifdef ESP32
_mode++;
#endif
pinMode(m->getInt(0), _mode);
m->returns(0);
}

1 change: 0 additions & 1 deletion Nanpy/ArduinoCoreClass.h
Original file line number Diff line number Diff line change
@@ -12,4 +12,3 @@ namespace nanpy {

};
};

File renamed without changes.
79 changes: 54 additions & 25 deletions Nanpy/ComChannel.cpp
Original file line number Diff line number Diff line change
@@ -3,21 +3,34 @@

#if USE_WIFI_CONNECTION

#ifdef ESP8266
#include <ESP8266WiFi.h>
#include <ESP8266mDNS.h>
#else
#ifdef ESP32
#include <WiFi.h>
#include <ESPmDNS.h>
#endif
#endif

#define DNS_NAME "nanpy"
#define DNS_NAME "mudpi"
#define SERVER_PORT 5678
#define SerialDebug Serial
#define TIMEOUT 10
#define TIMEOUT 50

WiFiServer server(SERVER_PORT);
WiFiClient client;

unsigned long currentTime = millis();
unsigned long previousTime = 0;
const long timeoutTime = 10000;

void nanpy::ComChannel::connect()
{
SerialDebug.begin(115200);
SerialDebug.println("");
WiFi.disconnect(); //Flush WiFi
delay(2000);
WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
SerialDebug.print("\nConnecting to ");
SerialDebug.println(WIFI_SSID);
@@ -63,38 +76,54 @@ void nanpy::ComChannel::connect()

bool nanpy::ComChannel::available()
{
if (!client.connected())
{
// try to connect to a new client
client = server.available();
if (client.connected())
SerialDebug.println("client connected");
}
currentTime = millis();
if (previousTime == 0) {
previousTime = currentTime;
}
if(client) {
previousTime = currentTime;
// read data from the connected client
if (client.connected() && currentTime - previousTime <= timeoutTime) {
previousTime = currentTime;
return (client.available() > 0);
}
else {
client.stop();
Serial.println("Client Disconnected.");
}
}
else
{
// read data from the connected client
return (client.available() > 0);
// try to connect to a new client
client = server.available();
if (client.connected()) {
SerialDebug.println("Client connected");
}
}
return false;
}

char nanpy::ComChannel::read_buffer[MAX_READ_BUFFER_SIZE] = {0};

void readLineFromSerial(char* extbuff) {
int i=0;
char ch = '0';
char* buff = nanpy::ComChannel::read_buffer;
do {
ch = client.read();
if(ch < 255 && ch >= 0) {
buff[i++] = ch;
}
if (i == MAX_READ_BUFFER_SIZE - 1) {
buff[i] = '\0';
break;
}
} while(ch != '\0');
strcpy(extbuff, buff);
if(client) {
if(client.connected()) {
int i=0;
char ch = '0';
char* buff = nanpy::ComChannel::read_buffer;
do {
ch = client.read();
if(ch < 255 && ch >= 0) {
buff[i++] = ch;
}
if (i == MAX_READ_BUFFER_SIZE - 1) {
buff[i] = '\0';
break;
}
} while(ch != '\0');
strcpy(extbuff, buff);
}
}
};

void nanpy::ComChannel::readLine(char* extbuff) {
1 change: 0 additions & 1 deletion Nanpy/ComChannel.h
Original file line number Diff line number Diff line change
@@ -26,4 +26,3 @@ namespace nanpy {
}

#endif

1 change: 0 additions & 1 deletion Nanpy/CounterClass.h
Original file line number Diff line number Diff line change
@@ -12,4 +12,3 @@ namespace nanpy {

};
};

4 changes: 2 additions & 2 deletions Nanpy/DHTClass.cpp
Original file line number Diff line number Diff line change
@@ -18,9 +18,9 @@ void nanpy::DHTClass::elaborate( MethodDescriptor* m ) {
if (strcmp(m->getName(),"new") == 0) {
DHT* dht;
if (m->getNArgs() == 3) {
dht = new DHT (m->getInt(0), m->getInt(1), m->getInt(2));
dht = new DHT (m->getInt(0), m->getInt(1), m->getInt(2));
} else {
dht = new DHT (m->getInt(0), m->getInt(1));
dht = new DHT (m->getInt(0), m->getInt(1));
}
dht->begin();
v.insert(dht);
1 change: 0 additions & 1 deletion Nanpy/DefineClass.h
Original file line number Diff line number Diff line change
@@ -12,4 +12,3 @@ namespace nanpy {

};
};

117 changes: 117 additions & 0 deletions Nanpy/EspClass.cpp
Original file line number Diff line number Diff line change
@@ -117,4 +117,121 @@ void nanpy::EspClass::elaborate( nanpy::MethodDescriptor* m ) {
}
};

#else
#ifdef ESP32
#include "EspClass.h"
#include <stdlib.h>

const char* nanpy::EspClass::get_firmware_id()
{
return "Esp";
}
//https://github.com/espressif/arduino-esp32/blob/master/cores/esp32/Esp.cpp
void nanpy::EspClass::elaborate( nanpy::MethodDescriptor* m ) {
// if (strcmp(m->getName(), "wdtEnable") == 0) {
// ESP.wdtEnable(100);
// m->returns(0);
// }
// if (strcmp(m->getName(), "wdtDisable") == 0) {
// ESP.wdtDisable();
// m->returns(0);
// }
//
// if (strcmp(m->getName(), "wdtFeed") == 0) {
// ESP.wdtFeed();
// m->returns(0);
// }
// if (strcmp(m->getName(), "deepSleep") == 0) {
// ESP.deepSleep();
// m->returns(0);
// }
if (strcmp(m->getName(), "reset") == 0) {
ESP.restart();
m->returns(0);
}
if (strcmp(m->getName(), "restart") == 0) {
ESP.restart();
m->returns(0);
}
// if (strcmp(m->getName(), "getVcc") == 0) {
//// m->returns(ESP.getVcc());
// }
if (strcmp(m->getName(), "getFreeHeap") == 0) {
m->returns(ESP.getFreeHeap());
}
if (strcmp(m->getName(), "getChipId") == 0) {
m->returns(ESP.getChipRevision());
}
if (strcmp(m->getName(), "getSdkVersion") == 0) {
m->returns(ESP.getSdkVersion());
}
// if (strcmp(m->getName(), "getBootVersion") == 0) {
//// m->returns(ESP.getBootVersion());
// }
// if (strcmp(m->getName(), "getBootMode") == 0) {
//// m->returns(ESP.getFlashChipMode());
// }
if (strcmp(m->getName(), "getCpuFreqMHz") == 0) {
m->returns("80MHZ");
}
// if (strcmp(m->getName(), "getFlashChipId") == 0) {
// m->returns(ESP.getFlashChipId());
// }
// if (strcmp(m->getName(), "getFlashChipRealSize") == 0) {
// m->returns(ESP.getFlashChipRealSize());
// }

if (strcmp(m->getName(), "getFlashChipSize") == 0) {
m->returns(ESP.getFlashChipSize());
}
if (strcmp(m->getName(), "getFlashChipSpeed") == 0) {
m->returns(ESP.getFlashChipSpeed());
}
if (strcmp(m->getName(), "getFlashChipMode") == 0) {
m->returns(ESP.getFlashChipMode());
}
// if (strcmp(m->getName(), "magicFlashChipSize") == 0) {
// m->returns(ESP.magicFlashChipSize());
// }
// if (strcmp(m->getName(), "magicFlashChipSpeed") == 0) {
// m->returns(ESP.magicFlashChipSpeed());
// }
// if (strcmp(m->getName(), "magicFlashChipMode") == 0) {
// m->returns(ESP.magicFlashChipMode());
// }
// if (strcmp(m->getName(), "getFlashChipSizeByChipId") == 0) {
// m->returns(ESP.getFlashChipSizeByChipId());
// }
// if (strcmp(m->getName(), "checkFlashConfig") == 0) {
// m->returns(ESP.checkFlashConfig());
// }
// if (strcmp(m->getName(), "getResetReason") == 0) {
// String s = ESP.getResetReason();
// m->returns(s);
// }
// if (strcmp(m->getName(), "getResetInfo") == 0) {
// String s = ESP.getResetInfo();
// m->returns(s);
// }
if (strcmp(m->getName(), "getSketchSize") == 0) {
m->returns(ESP.getSketchSize());
}
if (strcmp(m->getName(), "getFreeSketchSpace") == 0) {
m->returns(ESP.getFreeSketchSpace());
}
if (strcmp(m->getName(), "flashEraseSector") == 0) {
m->returns(ESP.flashEraseSector(m->getInt(0)));
}
if (strcmp(m->getName(), "flashWrite") == 0) {
uint32_t data = m->getInt(1);
m->returns(ESP.flashWrite(m->getInt(0), &data, 1));
}
if (strcmp(m->getName(), "flashRead") == 0) {
uint32_t data;
ESP.flashRead(m->getInt(0), &data, 1);
m->returns(data);
}
};

#endif
#endif
1 change: 0 additions & 1 deletion Nanpy/FreqCount.h
Original file line number Diff line number Diff line change
@@ -11,4 +11,3 @@ class FreqCountClass {
};

extern FreqCountClass FreqCount;

1 change: 0 additions & 1 deletion Nanpy/InfoClass.h
Original file line number Diff line number Diff line change
@@ -12,4 +12,3 @@ namespace nanpy {

};
};

File renamed without changes.
1 change: 0 additions & 1 deletion Nanpy/MethodDescriptor.cpp
Original file line number Diff line number Diff line change
@@ -125,4 +125,3 @@ void nanpy::MethodDescriptor::returns(long val) {
void nanpy::MethodDescriptor::returns(unsigned long val) {
ComChannel::println(val);
}

File renamed without changes.
1 change: 0 additions & 1 deletion Nanpy/RegisterClass.cpp
Original file line number Diff line number Diff line change
@@ -110,4 +110,3 @@ void nanpy::RegisterClass::elaborate(nanpy::MethodDescriptor* m)
}

#endif

1 change: 0 additions & 1 deletion Nanpy/RegisterClass.h
Original file line number Diff line number Diff line change
@@ -11,4 +11,3 @@ namespace nanpy {

};
};

1 change: 0 additions & 1 deletion Nanpy/ServoClass.cpp
Original file line number Diff line number Diff line change
@@ -50,4 +50,3 @@ void nanpy::ServoClass::elaborate( nanpy::MethodDescriptor* m ) {
}

#endif

14 changes: 10 additions & 4 deletions Nanpy/cfg_check.h
Original file line number Diff line number Diff line change
@@ -5,14 +5,14 @@
#ifndef ARDUINO_ARCH_AVR
// disable AVR only features
#define USE_ArduinoCore 0
//#define USE_RAM 0
//#define USE_RAM 0
#define USE_EEPROM 0
#define USE_Register 0
#define USE_Watchdog 0
#define USE_Counter 0
#define USE_DHT 0
#define USE_LiquidCrystal_I2C 0
#define USE_LiquidCrystal 0
#define USE_LiquidCrystal 0
#endif

// check configuration for problems
@@ -28,11 +28,17 @@
#ifdef ESP8266
# define USE_ESP 1
#else
#ifdef ESP32
# define USE_ESP_32 1
# define USE_ESP 1
# define USE_DHT 1
#else
# define USE_ESP 0
#endif
#endif

#ifndef ESP8266
#ifndef ESP32
# define USE_WIFI_CONNECTION 0
#endif


#endif
2 changes: 1 addition & 1 deletion Nanpy/cfg_defaults.h
Original file line number Diff line number Diff line change
@@ -81,7 +81,7 @@
#endif

#ifndef USE_DHT
# define USE_DHT 0
# define USE_DHT 1
#endif

#ifndef USE_LiquidCrystal_I2C
1 change: 0 additions & 1 deletion Nanpy/consts.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#pragma once

#define MAX_READ_BUFFER_SIZE 50

2 changes: 1 addition & 1 deletion Nanpy/freeram.c
Original file line number Diff line number Diff line change
@@ -62,4 +62,4 @@ int free_ram3()

return size;
}
#endif
#endif
1 change: 0 additions & 1 deletion Nanpy/freeram.h
Original file line number Diff line number Diff line change
@@ -12,4 +12,3 @@ int free_ram3();
#ifdef __cplusplus
}
#endif

2 changes: 1 addition & 1 deletion Nanpy/generated_avr_registers.h
Original file line number Diff line number Diff line change
@@ -13761,4 +13761,4 @@
DEFINE(XOSC_CTRL)
#else
MISSING(XOSC_CTRL)
#endif
#endif
Loading