diff --git a/.gitmodules b/.gitmodules index 6790fd5..2ebfb8a 100644 --- a/.gitmodules +++ b/.gitmodules @@ -34,3 +34,6 @@ [submodule "extras/libesphttpd/libesphttpd/lib/heatshrink"] path = extras/libesphttpd/libesphttpd/lib/heatshrink url = https://github.com/atomicobject/heatshrink +[submodule "extras/multipwm"] + path = extras/multipwm + url = https://github.com/nochkin/multipwm diff --git a/examples/multipwm/Makefile b/examples/multipwm/Makefile new file mode 100644 index 0000000..4138f8b --- /dev/null +++ b/examples/multipwm/Makefile @@ -0,0 +1,4 @@ +# Simple makefile for multipwm example +PROGRAM=multipwm_test +EXTRA_COMPONENTS = extras/multipwm +include ../../common.mk diff --git a/examples/multipwm/multipwm_test.c b/examples/multipwm/multipwm_test.c new file mode 100644 index 0000000..46ddce8 --- /dev/null +++ b/examples/multipwm/multipwm_test.c @@ -0,0 +1,50 @@ +/* An example for the multipwm library + * Connect LEDs to pins 12, 13, 15 to see the light changes + * + * Part of esp-open-rtos + * Copyright (c) Sashka Nochkin (https://github.com/nochkin) + * MIT Licensed + */ + +#include "espressif/esp_common.h" +#include "esp/uart.h" +#include "FreeRTOS.h" +#include "task.h" + +#include "multipwm.h" + +void multipwm_task(void *pvParameters) +{ + uint32_t counts[] = {500, 2100, 3000}; + int32_t steps[] = {100, 300, 200}; + uint8_t pins[] = { 12, 13, 15}; + + pwm_info_t pwm_info; + pwm_info.channels = 3; + + multipwm_init(&pwm_info); + for (uint8_t ii=0; ii= 10000) || (counts[ii] == 0)) { + steps[ii] = -steps[ii]; + } + } + multipwm_start(&pwm_info); + vTaskDelay(1); + } +} + +void user_init(void) +{ + uart_set_baud(0, 115200); + printf("SDK version:%s\n", sdk_system_get_sdk_version()); + + xTaskCreate(multipwm_task, "multipwm", 256, NULL, 2, NULL); +} diff --git a/extras/multipwm b/extras/multipwm new file mode 160000 index 0000000..44ecea5 --- /dev/null +++ b/extras/multipwm @@ -0,0 +1 @@ +Subproject commit 44ecea5757bee0112c65f33eadb44e91a8923535