Skip to content

Commit 0e4cae5

Browse files
committed
esp8266: Make APA102 driver inclusion configurable.
1 parent 88d3cd5 commit 0e4cae5

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

esp8266/espapa102.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@
2424
* THE SOFTWARE.
2525
*/
2626

27+
#include "py/mpconfig.h"
28+
#if MICROPY_ESP8266_APA102
29+
2730
#include <stdio.h>
2831
#include "c_types.h"
2932
#include "eagle_soc.h"
@@ -108,3 +111,5 @@ void esp_apa102_write(uint8_t clockPin, uint8_t dataPin, uint8_t *pixels, uint32
108111
_esp_apa102_append_additionial_cycles(clockPinMask, dataPinMask, numBytes);
109112
_esp_apa102_end_frame(clockPinMask, dataPinMask);
110113
}
114+
115+
#endif

esp8266/modesp.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -642,6 +642,7 @@ STATIC mp_obj_t esp_neopixel_write_(mp_obj_t pin, mp_obj_t buf, mp_obj_t is800k)
642642
}
643643
STATIC MP_DEFINE_CONST_FUN_OBJ_3(esp_neopixel_write_obj, esp_neopixel_write_);
644644

645+
#if MICROPY_ESP8266_APA102
645646
STATIC mp_obj_t esp_apa102_write_(mp_obj_t clockPin, mp_obj_t dataPin, mp_obj_t buf) {
646647
mp_buffer_info_t bufinfo;
647648
mp_get_buffer_raise(buf, &bufinfo, MP_BUFFER_READ);
@@ -651,6 +652,7 @@ STATIC mp_obj_t esp_apa102_write_(mp_obj_t clockPin, mp_obj_t dataPin, mp_obj_t
651652
return mp_const_none;
652653
}
653654
STATIC MP_DEFINE_CONST_FUN_OBJ_3(esp_apa102_write_obj, esp_apa102_write_);
655+
#endif
654656

655657
STATIC mp_obj_t esp_freemem() {
656658
return MP_OBJ_NEW_SMALL_INT(system_get_free_heap_size());
@@ -695,7 +697,9 @@ STATIC const mp_map_elem_t esp_module_globals_table[] = {
695697
{ MP_OBJ_NEW_QSTR(MP_QSTR_getaddrinfo), (mp_obj_t)&esp_getaddrinfo_obj },
696698
#endif
697699
{ MP_OBJ_NEW_QSTR(MP_QSTR_neopixel_write), (mp_obj_t)&esp_neopixel_write_obj },
700+
#if MICROPY_ESP8266_APA102
698701
{ MP_OBJ_NEW_QSTR(MP_QSTR_apa102_write), (mp_obj_t)&esp_apa102_write_obj },
702+
#endif
699703
{ MP_OBJ_NEW_QSTR(MP_QSTR_dht_readinto), (mp_obj_t)&dht_readinto_obj },
700704
{ MP_OBJ_NEW_QSTR(MP_QSTR_freemem), (mp_obj_t)&esp_freemem_obj },
701705
{ MP_OBJ_NEW_QSTR(MP_QSTR_meminfo), (mp_obj_t)&esp_meminfo_obj },

esp8266/mpconfigport.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@
8888
#define MICROPY_FATFS_LFN_CODE_PAGE (437) /* 1=SFN/ANSI 437=LFN/U.S.(OEM) */
8989
#define MICROPY_FSUSERMOUNT (1)
9090
#define MICROPY_VFS_FAT (1)
91+
#define MICROPY_ESP8266_APA102 (1)
9192

9293
#define MICROPY_EVENT_POLL_HOOK {ets_event_poll();}
9394
#define MICROPY_VM_HOOK_COUNT (10)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy