mirror of
https://github.com/MrUnknownDE/OpenIris-ESPIDF.git
synced 2026-04-14 04:03:44 +02:00
Add led manager with support for Babble boards
This commit is contained in:
@@ -12,7 +12,6 @@
|
||||
#include "freertos/task.h"
|
||||
#include "driver/gpio.h"
|
||||
#include "esp_log.h"
|
||||
#include "led_strip.h"
|
||||
#include "sdkconfig.h"
|
||||
#include "usb_device_uvc.h"
|
||||
#include "esp_camera.h"
|
||||
@@ -22,29 +21,11 @@
|
||||
#include <openiris_logo.hpp>
|
||||
#include <wifiManager.hpp>
|
||||
#include <ProjectConfig.hpp>
|
||||
#include <LEDManager.hpp>
|
||||
|
||||
static const char *TAG = "[MAIN]";
|
||||
|
||||
/* Use project configuration menu (idf.py menuconfig) to choose the GPIO to blink,
|
||||
or you can edit the following line and set a number here.
|
||||
*/
|
||||
#define BLINK_GPIO (gpio_num_t) CONFIG_BLINK_GPIO
|
||||
|
||||
static uint8_t s_led_state = 0;
|
||||
|
||||
static void blink_led(void)
|
||||
{
|
||||
/* Set the GPIO level according to the state (LOW or HIGH)*/
|
||||
gpio_set_level(BLINK_GPIO, s_led_state);
|
||||
}
|
||||
|
||||
static void configure_led(void)
|
||||
{
|
||||
ESP_LOGI(TAG, "Example configured to blink GPIO LED!");
|
||||
gpio_reset_pin(BLINK_GPIO);
|
||||
/* Set the GPIO as a push/pull output */
|
||||
gpio_set_direction(BLINK_GPIO, GPIO_MODE_OUTPUT);
|
||||
}
|
||||
static const char *TAG = "[MAIN]";
|
||||
|
||||
static void initNVSStorage()
|
||||
{
|
||||
@@ -80,21 +61,23 @@ extern "C" void app_main(void)
|
||||
ProjectConfig deviceConfig("openiris", "openiristracker");
|
||||
WiFiManager wifiManager;
|
||||
|
||||
#ifdef USE_ILLUMNATIOR_PIN
|
||||
// LEDManager ledManager(BLINK_GPIO, ILLUMINATOR_PIN);
|
||||
LEDManager ledManager(BLINK_GPIO, 1);
|
||||
#else
|
||||
LEDManager ledManager(BLINK_GPIO);
|
||||
#endif
|
||||
|
||||
Logo::printASCII();
|
||||
initNVSStorage();
|
||||
|
||||
ledManager.setup();
|
||||
deviceConfig.load();
|
||||
wifiManager.Begin();
|
||||
|
||||
/* Configure the peripheral according to the LED type */
|
||||
configure_led();
|
||||
|
||||
while (1)
|
||||
{
|
||||
ESP_LOGI(TAG, "Turning the LED on pin %d %s!", BLINK_GPIO, s_led_state == true ? "ON" : "OFF");
|
||||
blink_led();
|
||||
/* Toggle the LED state */
|
||||
s_led_state = !s_led_state;
|
||||
ledManager.handleLED();
|
||||
vTaskDelay(CONFIG_BLINK_PERIOD / portTICK_PERIOD_MS);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user