Clean up PWM - ready for testing

To do: Test RGB LED Examples with ESP32 and ESP32-S2 boards.

Next:  Re-work Remote Control routines to make compatible with S2 and C3
This commit is contained in:
Gregg 2021-09-19 13:53:20 -05:00
parent fdc3dfb474
commit 61a87ccc63
5 changed files with 7 additions and 73 deletions

BIN
.DS_Store vendored

Binary file not shown.

2
.gitignore vendored
View File

@ -1 +1,3 @@
.development .development
.DS_Store
src/.DS_Store

BIN
src/.DS_Store vendored

Binary file not shown.

View File

@ -16,9 +16,6 @@
#include <Arduino.h> #include <Arduino.h>
#include <driver/ledc.h> #include <driver/ledc.h>
#include <vector>
using std::vector;
#define DEFAULT_PWM_FREQ 5000 #define DEFAULT_PWM_FREQ 5000

View File

@ -3,8 +3,6 @@
// as well as compile and test from this point. This file is ignored when the library is included in other sketches. // as well as compile and test from this point. This file is ignored when the library is included in other sketches.
#include "PwmPin.h" #include "PwmPin.h"
#include <soc/ledc_reg.h>
#include "esp_rom_gpio.h"
void setup(){ void setup(){
@ -17,76 +15,13 @@ void setup(){
LedPin *led[20]; LedPin *led[20];
// int p[]={33,27,4,32,18,19,16,17,5}; // uint8_t p[]={33,27,4,32,18,19,16,17,5}; // ESP32 test
int p[]={11,7,3,1,38,33,9}; uint8_t p[]={11,7,3,1,38,33,9,10}; // ESP32-S2 test
for(int i=0;i<sizeof(p)/4;i++) for(int i=0;i<sizeof(p);i++)
led[i]=new LedPin(p[i],20,5000+i); led[i]=new LedPin(p[i],20,5000);
new LedPin(10,200,65535); led[7]->set(100);
new LedPin(5,200,65535);
//Serial.printf("HSTIMER0: %d %d %d %d\n",
// REG_GET_FIELD(LEDC_HSTIMER0_CONF_REG,LEDC_TICK_SEL_HSTIMER0),
// REG_GET_FIELD(LEDC_HSTIMER0_CONF_REG,LEDC_DIV_NUM_HSTIMER0)>>8,
// REG_GET_FIELD(LEDC_HSTIMER0_CONF_REG,LEDC_DIV_NUM_HSTIMER0)&0xFF,
// REG_GET_FIELD(LEDC_HSTIMER0_CONF_REG,LEDC_HSTIMER0_DUTY_RES)
// );
//
//Serial.printf("HSCHAN0: %d %d %d %d %d\n",
// REG_READ(LEDC_HSCH0_CONF0_REG),
// REG_READ(LEDC_HSCH0_HPOINT_REG),
// REG_READ(LEDC_HSCH0_DUTY_REG)>>4,
// REG_READ(LEDC_HSCH0_DUTY_REG)&0xF,
// REG_GET_FIELD(LEDC_HSCH0_CONF1_REG,LEDC_DUTY_INC_HSCH0)
// );
//
//Serial.printf("LSTIMER0: %d %d %d %d\n",
// REG_GET_FIELD(LEDC_LSTIMER0_CONF_REG,LEDC_TICK_SEL_LSTIMER0),
// REG_GET_FIELD(LEDC_LSTIMER0_CONF_REG,LEDC_DIV_NUM_LSTIMER0)>>8,
// REG_GET_FIELD(LEDC_LSTIMER0_CONF_REG,LEDC_DIV_NUM_LSTIMER0)&0xFF,
// REG_GET_FIELD(LEDC_LSTIMER0_CONF_REG,LEDC_LSTIMER0_DUTY_RES)
// );
//
//delay(100);
//
//Serial.printf("LSCHAN0: %d %d %d %d %d\n",
// REG_READ(LEDC_LSCH0_CONF0_REG),
// REG_READ(LEDC_LSCH0_HPOINT_REG),
// REG_READ(LEDC_LSCH0_DUTY_REG)>>4,
// REG_READ(LEDC_LSCH0_DUTY_REG)&0xF,
// REG_GET_FIELD(LEDC_LSCH0_CONF1_REG,LEDC_DUTY_INC_LSCH0)
// );
//
//Serial.printf("LOW CLOCK: %d\n",REG_READ(LEDC_CONF_REG));
//
//Serial.printf("GPIO 32: %d %d %d %d\n",
// REG_GET_FIELD(GPIO_FUNC32_OUT_SEL_CFG_REG,GPIO_FUNC32_OEN_INV_SEL),
// REG_GET_FIELD(GPIO_FUNC32_OUT_SEL_CFG_REG,GPIO_FUNC32_OEN_SEL),
// REG_GET_FIELD(GPIO_FUNC32_OUT_SEL_CFG_REG,GPIO_FUNC32_OUT_INV_SEL),
// REG_GET_FIELD(GPIO_FUNC32_OUT_SEL_CFG_REG,GPIO_FUNC32_OUT_SEL)
// );
//
//Serial.printf("GPIO 5: %d %d %d %d\n",
// REG_GET_FIELD(GPIO_FUNC5_OUT_SEL_CFG_REG,GPIO_FUNC5_OEN_INV_SEL),
// REG_GET_FIELD(GPIO_FUNC5_OUT_SEL_CFG_REG,GPIO_FUNC5_OEN_SEL),
// REG_GET_FIELD(GPIO_FUNC5_OUT_SEL_CFG_REG,GPIO_FUNC5_OUT_INV_SEL),
// REG_GET_FIELD(GPIO_FUNC5_OUT_SEL_CFG_REG,GPIO_FUNC5_OUT_SEL)
// );
//
//Serial.printf("GPIO 4: %d %d %d %d\n",
// REG_GET_FIELD(GPIO_FUNC4_OUT_SEL_CFG_REG,GPIO_FUNC4_OEN_INV_SEL),
// REG_GET_FIELD(GPIO_FUNC4_OUT_SEL_CFG_REG,GPIO_FUNC4_OEN_SEL),
// REG_GET_FIELD(GPIO_FUNC4_OUT_SEL_CFG_REG,GPIO_FUNC4_OUT_INV_SEL),
// REG_GET_FIELD(GPIO_FUNC4_OUT_SEL_CFG_REG,GPIO_FUNC4_OUT_SEL)
// );
//
//Serial.printf("GPIO 33: %d %d %d %d\n",
// REG_GET_FIELD(GPIO_FUNC33_OUT_SEL_CFG_REG,GPIO_FUNC33_OEN_INV_SEL),
// REG_GET_FIELD(GPIO_FUNC33_OUT_SEL_CFG_REG,GPIO_FUNC33_OEN_SEL),
// REG_GET_FIELD(GPIO_FUNC33_OUT_SEL_CFG_REG,GPIO_FUNC33_OUT_INV_SEL),
// REG_GET_FIELD(GPIO_FUNC33_OUT_SEL_CFG_REG,GPIO_FUNC33_OUT_SEL)
// );
while(1); while(1);
} }