summaryrefslogtreecommitdiffstatshomepage
path: root/esp8266
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2016-10-09 00:56:46 +0300
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2016-10-09 00:56:46 +0300
commit3b3612c65b2de4fdb2d21945e98d1dad7e46b6d6 (patch)
treea826683fe13dd5e3809fc58c4fc24390a4b71c0b /esp8266
parentdc43508cc2125b92b95b886bf687544508ae1854 (diff)
downloadmicropython-3b3612c65b2de4fdb2d21945e98d1dad7e46b6d6.tar.gz
micropython-3b3612c65b2de4fdb2d21945e98d1dad7e46b6d6.zip
esp8266: Make neopixel support configurable.
To save iRAM.
Diffstat (limited to 'esp8266')
-rw-r--r--esp8266/espneopixel.c5
-rw-r--r--esp8266/modesp.c2
-rw-r--r--esp8266/mpconfigport.h1
3 files changed, 8 insertions, 0 deletions
diff --git a/esp8266/espneopixel.c b/esp8266/espneopixel.c
index e16c874f23..27c7731064 100644
--- a/esp8266/espneopixel.c
+++ b/esp8266/espneopixel.c
@@ -5,6 +5,9 @@
// ESP8266 work for the NeoPixelBus library: github.com/Makuna/NeoPixelBus
// Needs to be a separate .c file to enforce ICACHE_RAM_ATTR execution.
+#include "py/mpconfig.h"
+#if MICROPY_ESP8266_NEOPIXEL
+
#include "c_types.h"
#include "eagle_soc.h"
#include "user_interface.h"
@@ -58,3 +61,5 @@ void /*ICACHE_RAM_ATTR*/ esp_neopixel_write(uint8_t pin, uint8_t *pixels, uint32
while((mp_hal_ticks_cpu() - startTime) < period); // Wait for last bit
mp_hal_quiet_timing_exit(irq_state);
}
+
+#endif // MICROPY_ESP8266_NEOPIXEL
diff --git a/esp8266/modesp.c b/esp8266/modesp.c
index e081f57dab..515319c9e0 100644
--- a/esp8266/modesp.c
+++ b/esp8266/modesp.c
@@ -710,7 +710,9 @@ STATIC const mp_map_elem_t esp_module_globals_table[] = {
{ MP_OBJ_NEW_QSTR(MP_QSTR_socket), (mp_obj_t)&esp_socket_type },
{ MP_OBJ_NEW_QSTR(MP_QSTR_getaddrinfo), (mp_obj_t)&esp_getaddrinfo_obj },
#endif
+ #if MICROPY_ESP8266_NEOPIXEL
{ MP_OBJ_NEW_QSTR(MP_QSTR_neopixel_write), (mp_obj_t)&esp_neopixel_write_obj },
+ #endif
#if MICROPY_ESP8266_APA102
{ MP_OBJ_NEW_QSTR(MP_QSTR_apa102_write), (mp_obj_t)&esp_apa102_write_obj },
#endif
diff --git a/esp8266/mpconfigport.h b/esp8266/mpconfigport.h
index b59d6ef88b..19cf9a6792 100644
--- a/esp8266/mpconfigport.h
+++ b/esp8266/mpconfigport.h
@@ -91,6 +91,7 @@
#define MICROPY_FSUSERMOUNT (1)
#define MICROPY_VFS_FAT (1)
#define MICROPY_ESP8266_APA102 (1)
+#define MICROPY_ESP8266_NEOPIXEL (1)
#define MICROPY_EVENT_POLL_HOOK {ets_event_poll();}
#define MICROPY_VM_HOOK_COUNT (10)