Updating Extras to work through S2 and C3 issues

This commit is contained in:
HomeSpan 2021-09-18 16:28:56 -05:00
parent 8b33f61464
commit 7255a9530f
4 changed files with 42 additions and 27 deletions

BIN
src/.DS_Store vendored

Binary file not shown.

View File

@ -22,7 +22,9 @@ LedC::LedC(uint8_t pin, uint16_t freq){
int res=LEDC_TIMER_BIT_MAX-1; // find the maximum possible resolution int res=LEDC_TIMER_BIT_MAX-1; // find the maximum possible resolution
while(getApbFrequency()/(freq*pow(2,res))<1) while(getApbFrequency()/(freq*pow(2,res))<1)
res--; res--;
Serial.println(getApbFrequency()/(freq*pow(2,res)));
timerList[nTimer][nMode]->duty_resolution=(ledc_timer_bit_t)res; timerList[nTimer][nMode]->duty_resolution=(ledc_timer_bit_t)res;
ledc_timer_config(timerList[nTimer][nMode]); ledc_timer_config(timerList[nTimer][nMode]);
@ -191,9 +193,11 @@ ledc_timer_config_t *LedC::timerList[LEDC_TIMER_MAX][LEDC_SPEED_MODE_MAX]={};
//////////////////////////// ////////////////////////////
//******************************************************* //*****************************************************************
// DEPRECATED - INCLUDED FOR BACKWARDS COMPATIBILITY ONLY // DEPRECATED - INCLUDED FOR BACKWARDS COMPATIBILITY FOR ESP32 ONLY
//******************************************************* //*****************************************************************
#ifdef CONFIG_IDF_TARGET_ESP32
PwmPin::PwmPin(uint8_t channel, uint8_t pin){ PwmPin::PwmPin(uint8_t channel, uint8_t pin){
this->channel=channel & 0x0F; this->channel=channel & 0x0F;
@ -283,3 +287,5 @@ void PwmPin::HSVtoRGB(float h, float s, float v, float *r, float *g, float *b ){
break; break;
} }
} }
#endif

View File

@ -15,7 +15,7 @@ RFControl::RFControl(int pin){
REG_SET_BIT(RMT_APB_CONF_REG,3); // enables access to RMT memory and enables wraparound mode (though the latter does not seem to be needed to set continuous TX) REG_SET_BIT(RMT_APB_CONF_REG,3); // enables access to RMT memory and enables wraparound mode (though the latter does not seem to be needed to set continuous TX)
REG_WRITE(RMT_INT_ENA_REG,1<<RMT_CH0_TX_END_INT_ENA_S); // enable end-transmission interrupt so that interrupt vector is called REG_WRITE(RMT_INT_ENA_REG,1<<RMT_CH0_TX_END_INT_ENA_S); // enable end-transmission interrupt so that interrupt vector is called
REG_WRITE(RMT_CH0CONF0_REG,0x08000000); // disable carrier wave; set channel 0 to use all 8 blocks of RMT memory REG_WRITE(RMT_CH0CONF0_REG,0x08000000); // disable carrier wave; set channel 0 to use all 8 blocks of RMT memory
esp_intr_alloc(ETS_RMT_INTR_SOURCE,0,eot_int,NULL,NULL); // set RMT general interrupt vector // esp_intr_alloc(ETS_RMT_INTR_SOURCE,0,eot_int,NULL,NULL); // set RMT general interrupt vector
configured=true; configured=true;
} }
@ -99,5 +99,5 @@ void RFControl::eot_int(void *arg){
boolean RFControl::configured=false; boolean RFControl::configured=false;
volatile int RFControl::numCycles; volatile int RFControl::numCycles;
uint32_t *RFControl::pRMT=(uint32_t *)RMT_CHANNEL_MEM(0); //int32_t *RFControl::pRMT=(uint32_t *)RMT_CHANNEL_MEM(0);
int RFControl::pCount=0; int RFControl::pCount=0;

View File

@ -14,33 +14,42 @@ void setup(){
Serial.println("Starting..."); Serial.println("Starting...");
LedPin led0(18,100,0); LedPin led12(12,99,500);
LedPin led1(19,100,2000); LedPin led5(5,20,20000);
LedPin led2(16,10,80000); LedPin led6(6,20,5000);
LedPin led3(17,100,2000); // LedPin led3(17,50,1);
LedPin led4(23,100,2); // LedPin led2(16,10,8000);
LedPin led5(22,0,3000); // LedPin led4(23,100,2);
LedPin led6(14,0,1); // LedPin led5(22,0,3000);
LedPin led7(32,0,1850); // LedPin led6(14,0,1);
LedPin led8(15); // LedPin led7(32,0,1850);
LedPin led9(33); // LedPin led8(15);
LedPin led10(27); // LedPin led9(33);
ServoPin led14(25); // LedPin led10(27);
LedPin led11(12,100,23); // ServoPin led14(25);
LedPin led12(13,100); // LedPin led11(12,100,23);
LedPin led13(26); // LedPin led12(13,100);
LedPin led15(4,0); // LedPin led13(26);
LedPin led16(5,0); // LedPin led15(4,0);
led16.set(20); Serial.printf("HELLO\n");
led0.set(5);
led14.set(100);
Serial.println(led0.getPin()); // led16.set(20);
// led0.set(5);
// led14.set(100);
// Serial.println(led0.getPin());
// Serial.println(led14.getPin()); // Serial.println(led14.getPin());
// Serial.println(led15.getPin()); // Serial.println(led15.getPin());
// Serial.println(led16.getPin()); // Serial.println(led16.getPin());
Serial.printf("RES0: %d\n",REG_GET_FIELD(LEDC_LSTIMER0_CONF_REG,LEDC_LSTIMER0_DUTY_RES));
Serial.printf("RES1: %d\n",REG_GET_FIELD(LEDC_LSTIMER1_CONF_REG,LEDC_LSTIMER1_DUTY_RES));
Serial.printf("RES2: %d\n",REG_GET_FIELD(LEDC_LSTIMER2_CONF_REG,LEDC_LSTIMER2_DUTY_RES));
Serial.printf("DIV0: %d\n",REG_GET_FIELD(LEDC_LSTIMER0_CONF_REG,LEDC_CLK_DIV_LSTIMER0)>>8);
Serial.printf("DIV1: %d\n",REG_GET_FIELD(LEDC_LSTIMER1_CONF_REG,LEDC_CLK_DIV_LSTIMER1)>>8);
Serial.printf("DIV2: %d\n",REG_GET_FIELD(LEDC_LSTIMER2_CONF_REG,LEDC_CLK_DIV_LSTIMER2)>>8);
// uint32_t v=REG_READ(LEDC_HSTIMER0_CONF_REG); // uint32_t v=REG_READ(LEDC_HSTIMER0_CONF_REG);
// Serial.printf("HS %d %d %d %d\n",(v>>25)&1,v&0x1f,(v>>13)&0x3FF,(v>>5)&0xFF); // Serial.printf("HS %d %d %d %d\n",(v>>25)&1,v&0x1f,(v>>13)&0x3FF,(v>>5)&0xFF);