diff options
Diffstat (limited to 'esp8266/modesp.c')
| -rw-r--r-- | esp8266/modesp.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/esp8266/modesp.c b/esp8266/modesp.c index 73cfc4275..18859ead8 100644 --- a/esp8266/modesp.c +++ b/esp8266/modesp.c @@ -39,6 +39,8 @@ #include "espconn.h" #include "spi_flash.h" #include "utils.h" +#include "espneopixel.h" +#include "modpyb.h" #define MODESP_ESPCONN (0) @@ -573,6 +575,15 @@ STATIC mp_obj_t esp_flash_erase(mp_obj_t sector_in) { } STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp_flash_erase_obj, esp_flash_erase); +STATIC mp_obj_t esp_neopixel_write_(mp_obj_t pin, mp_obj_t buf, mp_obj_t is800k) { + mp_buffer_info_t bufinfo; + mp_get_buffer_raise(buf, &bufinfo, MP_BUFFER_READ); + esp_neopixel_write(mp_obj_get_pin_obj(pin)->phys_port, + (uint8_t*)bufinfo.buf, bufinfo.len, mp_obj_is_true(is800k)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_3(esp_neopixel_write_obj, esp_neopixel_write_); + STATIC const mp_map_elem_t esp_module_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_esp) }, @@ -586,6 +597,7 @@ 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 + { MP_OBJ_NEW_QSTR(MP_QSTR_neopixel_write), (mp_obj_t)&esp_neopixel_write_obj }, #if MODESP_INCLUDE_CONSTANTS { MP_OBJ_NEW_QSTR(MP_QSTR_MODE_11B), |
