From 75a6ea67e3afe146b714697f6b045e6954eccc9b Mon Sep 17 00:00:00 2001 From: Francesco Date: Mon, 11 Oct 2021 01:26:22 +0200 Subject: [PATCH] Delete lib directory --- lib/esp-adv-button | 1 - lib/esp-led-codes/component.mk | 9 --- lib/esp-led-codes/led_codes.c | 137 --------------------------------- lib/esp-led-codes/led_codes.h | 43 ----------- 4 files changed, 190 deletions(-) delete mode 160000 lib/esp-adv-button delete mode 100755 lib/esp-led-codes/component.mk delete mode 100755 lib/esp-led-codes/led_codes.c delete mode 100755 lib/esp-led-codes/led_codes.h diff --git a/lib/esp-adv-button b/lib/esp-adv-button deleted file mode 160000 index 60cc028..0000000 --- a/lib/esp-adv-button +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 60cc028f58d402f9390a83902ffe11164b9e3af0 diff --git a/lib/esp-led-codes/component.mk b/lib/esp-led-codes/component.mk deleted file mode 100755 index 9c5a066..0000000 --- a/lib/esp-led-codes/component.mk +++ /dev/null @@ -1,9 +0,0 @@ -# Component makefile for led_codes - -INC_DIRS += $(led_codes_ROOT) - -led_codes_INC_DIR = $(led_codes_ROOT) -led_codes_SRC_DIR = $(led_codes_ROOT) - -$(eval $(call component_compile_rules,led_codes)) - diff --git a/lib/esp-led-codes/led_codes.c b/lib/esp-led-codes/led_codes.c deleted file mode 100755 index 33468a3..0000000 --- a/lib/esp-led-codes/led_codes.c +++ /dev/null @@ -1,137 +0,0 @@ -/* - * LED Codes Library - * - * Copyright 2018-2019 José A. Jiménez (@RavenSystem) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include -#include -#include -#include -#include -#include - -#include "led_codes.h" - -#define DURATION_OFF 130 -#define DURATION_ON_MIN 20 - -typedef struct _led { - uint8_t gpio; - bool inverted; - bool status; - - blinking_params_t blinking_params; - - ETSTimer timer; - uint8_t count; - uint32_t delay; - - struct _led *next; -} led_t; - -static led_t *leds = NULL; - -static led_t *led_find_by_gpio(const uint8_t gpio) { - led_t *led = leds; - - while (led && led->gpio != gpio) { - led = led->next; - } - - return led; -} - -static void led_code_run(void *params) { - led_t *led = params; - - led->status = !led->status; - gpio_write(led->gpio, led->status); - - if (led->status == led->inverted) { - led->delay = DURATION_OFF; - led->count++; - } else { - led->delay = (led->blinking_params.duration * 1000) + DURATION_ON_MIN; - } - - if (led->count < led->blinking_params.times) { - sdk_os_timer_arm(&led->timer, led->delay, 0); - } -} - -void led_code(const uint8_t gpio, blinking_params_t blinking_params) { - led_t *led = led_find_by_gpio(gpio); - - if (led) { - sdk_os_timer_disarm(&led->timer); - - led->blinking_params = blinking_params; - led->status = led->inverted; - led->count = 0; - - led_code_run(led); - } -} - -int led_create(const uint8_t gpio, const bool inverted) { - led_t *led = led_find_by_gpio(gpio); - - if (!led) { - led = malloc(sizeof(led_t)); - memset(led, 0, sizeof(*led)); - - led->next = leds; - leds = led; - - sdk_os_timer_setfn(&led->timer, led_code_run, led); - - led->gpio = gpio; - led->inverted = inverted; - led->status = inverted; - - gpio_enable(led->gpio, GPIO_OUTPUT); - gpio_write(led->gpio, led->status); - - return 0; - } - - return -1; -} - -void led_destroy(const uint8_t gpio) { - if (leds) { - led_t *led = NULL; - if (leds->gpio == gpio) { - led = leds; - leds = leds->next; - } else { - led_t *l = leds; - while (l->next) { - if (l->next->gpio == gpio) { - led = l->next; - l->next = l->next->next; - break; - } - } - } - - if (led) { - if (led->gpio != 0) { - gpio_disable(led->gpio); - } - } - } -} diff --git a/lib/esp-led-codes/led_codes.h b/lib/esp-led-codes/led_codes.h deleted file mode 100755 index be7b406..0000000 --- a/lib/esp-led-codes/led_codes.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * LED Codes Library - * - * Copyright 2018-2019 José A. Jiménez (@RavenSystem) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -typedef struct blinking_params_t { - uint8_t times; - uint8_t duration; -} blinking_params_t; - -#define GENERIC_ERROR (blinking_params_t){6,0} -#define SENSOR_ERROR (blinking_params_t){8,0} -#define WIFI_CONNECTED (blinking_params_t){1,2} -#define IDENTIFY_ACCESSORY (blinking_params_t){1,3} -#define RESTART_DEVICE (blinking_params_t){2,2} -#define WIFI_CONFIG_RESET (blinking_params_t){2,0} -#define EXTRA_CONFIG_RESET (blinking_params_t){2,1} -#define FUNCTION_A (blinking_params_t){1,0} -#define FUNCTION_B (blinking_params_t){2,0} -#define FUNCTION_C (blinking_params_t){3,0} -#define FUNCTION_D (blinking_params_t){4,0} -#define FUNCTION_E (blinking_params_t){5,0} -#define FUNCTION_F (blinking_params_t){6,0} - -int led_create(const uint8_t gpio, const bool inverted); -void led_destroy(const uint8_t gpio); - -void led_code(const uint8_t gpio, blinking_params_t blinking_params);