Mikrocontroller und Digitale Elektronik
›
Thread
definiere ESP32 in ESP-Projket für FastLED
Hallo,
ich versuche gerade FastLED mit einem ESP32 zu benutzen, habe aber probleme diese einzubinden.
in der component.mk habe ich
1
CFLAGS += -DESP32
2
3
include H:\Projects\FastLED\component.mk
hinzugefügt.
Das wird auch gefunden, allerdings ist ESP32 nicht definiert und beim bauen
bekomme ich den error
1
#error "This platform isn't recognized by FastLED... yet. See comments in FastLED/led_sysdefs.h for options."
in der led_sysdefs.h ist
1
... ...
2
#elif defined(ESP32)
3
#include "platforms/esp/32/led_sysdefs_esp32.h"
4
... ...
5
#else
6
//
7
// We got here because we don't recognize the platform that you're
8
// trying to compile for: it's not AVR, or an ESP or ARM that we recognize.
9
//
10
// If you're reading this because you got the error below,
11
// and if this new platform is just a minor variant of an
12
// existing supported ARM platform, you may be able to add
13
// a new 'defined(XXX)' selector in the apporpriate code above.
14
//
15
// If this platform is a new microcontroller, see "PORTING.md".
16
//
17
#error "This platform isn't recognized by FastLED... yet. See comments in FastLED/led_sysdefs.h for options."
18
#endif
Was muss ich machen, damit ESP32 definiert wird?
JS
J. S.
(jojos)
13.07.2023 08:54
#7453672
Das aktuelle ESP IDF verwendet CMake, da werden Komponenten nicht über das .mk file hinzugefügt.
FastLed braucht Arduino, darin wird ESP32 definiert sein.
https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/build-system.html#cmake-buildsystem-api
Ich habe jetzt UncleRus/esp-idf-lib genommen. Hier wird kein Arduino für benötigt.
Hier habe ich aber ein generelles Problem.
1
#include <string.h>
2
#include <stdio.h>
3
#include "freertos/FreeRTOS.h"
4
#include "freertos/task.h"
5
#include "freertos/event_groups.h"
6
#include "driver/uart.h"
7
#include "driver/gpio.h"
8
#include "esp_log.h"
9
10
#include <led_strip.h>
11
12
#define LED_STRIP_GPIO GPIO_NUM_32
13
#define LED_STRIP_NUM_OF_PIXELS 10
14
15
16
static const rgb_t colors [] = {
17
{ . r = 0x0f , . g = 0x0f , . b = 0x0f },
18
{ . r = 0x00 , . g = 0x00 , . b = 0x2f },
19
{ . r = 0x00 , . g = 0x2f , . b = 0x00 },
20
{ . r = 0x2f , . g = 0x00 , . b = 0x00 },
21
{ . r = 0x00 , . g = 0x00 , . b = 0x00 },
22
};
23
24
#define COLORS_TOTAL (sizeof(colors) / sizeof(rgb_t))
25
26
static void ledTask ( void * pvParameters );
27
static void ledTask ( void * pvParameters )
28
{
29
static const char * TASK_TAG = "LED_TASK" ;
30
ESP_LOGI ( TASK_TAG , "Task started" );
31
esp_log_level_set ( TASK_TAG , ESP_LOG_INFO );
32
33
led_strip_t strip =
34
{
35
. type = LED_STRIP_WS2812 ,
36
. is_rgbw = false ,
37
. brightness = 100 ,
38
. length = LED_STRIP_NUM_OF_PIXELS ,
39
. gpio = LED_STRIP_GPIO ,
40
. buf = NULL ,
41
};
42
43
ESP_ERROR_CHECK ( led_strip_init ( & strip ));
44
45
size_t c = 0 ;
46
while ( 1 )
47
{
48
ESP_ERROR_CHECK ( led_strip_fill ( & strip , 0 , strip . length , colors [ c ]));
49
ESP_ERROR_CHECK ( led_strip_flush ( & strip ));
50
51
vTaskDelay ( pdMS_TO_TICKS ( 1000 ));
52
53
if ( ++ c >= COLORS_TOTAL )
54
{
55
c = 0 ;
56
}
57
}
58
}
59
60
void initLed ( void )
61
{
62
led_strip_install ();
63
xTaskCreate ( ledTask , "ledTask" , 8000 , ( void * ) 1 , tskIDLE_PRIORITY , NULL );
64
}
Der Task an für sich wird gestartet, allerdings sieht das Signal am GPIO_NUM_32 sehr falsch aus (siehe LED .png). So ein Signal kommt Sekündlich.
Ich habe ESP-IDF v4.4.2
Ich habe vorerst nur diesen Task am laufen.
Später soll dann noch ein Task fürs WiFi, einer für UART und einer welcher mir die Uhrzeit über ntp besorgt laufen. Diese Tasks laufen an für sich schon, habe ich jetzt aber erstmal rausgenommen.
Antwort schreiben
Bitte melde dich an, um einen Beitrag zu schreiben.
Noch kein Account?
Die Registrierung ist kostenlos und dauert nur eine Minute.
Jetzt registrieren