2021-02-28 19:50:37 +00:00
|
|
|
/*
|
|
|
|
xdrv_52_3_berry_embedded.ino - Berry scripting language, embedded code
|
|
|
|
|
|
|
|
Copyright (C) 2021 Stephan Hadinger, Berry language by Guan Wenliang https://github.com/Skiars/berry
|
|
|
|
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef USE_BERRY
|
|
|
|
|
|
|
|
/*********************************************************************************************\
|
|
|
|
* Handlers for Berry calls and async
|
2021-04-11 14:39:59 +01:00
|
|
|
*
|
2021-02-28 19:50:37 +00:00
|
|
|
\*********************************************************************************************/
|
|
|
|
|
|
|
|
const char berry_prog[] =
|
2021-10-20 18:04:18 +01:00
|
|
|
|
|
|
|
#ifdef USE_BERRY_PYTHON_COMPAT
|
|
|
|
// enable python syntax compatibility mode
|
|
|
|
"import python_compat "
|
|
|
|
#endif
|
2021-03-13 21:42:24 +00:00
|
|
|
|
2021-04-24 11:11:06 +01:00
|
|
|
#ifdef USE_ENERGY_SENSOR
|
2021-03-13 21:42:24 +00:00
|
|
|
"import energy "
|
2021-04-24 11:11:06 +01:00
|
|
|
#endif
|
2021-02-28 19:50:37 +00:00
|
|
|
|
|
|
|
// Instantiate tasmota object
|
|
|
|
"tasmota = Tasmota() "
|
2021-03-27 18:02:22 +00:00
|
|
|
"def log(m,l) tasmota.log(m,l) end "
|
2021-06-12 10:12:57 +01:00
|
|
|
"def load(f) return tasmota.load(f) end "
|
2021-03-21 09:03:58 +00:00
|
|
|
|
2021-11-13 19:45:27 +00:00
|
|
|
#ifdef USE_AUTOCONF
|
|
|
|
// autoconf
|
|
|
|
"import autoconf "
|
|
|
|
#endif // USE_AUTOCONF
|
|
|
|
|
2021-04-19 07:40:11 +01:00
|
|
|
#ifdef USE_LVGL
|
2021-10-15 18:34:37 +01:00
|
|
|
"import lv "
|
2021-12-27 17:12:38 +00:00
|
|
|
"import lv_tasmota "
|
2021-10-02 08:33:59 +01:00
|
|
|
// create the '_lvgl' global singleton
|
|
|
|
"_lvgl = LVGL_glob() "
|
2021-04-19 07:40:11 +01:00
|
|
|
|
|
|
|
#endif // USE_LVGL
|
|
|
|
|
2021-04-11 14:14:10 +01:00
|
|
|
#ifdef USE_I2C
|
2021-03-28 18:07:48 +01:00
|
|
|
"tasmota.wire1 = Wire(1) "
|
|
|
|
"tasmota.wire2 = Wire(2) "
|
|
|
|
"wire1 = tasmota.wire1 "
|
|
|
|
"wire2 = tasmota.wire2 "
|
2021-04-11 14:14:10 +01:00
|
|
|
#endif // USE_I2C
|
|
|
|
|
2021-04-03 17:06:40 +01:00
|
|
|
// auto-import gpio
|
|
|
|
"import gpio "
|
2021-04-11 14:14:10 +01:00
|
|
|
|
2021-04-04 18:36:25 +01:00
|
|
|
#ifdef USE_LIGHT
|
|
|
|
"import light "
|
|
|
|
#endif // USE_LIGHT
|
2022-02-13 21:59:43 +00:00
|
|
|
|
|
|
|
#if defined(USE_EMULATION) && defined(USE_EMULATION_HUE)
|
|
|
|
"import hue_bridge "
|
|
|
|
#endif
|
|
|
|
|
|
|
|
"import tapp "
|
|
|
|
|
2021-02-28 19:50:37 +00:00
|
|
|
;
|
|
|
|
|
|
|
|
#endif // USE_BERRY
|